diff options
| author | Ha Thach <[email protected]> | 2022-01-19 09:55:18 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-19 09:55:18 +0700 |
| commit | 84f2ca77f78d8a79d08377ba08ce72ca8e3da239 (patch) | |
| tree | 125fa390e86d3facfada2aff35d0b836499c0900 | |
| parent | 92c36f187d9580d01c51fd9084e5be7635e3e211 (diff) | |
| parent | 45d56915d157b4c38949a148391dcd10c19b50a5 (diff) | |
Merge pull request #1283 from kasjer/kasjer/olimex-pic32-board-fixes
olimex pic32 board fixes
| -rw-r--r-- | hw/bsp/pic32mz/boards/olimex_emz64/olimex_emz64.c | 4 | ||||
| -rw-r--r-- | hw/bsp/pic32mz/boards/olimex_hmz144/olimex_hmz144.c | 4 | ||||
| -rw-r--r-- | src/portable/microchip/pic32mz/dcd_pic32mz.c | 4 |
3 files changed, 8 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) diff --git a/src/portable/microchip/pic32mz/dcd_pic32mz.c b/src/portable/microchip/pic32mz/dcd_pic32mz.c index 323d01a71..740e5edbb 100644 --- a/src/portable/microchip/pic32mz/dcd_pic32mz.c +++ b/src/portable/microchip/pic32mz/dcd_pic32mz.c @@ -163,6 +163,10 @@ void dcd_remote_wakeup(uint8_t rhport) USB_REGS->POWERbits.RESUME = 1; #if CFG_TUSB_OS != OPT_OS_NONE osal_task_delay(10); +#else + // TODO: Wait in non blocking mode + unsigned cnt = 2000; + while (cnt--) __asm__("nop"); #endif USB_REGS->POWERbits.RESUME = 0; } |
