2
2
/** \addtogroup hal */
3
3
/** @{*/
4
4
/* mbed Microcontroller Library
5
- * Copyright (c) 2006-2013 ARM Limited
5
+ * Copyright (c) 2006-2020 ARM Limited
6
6
* SPDX-License-Identifier: Apache-2.0
7
7
*
8
8
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,6 +46,8 @@ extern "C" {
46
46
* * ::gpio_init_out_ex inits the pin as an output and sets the output value
47
47
* * ::gpio_init_inout inits the pin to be input/output and set pin mode and value
48
48
* * The GPIO operations ::gpio_write, ::gpio_read take less than 20us to complete
49
+ * * The function ::gpio_get_capabilities fills the given
50
+ * `gpio_capabilities_t` instance according to pin capabilities.
49
51
*
50
52
* # Undefined behavior
51
53
* * Calling any ::gpio_mode, ::gpio_dir, ::gpio_write or ::gpio_read on a gpio_t object that was initialized
@@ -65,6 +67,14 @@ extern "C" {
65
67
*
66
68
*/
67
69
70
+ /** GPIO capabilities for a given pin
71
+ */
72
+ typedef struct {
73
+ uint8_t pull_none : 1 ;
74
+ uint8_t pull_down : 1 ;
75
+ uint8_t pull_up : 1 ;
76
+ } gpio_capabilities_t ;
77
+
68
78
/** Set the given pin as GPIO
69
79
*
70
80
* @param pin The pin to be set as GPIO
@@ -164,6 +174,10 @@ void gpio_init_out_ex(gpio_t *gpio, PinName pin, int value);
164
174
*/
165
175
void gpio_init_inout (gpio_t * gpio , PinName pin , PinDirection direction , PinMode mode , int value );
166
176
177
+ /** Fill the given gpio_capabilities_t instance according to pin capabilities.
178
+ */
179
+ void gpio_get_capabilities (gpio_t * gpio , gpio_capabilities_t * cap );
180
+
167
181
/** Get the pins that support all GPIO tests
168
182
*
169
183
* Return a PinMap array of pins that support GPIO. The
0 commit comments