summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerzy Kasenberg <[email protected]>2022-01-16 16:16:00 +0100
committerJerzy Kasenberg <[email protected]>2022-01-17 18:00:58 +0100
commit45d56915d157b4c38949a148391dcd10c19b50a5 (patch)
tree7cd6db5c767b66630b3c91fd9e300585b33d0870
parent168c7095e849e448cb7d3b755ea3b6e236f502ed (diff)
pic32/olimex boards: Fix active state of button
Buttons for olimex_emz64 and olimex_hmz144 should be set to active low in board configuration.
-rw-r--r--hw/bsp/pic32mz/boards/olimex_emz64/olimex_emz64.c4
-rw-r--r--hw/bsp/pic32mz/boards/olimex_hmz144/olimex_hmz144.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/hw/bsp/pic32mz/boards/olimex_emz64/olimex_emz64.c b/hw/bsp/pic32mz/boards/olimex_emz64/olimex_emz64.c
index 0f6dc37e2..e47ec5f31 100644
--- a/hw/bsp/pic32mz/boards/olimex_emz64/olimex_emz64.c
+++ b/hw/bsp/pic32mz/boards/olimex_emz64/olimex_emz64.c
@@ -63,7 +63,7 @@ void led_init(void)
// RB8 - LED
// ANASELB RB8 not analog
ANSELBCLR = TU_BIT(8);
- // TRISH RH2 input
+ // TRISH RH2 output
TRISBCLR = TU_BIT(8);
// Initial value 0, LED off
LATBCLR = TU_BIT(8);
@@ -128,7 +128,7 @@ void board_led_write(bool state)
uint32_t board_button_read(void)
{
- return (PORTB >> 12) & 1;
+ return ((PORTB >> 12) & 1) == 0;
}
int board_uart_write(void const * buf, int len)
diff --git a/hw/bsp/pic32mz/boards/olimex_hmz144/olimex_hmz144.c b/hw/bsp/pic32mz/boards/olimex_hmz144/olimex_hmz144.c
index 4ecbe75a1..93a8da5fb 100644
--- a/hw/bsp/pic32mz/boards/olimex_hmz144/olimex_hmz144.c
+++ b/hw/bsp/pic32mz/boards/olimex_hmz144/olimex_hmz144.c
@@ -60,7 +60,7 @@ void led_init(void)
{
// RH2 - LED
// ANASELH no analog function on RH2
- // TRISH RH2 input
+ // TRISH RH2 output
TRISHCLR = TU_BIT(2);
// Initial value 0, LED off
LATHCLR = TU_BIT(2);
@@ -126,7 +126,7 @@ void board_led_write(bool state)
uint32_t board_button_read(void)
{
- return (PORTB >> 12) & 1;
+ return ((PORTB >> 12) & 1) == 0;
}
int board_uart_write(void const * buf, int len)