The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon May 19 18:14:09 2014 +0100
Revision:
84:0b3ab51c8877
Child:
86:04dd9b1680ae
Release 84 of the mbed library

Main changes:

- added LPC11U68 to the official build
- Bug fixes and new features for ST Nucleo boards
- I2C fixes for Freescale targets
- Added nRF51822 exporters

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 84:0b3ab51c8877 1 /* mbed Microcontroller Library
bogdanm 84:0b3ab51c8877 2 * Copyright (c) 2006-2013 ARM Limited
bogdanm 84:0b3ab51c8877 3 *
bogdanm 84:0b3ab51c8877 4 * Licensed under the Apache License, Version 2.0 (the "License");
bogdanm 84:0b3ab51c8877 5 * you may not use this file except in compliance with the License.
bogdanm 84:0b3ab51c8877 6 * You may obtain a copy of the License at
bogdanm 84:0b3ab51c8877 7 *
bogdanm 84:0b3ab51c8877 8 * http://www.apache.org/licenses/LICENSE-2.0
bogdanm 84:0b3ab51c8877 9 *
bogdanm 84:0b3ab51c8877 10 * Unless required by applicable law or agreed to in writing, software
bogdanm 84:0b3ab51c8877 11 * distributed under the License is distributed on an "AS IS" BASIS,
bogdanm 84:0b3ab51c8877 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bogdanm 84:0b3ab51c8877 13 * See the License for the specific language governing permissions and
bogdanm 84:0b3ab51c8877 14 * limitations under the License.
bogdanm 84:0b3ab51c8877 15 */
bogdanm 84:0b3ab51c8877 16 #ifndef MBED_GPIO_OBJECT_H
bogdanm 84:0b3ab51c8877 17 #define MBED_GPIO_OBJECT_H
bogdanm 84:0b3ab51c8877 18
bogdanm 84:0b3ab51c8877 19 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 20 extern "C" {
bogdanm 84:0b3ab51c8877 21 #endif
bogdanm 84:0b3ab51c8877 22
bogdanm 84:0b3ab51c8877 23 typedef struct {
bogdanm 84:0b3ab51c8877 24 PinName pin;
bogdanm 84:0b3ab51c8877 25 uint32_t mask;
bogdanm 84:0b3ab51c8877 26
bogdanm 84:0b3ab51c8877 27 __IO uint32_t *reg_dir;
bogdanm 84:0b3ab51c8877 28 __IO uint32_t *reg_set;
bogdanm 84:0b3ab51c8877 29 __IO uint32_t *reg_clr;
bogdanm 84:0b3ab51c8877 30 __I uint32_t *reg_in;
bogdanm 84:0b3ab51c8877 31 } gpio_t;
bogdanm 84:0b3ab51c8877 32
bogdanm 84:0b3ab51c8877 33 static inline void gpio_write(gpio_t *obj, int value) {
bogdanm 84:0b3ab51c8877 34 if (value)
bogdanm 84:0b3ab51c8877 35 *obj->reg_set = obj->mask;
bogdanm 84:0b3ab51c8877 36 else
bogdanm 84:0b3ab51c8877 37 *obj->reg_clr = obj->mask;
bogdanm 84:0b3ab51c8877 38 }
bogdanm 84:0b3ab51c8877 39
bogdanm 84:0b3ab51c8877 40 static inline int gpio_read(gpio_t *obj) {
bogdanm 84:0b3ab51c8877 41 return ((*obj->reg_in & obj->mask) ? 1 : 0);
bogdanm 84:0b3ab51c8877 42 }
bogdanm 84:0b3ab51c8877 43
bogdanm 84:0b3ab51c8877 44 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 45 }
bogdanm 84:0b3ab51c8877 46 #endif
bogdanm 84:0b3ab51c8877 47
bogdanm 84:0b3ab51c8877 48 #endif