version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
TARGET_ARCH_PRO/TARGET_NXP/TARGET_LPC176X/gpio_object.h@85:024bf7f99721, 2014-06-11 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Jun 11 15:14:05 2014 +0100
- Revision:
- 85:024bf7f99721
Release 85 of the mbed library
Main changes:
- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F
There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 85:024bf7f99721 | 1 | /* mbed Microcontroller Library |
bogdanm | 85:024bf7f99721 | 2 | * Copyright (c) 2006-2013 ARM Limited |
bogdanm | 85:024bf7f99721 | 3 | * |
bogdanm | 85:024bf7f99721 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
bogdanm | 85:024bf7f99721 | 5 | * you may not use this file except in compliance with the License. |
bogdanm | 85:024bf7f99721 | 6 | * You may obtain a copy of the License at |
bogdanm | 85:024bf7f99721 | 7 | * |
bogdanm | 85:024bf7f99721 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
bogdanm | 85:024bf7f99721 | 9 | * |
bogdanm | 85:024bf7f99721 | 10 | * Unless required by applicable law or agreed to in writing, software |
bogdanm | 85:024bf7f99721 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
bogdanm | 85:024bf7f99721 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
bogdanm | 85:024bf7f99721 | 13 | * See the License for the specific language governing permissions and |
bogdanm | 85:024bf7f99721 | 14 | * limitations under the License. |
bogdanm | 85:024bf7f99721 | 15 | */ |
bogdanm | 85:024bf7f99721 | 16 | #ifndef MBED_GPIO_OBJECT_H |
bogdanm | 85:024bf7f99721 | 17 | #define MBED_GPIO_OBJECT_H |
bogdanm | 85:024bf7f99721 | 18 | |
bogdanm | 85:024bf7f99721 | 19 | #ifdef __cplusplus |
bogdanm | 85:024bf7f99721 | 20 | extern "C" { |
bogdanm | 85:024bf7f99721 | 21 | #endif |
bogdanm | 85:024bf7f99721 | 22 | |
bogdanm | 85:024bf7f99721 | 23 | typedef struct { |
bogdanm | 85:024bf7f99721 | 24 | PinName pin; |
bogdanm | 85:024bf7f99721 | 25 | uint32_t mask; |
bogdanm | 85:024bf7f99721 | 26 | |
bogdanm | 85:024bf7f99721 | 27 | __IO uint32_t *reg_dir; |
bogdanm | 85:024bf7f99721 | 28 | __IO uint32_t *reg_set; |
bogdanm | 85:024bf7f99721 | 29 | __IO uint32_t *reg_clr; |
bogdanm | 85:024bf7f99721 | 30 | __I uint32_t *reg_in; |
bogdanm | 85:024bf7f99721 | 31 | } gpio_t; |
bogdanm | 85:024bf7f99721 | 32 | |
bogdanm | 85:024bf7f99721 | 33 | static inline void gpio_write(gpio_t *obj, int value) { |
bogdanm | 85:024bf7f99721 | 34 | if (value) |
bogdanm | 85:024bf7f99721 | 35 | *obj->reg_set = obj->mask; |
bogdanm | 85:024bf7f99721 | 36 | else |
bogdanm | 85:024bf7f99721 | 37 | *obj->reg_clr = obj->mask; |
bogdanm | 85:024bf7f99721 | 38 | } |
bogdanm | 85:024bf7f99721 | 39 | |
bogdanm | 85:024bf7f99721 | 40 | static inline int gpio_read(gpio_t *obj) { |
bogdanm | 85:024bf7f99721 | 41 | return ((*obj->reg_in & obj->mask) ? 1 : 0); |
bogdanm | 85:024bf7f99721 | 42 | } |
bogdanm | 85:024bf7f99721 | 43 | |
bogdanm | 85:024bf7f99721 | 44 | #ifdef __cplusplus |
bogdanm | 85:024bf7f99721 | 45 | } |
bogdanm | 85:024bf7f99721 | 46 | #endif |
bogdanm | 85:024bf7f99721 | 47 | |
bogdanm | 85:024bf7f99721 | 48 | #endif |