Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Nov 11 20:59:50 2016 +0000
Revision:
0:5c4d7b2438d3
Initial commit

Who changed what in which revision?

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