mirror of
https://github.com/hathach/tinyusb.git
synced 2026-03-24 16:34:55 +00:00
add board_uart_read() for f7
This commit is contained in:
8
.github/actions/get_deps/action.yml
vendored
8
.github/actions/get_deps/action.yml
vendored
@ -9,8 +9,12 @@ runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Checkout pico-sdk for rp2040
|
||||
if: contains(inputs.arg, 'rp2040') || contains(inputs.arg, 'raspberry_pi_pico')
|
||||
uses: actions/checkout@v4
|
||||
if: >-
|
||||
contains(inputs.arg, 'rp2040') ||
|
||||
contains(inputs.arg, 'rp2350') ||
|
||||
contains(inputs.arg, 'raspberry_pi_pico') ||
|
||||
contains(inputs.arg, 'adafruit_fruit_jam')
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: raspberrypi/pico-sdk
|
||||
ref: master
|
||||
|
||||
@ -289,14 +289,31 @@ size_t board_get_unique_id(uint8_t id[], size_t max_len) {
|
||||
}
|
||||
|
||||
int board_uart_read(uint8_t *buf, int len) {
|
||||
(void) buf;
|
||||
(void) len;
|
||||
#ifdef UART_DEV
|
||||
int count = 0;
|
||||
// clear overrun error if any
|
||||
if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_ORE)) {
|
||||
__HAL_UART_CLEAR_FLAG(&UartHandle, UART_CLEAR_OREF);
|
||||
}
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_RXNE)) {
|
||||
buf[i] = (uint8_t) UartHandle.Instance->RDR;
|
||||
count++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
#else
|
||||
(void) buf; (void) len;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int board_uart_write(void const *buf, int len) {
|
||||
#ifdef UART_DEV
|
||||
HAL_UART_Transmit(&UartHandle, (uint8_t *) (uintptr_t) buf, len, 0xffff);
|
||||
HAL_UART_Transmit(&UartHandle, (uint8_t * )(uintptr_t)
|
||||
buf, len, 0xffff);
|
||||
return len;
|
||||
#else
|
||||
(void) buf; (void) len;
|
||||
@ -316,6 +333,11 @@ uint32_t tusb_time_millis_api(void) {
|
||||
return system_ticks;
|
||||
}
|
||||
|
||||
#elif CFG_TUSB_OS == OPT_OS_THREADX
|
||||
// Keep HAL_GetTick() working for HAL functions called from board_init()
|
||||
void osal_threadx_tick_cb(void) {
|
||||
HAL_IncTick();
|
||||
}
|
||||
#endif
|
||||
|
||||
void HardFault_Handler(void) {
|
||||
|
||||
@ -211,7 +211,6 @@ static int32_t i2c_readreg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint1
|
||||
}
|
||||
HAL_Delay(10);
|
||||
}
|
||||
TU_ASSERT(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -222,7 +221,6 @@ static int32_t i2c_writereg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint
|
||||
}
|
||||
HAL_Delay(10);
|
||||
}
|
||||
TU_ASSERT(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user