mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c
Dependents: Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay
Fork of mbed-dev by
targets/TARGET_ublox/TARGET_HI2110/gpio_object.h@150:02e0a0aed4ec, 2016-11-08 (annotated)
- Committer:
- <>
- Date:
- Tue Nov 08 17:45:16 2016 +0000
- Revision:
- 150:02e0a0aed4ec
This updates the lib to the mbed lib v129
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 150:02e0a0aed4ec | 1 | /* mbed Microcontroller Library |
<> | 150:02e0a0aed4ec | 2 | * Copyright (c) 2006-2013 ARM Limited |
<> | 150:02e0a0aed4ec | 3 | * |
<> | 150:02e0a0aed4ec | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 150:02e0a0aed4ec | 5 | * you may not use this file except in compliance with the License. |
<> | 150:02e0a0aed4ec | 6 | * You may obtain a copy of the License at |
<> | 150:02e0a0aed4ec | 7 | * |
<> | 150:02e0a0aed4ec | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 150:02e0a0aed4ec | 9 | * |
<> | 150:02e0a0aed4ec | 10 | * Unless required by applicable law or agreed to in writing, software |
<> | 150:02e0a0aed4ec | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 150:02e0a0aed4ec | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 150:02e0a0aed4ec | 13 | * See the License for the specific language governing permissions and |
<> | 150:02e0a0aed4ec | 14 | * limitations under the License. |
<> | 150:02e0a0aed4ec | 15 | */ |
<> | 150:02e0a0aed4ec | 16 | #ifndef MBED_GPIO_OBJECT_H |
<> | 150:02e0a0aed4ec | 17 | #define MBED_GPIO_OBJECT_H |
<> | 150:02e0a0aed4ec | 18 | |
<> | 150:02e0a0aed4ec | 19 | #include "mbed_assert.h" |
<> | 150:02e0a0aed4ec | 20 | |
<> | 150:02e0a0aed4ec | 21 | #ifdef __cplusplus |
<> | 150:02e0a0aed4ec | 22 | extern "C" { |
<> | 150:02e0a0aed4ec | 23 | #endif |
<> | 150:02e0a0aed4ec | 24 | |
<> | 150:02e0a0aed4ec | 25 | typedef struct { |
<> | 150:02e0a0aed4ec | 26 | PinName pin; |
<> | 150:02e0a0aed4ec | 27 | uint32_t mask; |
<> | 150:02e0a0aed4ec | 28 | |
<> | 150:02e0a0aed4ec | 29 | __IO uint32_t *reg_dir; |
<> | 150:02e0a0aed4ec | 30 | __IO uint32_t *reg_set; |
<> | 150:02e0a0aed4ec | 31 | __IO uint32_t *reg_clr; |
<> | 150:02e0a0aed4ec | 32 | __I uint32_t *reg_val; |
<> | 150:02e0a0aed4ec | 33 | } gpio_t; |
<> | 150:02e0a0aed4ec | 34 | |
<> | 150:02e0a0aed4ec | 35 | static inline void gpio_write(gpio_t *obj, int value) { |
<> | 150:02e0a0aed4ec | 36 | MBED_ASSERT(obj->pin != (PinName)NC); |
<> | 150:02e0a0aed4ec | 37 | if (value) { |
<> | 150:02e0a0aed4ec | 38 | *obj->reg_set = obj->mask; |
<> | 150:02e0a0aed4ec | 39 | } else { |
<> | 150:02e0a0aed4ec | 40 | *obj->reg_clr = obj->mask; |
<> | 150:02e0a0aed4ec | 41 | } |
<> | 150:02e0a0aed4ec | 42 | } |
<> | 150:02e0a0aed4ec | 43 | |
<> | 150:02e0a0aed4ec | 44 | static inline int gpio_read(gpio_t *obj) { |
<> | 150:02e0a0aed4ec | 45 | MBED_ASSERT(obj->pin != (PinName)NC); |
<> | 150:02e0a0aed4ec | 46 | return ((*obj->reg_val & obj->mask) ? 1 : 0); |
<> | 150:02e0a0aed4ec | 47 | } |
<> | 150:02e0a0aed4ec | 48 | |
<> | 150:02e0a0aed4ec | 49 | static inline int gpio_is_connected(const gpio_t *obj) { |
<> | 150:02e0a0aed4ec | 50 | return obj->pin != (PinName)NC; |
<> | 150:02e0a0aed4ec | 51 | } |
<> | 150:02e0a0aed4ec | 52 | |
<> | 150:02e0a0aed4ec | 53 | #ifdef __cplusplus |
<> | 150:02e0a0aed4ec | 54 | } |
<> | 150:02e0a0aed4ec | 55 | #endif |
<> | 150:02e0a0aed4ec | 56 | |
<> | 150:02e0a0aed4ec | 57 | #endif |