The code from https://github.com/vpcola/Nucleo
mbed-src/hal/gpio_api.h@0:5464d5e415e5, 2014-10-08 (annotated)
- Committer:
- sinrab
- Date:
- Wed Oct 08 11:00:24 2014 +0000
- Revision:
- 0:5464d5e415e5
The code from https://github.com/vpcola/Nucleo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sinrab | 0:5464d5e415e5 | 1 | /* mbed Microcontroller Library |
sinrab | 0:5464d5e415e5 | 2 | * Copyright (c) 2006-2013 ARM Limited |
sinrab | 0:5464d5e415e5 | 3 | * |
sinrab | 0:5464d5e415e5 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
sinrab | 0:5464d5e415e5 | 5 | * you may not use this file except in compliance with the License. |
sinrab | 0:5464d5e415e5 | 6 | * You may obtain a copy of the License at |
sinrab | 0:5464d5e415e5 | 7 | * |
sinrab | 0:5464d5e415e5 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
sinrab | 0:5464d5e415e5 | 9 | * |
sinrab | 0:5464d5e415e5 | 10 | * Unless required by applicable law or agreed to in writing, software |
sinrab | 0:5464d5e415e5 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
sinrab | 0:5464d5e415e5 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
sinrab | 0:5464d5e415e5 | 13 | * See the License for the specific language governing permissions and |
sinrab | 0:5464d5e415e5 | 14 | * limitations under the License. |
sinrab | 0:5464d5e415e5 | 15 | */ |
sinrab | 0:5464d5e415e5 | 16 | #ifndef MBED_GPIO_API_H |
sinrab | 0:5464d5e415e5 | 17 | #define MBED_GPIO_API_H |
sinrab | 0:5464d5e415e5 | 18 | |
sinrab | 0:5464d5e415e5 | 19 | #include "device.h" |
sinrab | 0:5464d5e415e5 | 20 | |
sinrab | 0:5464d5e415e5 | 21 | #ifdef __cplusplus |
sinrab | 0:5464d5e415e5 | 22 | extern "C" { |
sinrab | 0:5464d5e415e5 | 23 | #endif |
sinrab | 0:5464d5e415e5 | 24 | |
sinrab | 0:5464d5e415e5 | 25 | /* Set the given pin as GPIO |
sinrab | 0:5464d5e415e5 | 26 | * @param pin The pin to be set as GPIO |
sinrab | 0:5464d5e415e5 | 27 | * @return The GPIO port mask for this pin |
sinrab | 0:5464d5e415e5 | 28 | **/ |
sinrab | 0:5464d5e415e5 | 29 | uint32_t gpio_set(PinName pin); |
sinrab | 0:5464d5e415e5 | 30 | |
sinrab | 0:5464d5e415e5 | 31 | /* GPIO object */ |
sinrab | 0:5464d5e415e5 | 32 | void gpio_init(gpio_t *obj, PinName pin); |
sinrab | 0:5464d5e415e5 | 33 | |
sinrab | 0:5464d5e415e5 | 34 | void gpio_mode (gpio_t *obj, PinMode mode); |
sinrab | 0:5464d5e415e5 | 35 | void gpio_dir (gpio_t *obj, PinDirection direction); |
sinrab | 0:5464d5e415e5 | 36 | |
sinrab | 0:5464d5e415e5 | 37 | void gpio_write(gpio_t *obj, int value); |
sinrab | 0:5464d5e415e5 | 38 | int gpio_read (gpio_t *obj); |
sinrab | 0:5464d5e415e5 | 39 | |
sinrab | 0:5464d5e415e5 | 40 | // the following set of functions are generic and are implemented in the common gpio.c file |
sinrab | 0:5464d5e415e5 | 41 | void gpio_init_in(gpio_t* gpio, PinName pin); |
sinrab | 0:5464d5e415e5 | 42 | void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode); |
sinrab | 0:5464d5e415e5 | 43 | void gpio_init_out(gpio_t* gpio, PinName pin); |
sinrab | 0:5464d5e415e5 | 44 | void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value); |
sinrab | 0:5464d5e415e5 | 45 | void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value); |
sinrab | 0:5464d5e415e5 | 46 | |
sinrab | 0:5464d5e415e5 | 47 | #ifdef __cplusplus |
sinrab | 0:5464d5e415e5 | 48 | } |
sinrab | 0:5464d5e415e5 | 49 | #endif |
sinrab | 0:5464d5e415e5 | 50 | |
sinrab | 0:5464d5e415e5 | 51 | #endif |
sinrab | 0:5464d5e415e5 | 52 |