mirror of https://github.com/ARMmbed/mbed-os.git
Atmel: Cope correctly with NC GPIO
parent
fd68691ce3
commit
bd69ede5dc
|
|
@ -28,7 +28,6 @@ uint32_t gpio_set(PinName pin)
|
||||||
|
|
||||||
void gpio_init(gpio_t *obj, PinName pin)
|
void gpio_init(gpio_t *obj, PinName pin)
|
||||||
{
|
{
|
||||||
MBED_ASSERT(pin != (PinName)NC);
|
|
||||||
struct port_config pin_conf;
|
struct port_config pin_conf;
|
||||||
PortGroup *const port_base = (PortGroup*)port_get_group_from_gpio_pin(pin);
|
PortGroup *const port_base = (PortGroup*)port_get_group_from_gpio_pin(pin);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,15 @@ uint32_t gpio_set(PinName pin)
|
||||||
|
|
||||||
void gpio_init(gpio_t *obj, PinName pin)
|
void gpio_init(gpio_t *obj, PinName pin)
|
||||||
{
|
{
|
||||||
MBED_ASSERT(pin != (PinName)NC);
|
|
||||||
if (g_sys_init == 0) {
|
if (g_sys_init == 0) {
|
||||||
sysclk_init();
|
sysclk_init();
|
||||||
system_board_init();
|
system_board_init();
|
||||||
g_sys_init = 1;
|
g_sys_init = 1;
|
||||||
}
|
}
|
||||||
obj->pin = pin;
|
obj->pin = pin;
|
||||||
|
if (pin == NC) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ioport_set_pin_dir(pin, IOPORT_DIR_INPUT);
|
ioport_set_pin_dir(pin, IOPORT_DIR_INPUT);
|
||||||
ioport_set_pin_mode(pin, IOPORT_MODE_PULLUP);
|
ioport_set_pin_mode(pin, IOPORT_MODE_PULLUP);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue