mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Tue Mar 15 14:34:00 2016 +0000
Revision:
116:c0f6e94411f5
Parent:
102:da0ca467f8b5
Release 116 of the mbed library

Changes:
- new targets - NUCLEO_L073RZ
- fixes to IOTSS BEID platform
- LPC824, LPC1549 and LPC11U68 - fix PWMOut SCT bugs
- STM32F7 - Cube driver
- STM32F4 - add RTC LSI macro, defined as 0
- STM32F3 - fix multiple ADC clock initialization
- retarget - binary mode fix for GCC

Who changed what in which revision?

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