Skip to content

Commit 3e47f1f

Browse files
committed
add board_uart_read() for f7
1 parent b2a592d commit 3e47f1f

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

.github/actions/get_deps/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ runs:
99
using: "composite"
1010
steps:
1111
- name: Checkout pico-sdk for rp2040
12-
if: contains(inputs.arg, 'rp2040') || contains(inputs.arg, 'raspberry_pi_pico')
13-
uses: actions/checkout@v4
12+
if: >-
13+
contains(inputs.arg, 'rp2040') ||
14+
contains(inputs.arg, 'rp2350') ||
15+
contains(inputs.arg, 'raspberry_pi_pico') ||
16+
contains(inputs.arg, 'adafruit_fruit_jam')
17+
uses: actions/checkout@v6
1418
with:
1519
repository: raspberrypi/pico-sdk
1620
ref: master

hw/bsp/stm32f7/family.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,31 @@ size_t board_get_unique_id(uint8_t id[], size_t max_len) {
289289
}
290290

291291
int board_uart_read(uint8_t *buf, int len) {
292-
(void) buf;
293-
(void) len;
292+
#ifdef UART_DEV
293+
int count = 0;
294+
// clear overrun error if any
295+
if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_ORE)) {
296+
__HAL_UART_CLEAR_FLAG(&UartHandle, UART_CLEAR_OREF);
297+
}
298+
for (int i = 0; i < len; i++) {
299+
if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_RXNE)) {
300+
buf[i] = (uint8_t) UartHandle.Instance->RDR;
301+
count++;
302+
} else {
303+
break;
304+
}
305+
}
306+
return count;
307+
#else
308+
(void) buf; (void) len;
294309
return 0;
310+
#endif
295311
}
296312

297313
int board_uart_write(void const *buf, int len) {
298314
#ifdef UART_DEV
299-
HAL_UART_Transmit(&UartHandle, (uint8_t *) (uintptr_t) buf, len, 0xffff);
315+
HAL_UART_Transmit(&UartHandle, (uint8_t * )(uintptr_t)
316+
buf, len, 0xffff);
300317
return len;
301318
#else
302319
(void) buf; (void) len;
@@ -316,6 +333,11 @@ uint32_t tusb_time_millis_api(void) {
316333
return system_ticks;
317334
}
318335

336+
#elif CFG_TUSB_OS == OPT_OS_THREADX
337+
// Keep HAL_GetTick() working for HAL functions called from board_init()
338+
void osal_threadx_tick_cb(void) {
339+
HAL_IncTick();
340+
}
319341
#endif
320342

321343
void HardFault_Handler(void) {

hw/bsp/stm32h7/boards/stm32h743eval/board.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ static int32_t i2c_readreg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint1
211211
}
212212
HAL_Delay(10);
213213
}
214-
TU_ASSERT(0);
215214
return -1;
216215
}
217216

@@ -222,7 +221,6 @@ static int32_t i2c_writereg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint
222221
}
223222
HAL_Delay(10);
224223
}
225-
TU_ASSERT(0);
226224
return -1;
227225
}
228226

0 commit comments

Comments
 (0)