22/** \addtogroup hal */
33/** @{*/
44/* mbed Microcontroller Library
5- * Copyright (c) 2006-2013 ARM Limited
5+ * Copyright (c) 2006-2020 ARM Limited
66 * SPDX-License-Identifier: Apache-2.0
77 *
88 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,6 +46,8 @@ extern "C" {
4646 * * ::gpio_init_out_ex inits the pin as an output and sets the output value
4747 * * ::gpio_init_inout inits the pin to be input/output and set pin mode and value
4848 * * 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.
4951 *
5052 * # Undefined behavior
5153 * * 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" {
6567 *
6668 */
6769
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+
6878/** Set the given pin as GPIO
6979 *
7080 * @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);
164174 */
165175void gpio_init_inout (gpio_t * gpio , PinName pin , PinDirection direction , PinMode mode , int value );
166176
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+
167181/** Get the pins that support all GPIO tests
168182 *
169183 * Return a PinMap array of pins that support GPIO. The
0 commit comments