PIR grove sensor that sends the sensed data to Thingspeak.com through the wifi module ESP 8266

Dependencies:   mbed

Committer:
skrawool
Date:
Mon Dec 05 16:39:27 2016 +0000
Revision:
0:3954a906acc2
PIR grove sensor that sends the sensed data to thingspeak through the wifi module ESP 8266

Who changed what in which revision?

UserRevisionLine numberNew contents of line
skrawool 0:3954a906acc2 1
skrawool 0:3954a906acc2 2 /** \addtogroup hal */
skrawool 0:3954a906acc2 3 /** @{*/
skrawool 0:3954a906acc2 4 /* mbed Microcontroller Library
skrawool 0:3954a906acc2 5 * Copyright (c) 2006-2013 ARM Limited
skrawool 0:3954a906acc2 6 *
skrawool 0:3954a906acc2 7 * Licensed under the Apache License, Version 2.0 (the "License");
skrawool 0:3954a906acc2 8 * you may not use this file except in compliance with the License.
skrawool 0:3954a906acc2 9 * You may obtain a copy of the License at
skrawool 0:3954a906acc2 10 *
skrawool 0:3954a906acc2 11 * http://www.apache.org/licenses/LICENSE-2.0
skrawool 0:3954a906acc2 12 *
skrawool 0:3954a906acc2 13 * Unless required by applicable law or agreed to in writing, software
skrawool 0:3954a906acc2 14 * distributed under the License is distributed on an "AS IS" BASIS,
skrawool 0:3954a906acc2 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
skrawool 0:3954a906acc2 16 * See the License for the specific language governing permissions and
skrawool 0:3954a906acc2 17 * limitations under the License.
skrawool 0:3954a906acc2 18 */
skrawool 0:3954a906acc2 19 #ifndef MBED_GPIO_API_H
skrawool 0:3954a906acc2 20 #define MBED_GPIO_API_H
skrawool 0:3954a906acc2 21
skrawool 0:3954a906acc2 22 #include <stdint.h>
skrawool 0:3954a906acc2 23 #include "device.h"
skrawool 0:3954a906acc2 24
skrawool 0:3954a906acc2 25 #ifdef __cplusplus
skrawool 0:3954a906acc2 26 extern "C" {
skrawool 0:3954a906acc2 27 #endif
skrawool 0:3954a906acc2 28
skrawool 0:3954a906acc2 29 /**
skrawool 0:3954a906acc2 30 * \defgroup hal_gpio GPIO HAL functions
skrawool 0:3954a906acc2 31 * @{
skrawool 0:3954a906acc2 32 */
skrawool 0:3954a906acc2 33
skrawool 0:3954a906acc2 34 /** Set the given pin as GPIO
skrawool 0:3954a906acc2 35 *
skrawool 0:3954a906acc2 36 * @param pin The pin to be set as GPIO
skrawool 0:3954a906acc2 37 * @return The GPIO port mask for this pin
skrawool 0:3954a906acc2 38 **/
skrawool 0:3954a906acc2 39 uint32_t gpio_set(PinName pin);
skrawool 0:3954a906acc2 40 /* Checks if gpio object is connected (pin was not initialized with NC)
skrawool 0:3954a906acc2 41 * @param pin The pin to be set as GPIO
skrawool 0:3954a906acc2 42 * @return 0 if port is initialized with NC
skrawool 0:3954a906acc2 43 **/
skrawool 0:3954a906acc2 44 int gpio_is_connected(const gpio_t *obj);
skrawool 0:3954a906acc2 45
skrawool 0:3954a906acc2 46 /** Initialize the GPIO pin
skrawool 0:3954a906acc2 47 *
skrawool 0:3954a906acc2 48 * @param obj The GPIO object to initialize
skrawool 0:3954a906acc2 49 * @param pin The GPIO pin to initialize
skrawool 0:3954a906acc2 50 */
skrawool 0:3954a906acc2 51 void gpio_init(gpio_t *obj, PinName pin);
skrawool 0:3954a906acc2 52
skrawool 0:3954a906acc2 53 /** Set the input pin mode
skrawool 0:3954a906acc2 54 *
skrawool 0:3954a906acc2 55 * @param obj The GPIO object
skrawool 0:3954a906acc2 56 * @param mode The pin mode to be set
skrawool 0:3954a906acc2 57 */
skrawool 0:3954a906acc2 58 void gpio_mode(gpio_t *obj, PinMode mode);
skrawool 0:3954a906acc2 59
skrawool 0:3954a906acc2 60 /** Set the pin direction
skrawool 0:3954a906acc2 61 *
skrawool 0:3954a906acc2 62 * @param obj The GPIO object
skrawool 0:3954a906acc2 63 * @param direction The pin direction to be set
skrawool 0:3954a906acc2 64 */
skrawool 0:3954a906acc2 65 void gpio_dir(gpio_t *obj, PinDirection direction);
skrawool 0:3954a906acc2 66
skrawool 0:3954a906acc2 67 /** Set the output value
skrawool 0:3954a906acc2 68 *
skrawool 0:3954a906acc2 69 * @param obj The GPIO object
skrawool 0:3954a906acc2 70 * @param value The value to be set
skrawool 0:3954a906acc2 71 */
skrawool 0:3954a906acc2 72 void gpio_write(gpio_t *obj, int value);
skrawool 0:3954a906acc2 73
skrawool 0:3954a906acc2 74 /** Read the input value
skrawool 0:3954a906acc2 75 *
skrawool 0:3954a906acc2 76 * @param obj The GPIO object
skrawool 0:3954a906acc2 77 * @return An integer value 1 or 0
skrawool 0:3954a906acc2 78 */
skrawool 0:3954a906acc2 79 int gpio_read(gpio_t *obj);
skrawool 0:3954a906acc2 80
skrawool 0:3954a906acc2 81 // the following functions are generic and implemented in the common gpio.c file
skrawool 0:3954a906acc2 82 // TODO: fix, will be moved to the common gpio header file
skrawool 0:3954a906acc2 83
skrawool 0:3954a906acc2 84 /** Init the input pin and set mode to PullDefault
skrawool 0:3954a906acc2 85 *
skrawool 0:3954a906acc2 86 * @param obj The GPIO object
skrawool 0:3954a906acc2 87 * @param pin The pin name
skrawool 0:3954a906acc2 88 */
skrawool 0:3954a906acc2 89 void gpio_init_in(gpio_t* gpio, PinName pin);
skrawool 0:3954a906acc2 90
skrawool 0:3954a906acc2 91 /** Init the input pin and set the mode
skrawool 0:3954a906acc2 92 *
skrawool 0:3954a906acc2 93 * @param obj The GPIO object
skrawool 0:3954a906acc2 94 * @param pin The pin name
skrawool 0:3954a906acc2 95 * @param mode The pin mode to be set
skrawool 0:3954a906acc2 96 */
skrawool 0:3954a906acc2 97 void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode);
skrawool 0:3954a906acc2 98
skrawool 0:3954a906acc2 99 /** Init the output pin as an output, with predefined output value 0
skrawool 0:3954a906acc2 100 *
skrawool 0:3954a906acc2 101 * @param obj The GPIO object
skrawool 0:3954a906acc2 102 * @param pin The pin name
skrawool 0:3954a906acc2 103 * @return An integer value 1 or 0
skrawool 0:3954a906acc2 104 */
skrawool 0:3954a906acc2 105 void gpio_init_out(gpio_t* gpio, PinName pin);
skrawool 0:3954a906acc2 106
skrawool 0:3954a906acc2 107 /** Init the pin as an output and set the output value
skrawool 0:3954a906acc2 108 *
skrawool 0:3954a906acc2 109 * @param obj The GPIO object
skrawool 0:3954a906acc2 110 * @param pin The pin name
skrawool 0:3954a906acc2 111 * @param value The value to be set
skrawool 0:3954a906acc2 112 */
skrawool 0:3954a906acc2 113 void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value);
skrawool 0:3954a906acc2 114
skrawool 0:3954a906acc2 115 /** Init the pin to be in/out
skrawool 0:3954a906acc2 116 *
skrawool 0:3954a906acc2 117 * @param obj The GPIO object
skrawool 0:3954a906acc2 118 * @param pin The pin name
skrawool 0:3954a906acc2 119 * @param direction The pin direction to be set
skrawool 0:3954a906acc2 120 * @param mode The pin mode to be set
skrawool 0:3954a906acc2 121 * @param value The value to be set for an output pin
skrawool 0:3954a906acc2 122 */
skrawool 0:3954a906acc2 123 void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value);
skrawool 0:3954a906acc2 124
skrawool 0:3954a906acc2 125 /**@}*/
skrawool 0:3954a906acc2 126
skrawool 0:3954a906acc2 127 #ifdef __cplusplus
skrawool 0:3954a906acc2 128 }
skrawool 0:3954a906acc2 129 #endif
skrawool 0:3954a906acc2 130
skrawool 0:3954a906acc2 131 #endif
skrawool 0:3954a906acc2 132
skrawool 0:3954a906acc2 133 /** @}*/