Skip to content

Commit 5d03c60

Browse files
committed
Improved GpioMcuInit function to first configure the output pin state before activating the pin.
1 parent 38d3058 commit 5d03c60

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/boards/LoRaMote/gpio-board.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ void GpioMcuInit( Gpio_t *obj, PinNames pin, PinModes mode, PinConfigs config, P
9292
}
9393
}
9494

95-
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
96-
9795
// Sets initial output value
9896
if( mode == PIN_OUTPUT )
9997
{
10098
GpioMcuWrite( obj, value );
10199
}
100+
101+
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
102102
}
103103

104104
void GpioMcuSetInterrupt( Gpio_t *obj, IrqModes irqMode, IrqPriorities irqPriority, GpioIrqHandler *irqHandler )

src/boards/MoteII/gpio-board.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ void GpioMcuInit( Gpio_t *obj, PinNames pin, PinModes mode, PinConfigs config, P
9292
}
9393
}
9494

95-
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
96-
9795
// Sets initial output value
9896
if( mode == PIN_OUTPUT )
9997
{
10098
GpioMcuWrite( obj, value );
10199
}
100+
101+
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
102102
}
103103

104104
void GpioMcuSetInterrupt( Gpio_t *obj, IrqModes irqMode, IrqPriorities irqPriority, GpioIrqHandler *irqHandler )

src/boards/NAMote72/gpio-board.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void GpioMcuInit( Gpio_t *obj, PinNames pin, PinModes mode, PinConfigs config, P
8080
}
8181
GPIO_InitStructure.Alternate = value;
8282
}
83-
else // mode ouptut
83+
else // mode output
8484
{
8585
if( config == PIN_OPEN_DRAIN )
8686
{
@@ -92,13 +92,13 @@ void GpioMcuInit( Gpio_t *obj, PinNames pin, PinModes mode, PinConfigs config, P
9292
}
9393
}
9494

95-
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
96-
9795
// Sets initial output value
9896
if( mode == PIN_OUTPUT )
9997
{
10098
GpioMcuWrite( obj, value );
10199
}
100+
101+
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
102102
}
103103

104104
void GpioMcuSetInterrupt( Gpio_t *obj, IrqModes irqMode, IrqPriorities irqPriority, GpioIrqHandler *irqHandler )

src/boards/SK-iM880A/gpio-board.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ void GpioMcuInit( Gpio_t *obj, PinNames pin, PinModes mode, PinConfigs config, P
9292
}
9393
}
9494

95-
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
96-
9795
// Sets initial output value
9896
if( mode == PIN_OUTPUT )
9997
{
10098
GpioMcuWrite( obj, value );
10199
}
100+
101+
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
102102
}
103103

104104
void GpioMcuSetInterrupt( Gpio_t *obj, IrqModes irqMode, IrqPriorities irqPriority, GpioIrqHandler *irqHandler )

src/boards/SensorNode/gpio-board.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ void GpioMcuInit( Gpio_t *obj, PinNames pin, PinModes mode, PinConfigs config, P
9292
}
9393
}
9494

95-
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
96-
9795
// Sets initial output value
9896
if( mode == PIN_OUTPUT )
9997
{
10098
GpioMcuWrite( obj, value );
10199
}
100+
101+
HAL_GPIO_Init( obj->port, &GPIO_InitStructure );
102102
}
103103

104104
void GpioMcuSetInterrupt( Gpio_t *obj, IrqModes irqMode, IrqPriorities irqPriority, GpioIrqHandler *irqHandler )

0 commit comments

Comments
 (0)