mirror of https://github.com/ARMmbed/mbed-os.git
Add HAL API for GPIO pinmap
parent
b2abfc3529
commit
a6eb48c2de
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue