/* Function below will be removed when the UART PD driver support the poll mode later. */ static uint32_t UART_DRV_SendPollBlocking( uint32_t instance, const uint8_t *buf, uint32_t count, uint32_t timeout) { uint32_t size = count; uint32_t baseAddr = g_uartBaseAddr[s_debugConsole.instance]; /* No timeout mechanism now. */ while (size--) { while (!UART_HAL_IsTxDataRegEmpty(baseAddr)) {} UART_HAL_Putchar(baseAddr, *buf++); } return count; }
size_t Uart::write(const uint8_t data) { #if FSL_FEATURE_SOC_UART_COUNT if(!SIM_HAL_GetGateCmd(SIM, gate_name)) return 0; uint32_t start = millis(); while (!UART_BRD_S1_TDRE(instance)) { if(millis() - start > 10) return 0; } UART_HAL_Putchar(instance, data); return 1; #endif return 0; }
void serial_putc(serial_t *obj, int c) { while (!serial_writable(obj)); uint32_t uart_addrs[] = UART_BASE_ADDRS; UART_HAL_Putchar(uart_addrs[obj->index], (uint8_t)c); }