Skip to content

Commit 45d5691

Browse files
committed
pic32/olimex boards: Fix active state of button
Buttons for olimex_emz64 and olimex_hmz144 should be set to active low in board configuration.
1 parent 168c709 commit 45d5691

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

hw/bsp/pic32mz/boards/olimex_emz64/olimex_emz64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void led_init(void)
6363
// RB8 - LED
6464
// ANASELB RB8 not analog
6565
ANSELBCLR = TU_BIT(8);
66-
// TRISH RH2 input
66+
// TRISH RH2 output
6767
TRISBCLR = TU_BIT(8);
6868
// Initial value 0, LED off
6969
LATBCLR = TU_BIT(8);
@@ -128,7 +128,7 @@ void board_led_write(bool state)
128128

129129
uint32_t board_button_read(void)
130130
{
131-
return (PORTB >> 12) & 1;
131+
return ((PORTB >> 12) & 1) == 0;
132132
}
133133

134134
int board_uart_write(void const * buf, int len)

hw/bsp/pic32mz/boards/olimex_hmz144/olimex_hmz144.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void led_init(void)
6060
{
6161
// RH2 - LED
6262
// ANASELH no analog function on RH2
63-
// TRISH RH2 input
63+
// TRISH RH2 output
6464
TRISHCLR = TU_BIT(2);
6565
// Initial value 0, LED off
6666
LATHCLR = TU_BIT(2);
@@ -126,7 +126,7 @@ void board_led_write(bool state)
126126

127127
uint32_t board_button_read(void)
128128
{
129-
return (PORTB >> 12) & 1;
129+
return ((PORTB >> 12) & 1) == 0;
130130
}
131131

132132
int board_uart_write(void const * buf, int len)

0 commit comments

Comments
 (0)