The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_NRF52840_DK/TARGET_NORDIC/TARGET_NRF5/gpio_object.h@147:a97add6d7e64, 2017-07-19 (annotated)
- Committer:
- Kojto
- Date:
- Wed Jul 19 16:46:19 2017 +0100
- Revision:
- 147:a97add6d7e64
- Parent:
- 143:86740a56073b
Release 147 of the mbed library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 143:86740a56073b | 1 | /* mbed Microcontroller Library |
AnnaBridge | 143:86740a56073b | 2 | * Copyright (c) 2006-2013 ARM Limited |
AnnaBridge | 143:86740a56073b | 3 | * |
AnnaBridge | 143:86740a56073b | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
AnnaBridge | 143:86740a56073b | 5 | * you may not use this file except in compliance with the License. |
AnnaBridge | 143:86740a56073b | 6 | * You may obtain a copy of the License at |
AnnaBridge | 143:86740a56073b | 7 | * |
AnnaBridge | 143:86740a56073b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
AnnaBridge | 143:86740a56073b | 9 | * |
AnnaBridge | 143:86740a56073b | 10 | * Unless required by applicable law or agreed to in writing, software |
AnnaBridge | 143:86740a56073b | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
AnnaBridge | 143:86740a56073b | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
AnnaBridge | 143:86740a56073b | 13 | * See the License for the specific language governing permissions and |
AnnaBridge | 143:86740a56073b | 14 | * limitations under the License. |
AnnaBridge | 143:86740a56073b | 15 | */ |
AnnaBridge | 143:86740a56073b | 16 | #ifndef MBED_GPIO_OBJECT_H |
AnnaBridge | 143:86740a56073b | 17 | #define MBED_GPIO_OBJECT_H |
AnnaBridge | 143:86740a56073b | 18 | |
AnnaBridge | 143:86740a56073b | 19 | #include "mbed_assert.h" |
AnnaBridge | 143:86740a56073b | 20 | |
AnnaBridge | 143:86740a56073b | 21 | #include "nrf_gpio.h" |
AnnaBridge | 143:86740a56073b | 22 | |
AnnaBridge | 143:86740a56073b | 23 | #ifdef __cplusplus |
AnnaBridge | 143:86740a56073b | 24 | extern "C" { |
AnnaBridge | 143:86740a56073b | 25 | #endif |
AnnaBridge | 143:86740a56073b | 26 | |
AnnaBridge | 143:86740a56073b | 27 | typedef struct { |
AnnaBridge | 143:86740a56073b | 28 | PinName pin; |
AnnaBridge | 143:86740a56073b | 29 | } gpio_t; |
AnnaBridge | 143:86740a56073b | 30 | |
AnnaBridge | 143:86740a56073b | 31 | static inline void gpio_write(gpio_t *obj, int value) { |
AnnaBridge | 143:86740a56073b | 32 | MBED_ASSERT(obj->pin != (PinName)NC); |
AnnaBridge | 143:86740a56073b | 33 | if (value) { |
AnnaBridge | 143:86740a56073b | 34 | nrf_gpio_pin_set(obj->pin); |
AnnaBridge | 143:86740a56073b | 35 | } else { |
AnnaBridge | 143:86740a56073b | 36 | nrf_gpio_pin_clear(obj->pin); |
AnnaBridge | 143:86740a56073b | 37 | } |
AnnaBridge | 143:86740a56073b | 38 | } |
AnnaBridge | 143:86740a56073b | 39 | |
AnnaBridge | 143:86740a56073b | 40 | static inline int gpio_is_connected(const gpio_t *obj) { |
AnnaBridge | 143:86740a56073b | 41 | return obj->pin != (PinName)NC; |
AnnaBridge | 143:86740a56073b | 42 | } |
AnnaBridge | 143:86740a56073b | 43 | |
AnnaBridge | 143:86740a56073b | 44 | #ifdef __cplusplus |
AnnaBridge | 143:86740a56073b | 45 | } |
AnnaBridge | 143:86740a56073b | 46 | #endif |
AnnaBridge | 143:86740a56073b | 47 | |
AnnaBridge | 143:86740a56073b | 48 | #endif |