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.

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Child:
93:e188a91d3eaa
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

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