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