Add HAL API for GPIO pinmap

pull/10644/head
Filip Jagodzinski 2019-05-23 13:27:41 +02:00
parent b2abfc3529
commit a6eb48c2de
2 changed files with 22 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <stdint.h>
#include "device.h"
#include "pinmap.h"
#ifdef __cplusplus
extern "C" {
@ -135,6 +136,18 @@ void gpio_init_out_ex(gpio_t *gpio, PinName pin, int value);
*/
void gpio_init_inout(gpio_t *gpio, PinName pin, PinDirection direction, PinMode mode, int value);
/** Get the pins that support all GPIO tests
*
* Return a PinMap array of pins that support GPIO. The
* array is terminated with {NC, NC, 0}.
*
* Targets should override the weak implementation of this
* function to provide the actual pinmap for GPIO testing.
*
* @return PinMap array
*/
const PinMap *gpio_pinmap(void);
/**@}*/
#ifdef __cplusplus

View File

@ -15,6 +15,7 @@
* limitations under the License.
*/
#include "hal/gpio_api.h"
#include "platform/mbed_toolchain.h"
static inline void _gpio_init_in(gpio_t *gpio, PinName pin, PinMode mode)
{
@ -66,3 +67,11 @@ void gpio_init_inout(gpio_t *gpio, PinName pin, PinDirection direction, PinMode
_gpio_init_out(gpio, pin, mode, value);
}
}
MBED_WEAK const PinMap *gpio_pinmap()
{
static const PinMap empty_gpio_pinmap[] = {
{NC, NC, 0},
};
return empty_gpio_pinmap;
}