Merge pull request #1283 from kasjer/kasjer/olimex-pic32-board-fixes

olimex pic32 board fixes
This commit is contained in:
Ha Thach
2022-01-19 09:55:18 +07:00
committed by GitHub
3 changed files with 8 additions and 4 deletions

View File

@@ -63,7 +63,7 @@ void led_init(void)
// RB8 - LED // RB8 - LED
// ANASELB RB8 not analog // ANASELB RB8 not analog
ANSELBCLR = TU_BIT(8); ANSELBCLR = TU_BIT(8);
// TRISH RH2 input // TRISH RH2 output
TRISBCLR = TU_BIT(8); TRISBCLR = TU_BIT(8);
// Initial value 0, LED off // Initial value 0, LED off
LATBCLR = TU_BIT(8); LATBCLR = TU_BIT(8);
@@ -128,7 +128,7 @@ void board_led_write(bool state)
uint32_t board_button_read(void) uint32_t board_button_read(void)
{ {
return (PORTB >> 12) & 1; return ((PORTB >> 12) & 1) == 0;
} }
int board_uart_write(void const * buf, int len) int board_uart_write(void const * buf, int len)

View File

@@ -60,7 +60,7 @@ void led_init(void)
{ {
// RH2 - LED // RH2 - LED
// ANASELH no analog function on RH2 // ANASELH no analog function on RH2
// TRISH RH2 input // TRISH RH2 output
TRISHCLR = TU_BIT(2); TRISHCLR = TU_BIT(2);
// Initial value 0, LED off // Initial value 0, LED off
LATHCLR = TU_BIT(2); LATHCLR = TU_BIT(2);
@@ -126,7 +126,7 @@ void board_led_write(bool state)
uint32_t board_button_read(void) uint32_t board_button_read(void)
{ {
return (PORTB >> 12) & 1; return ((PORTB >> 12) & 1) == 0;
} }
int board_uart_write(void const * buf, int len) int board_uart_write(void const * buf, int len)

View File

@@ -163,6 +163,10 @@ void dcd_remote_wakeup(uint8_t rhport)
USB_REGS->POWERbits.RESUME = 1; USB_REGS->POWERbits.RESUME = 1;
#if CFG_TUSB_OS != OPT_OS_NONE #if CFG_TUSB_OS != OPT_OS_NONE
osal_task_delay(10); osal_task_delay(10);
#else
// TODO: Wait in non blocking mode
unsigned cnt = 2000;
while (cnt--) __asm__("nop");
#endif #endif
USB_REGS->POWERbits.RESUME = 0; USB_REGS->POWERbits.RESUME = 0;
} }