source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/gpio_api.h@ 374

Last change on this file since 374 was 374, checked in by coas-nagasima, 5 years ago

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

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