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