this hurts

Dependencies:   FFT

Committer:
shyamgatech
Date:
Thu Dec 03 18:15:35 2020 +0000
Revision:
7:0d62545e6d73
Parent:
0:d6c9b09b4042
addded gui mbed code;

Who changed what in which revision?

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