Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

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