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_TY51822R3/TARGET_NORDIC/TARGET_NRF5/gpio_object.h@124:2241e3a39974, 2016-08-19 (annotated)
- Committer:
- Kojto
- Date:
- Fri Aug 19 10:17:11 2016 +0100
- Revision:
- 124:2241e3a39974
Release 124 of the mbed library
Changes:
- new targets - KL27Z, K66F
- deprecate macro - add since argument
- override new and delete operators to trap errors
- Maxim - i2c and dac bugfixes
- STM - STM32F4 - serial flow enablement, enable async serial
- pwm and analog definition clean-up
- Nordic - NRF51 - fix for overflow in the ticket
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 124:2241e3a39974 | 1 | /* mbed Microcontroller Library |
Kojto | 124:2241e3a39974 | 2 | * Copyright (c) 2006-2013 ARM Limited |
Kojto | 124:2241e3a39974 | 3 | * |
Kojto | 124:2241e3a39974 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Kojto | 124:2241e3a39974 | 5 | * you may not use this file except in compliance with the License. |
Kojto | 124:2241e3a39974 | 6 | * You may obtain a copy of the License at |
Kojto | 124:2241e3a39974 | 7 | * |
Kojto | 124:2241e3a39974 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Kojto | 124:2241e3a39974 | 9 | * |
Kojto | 124:2241e3a39974 | 10 | * Unless required by applicable law or agreed to in writing, software |
Kojto | 124:2241e3a39974 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Kojto | 124:2241e3a39974 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Kojto | 124:2241e3a39974 | 13 | * See the License for the specific language governing permissions and |
Kojto | 124:2241e3a39974 | 14 | * limitations under the License. |
Kojto | 124:2241e3a39974 | 15 | */ |
Kojto | 124:2241e3a39974 | 16 | #ifndef MBED_GPIO_OBJECT_H |
Kojto | 124:2241e3a39974 | 17 | #define MBED_GPIO_OBJECT_H |
Kojto | 124:2241e3a39974 | 18 | |
Kojto | 124:2241e3a39974 | 19 | #include "mbed_assert.h" |
Kojto | 124:2241e3a39974 | 20 | |
Kojto | 124:2241e3a39974 | 21 | #include "nrf_gpio.h" |
Kojto | 124:2241e3a39974 | 22 | |
Kojto | 124:2241e3a39974 | 23 | #ifdef __cplusplus |
Kojto | 124:2241e3a39974 | 24 | extern "C" { |
Kojto | 124:2241e3a39974 | 25 | #endif |
Kojto | 124:2241e3a39974 | 26 | |
Kojto | 124:2241e3a39974 | 27 | typedef struct { |
Kojto | 124:2241e3a39974 | 28 | PinName pin; |
Kojto | 124:2241e3a39974 | 29 | } gpio_t; |
Kojto | 124:2241e3a39974 | 30 | |
Kojto | 124:2241e3a39974 | 31 | static inline void gpio_write(gpio_t *obj, int value) { |
Kojto | 124:2241e3a39974 | 32 | MBED_ASSERT(obj->pin != (PinName)NC); |
Kojto | 124:2241e3a39974 | 33 | if (value) { |
Kojto | 124:2241e3a39974 | 34 | nrf_gpio_pin_set(obj->pin); |
Kojto | 124:2241e3a39974 | 35 | } else { |
Kojto | 124:2241e3a39974 | 36 | nrf_gpio_pin_clear(obj->pin); |
Kojto | 124:2241e3a39974 | 37 | } |
Kojto | 124:2241e3a39974 | 38 | } |
Kojto | 124:2241e3a39974 | 39 | |
Kojto | 124:2241e3a39974 | 40 | static inline int gpio_is_connected(const gpio_t *obj) { |
Kojto | 124:2241e3a39974 | 41 | return obj->pin != (PinName)NC; |
Kojto | 124:2241e3a39974 | 42 | } |
Kojto | 124:2241e3a39974 | 43 | |
Kojto | 124:2241e3a39974 | 44 | #ifdef __cplusplus |
Kojto | 124:2241e3a39974 | 45 | } |
Kojto | 124:2241e3a39974 | 46 | #endif |
Kojto | 124:2241e3a39974 | 47 | |
Kojto | 124:2241e3a39974 | 48 | #endif |