uart-bridge: code refactor

Avoid lines with more than 80 characters.
Fix indentation (tabs = 8 spaces).

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
Álvaro Fernández Rojas 2021-02-03 15:45:04 +01:00
parent f46d93bb54
commit 85383842d5

View file

@ -110,22 +110,15 @@ int update_uart_cfg(void)
return updated;
}
void core1_entry(void)
void usb_cdc_process(void)
{
tusb_init();
while (1) {
tud_task();
if (tud_cdc_connected()) {
uint32_t count;
uint32_t len;
tud_cdc_get_line_coding(&CDC_LC);
/* Read bytes from USB */
if (tud_cdc_available()) {
uint32_t len;
mutex_enter_blocking(&USB_MTX);
len = MIN(tud_cdc_available(), BUFFER_SIZE - USB_POS);
@ -149,7 +142,17 @@ void core1_entry(void)
mutex_exit(&UART_MTX);
}
}
void core1_entry(void)
{
tusb_init();
while (1) {
tud_task();
if (tud_cdc_connected()) {
usb_cdc_process();
gpio_put(LED_PIN, 1);
} else {
gpio_put(LED_PIN, 0);
@ -187,7 +190,8 @@ int main(void)
if (uart_is_readable(UART_ID)) {
mutex_enter_blocking(&UART_MTX);
while (uart_is_readable(UART_ID) && UART_POS < BUFFER_SIZE) {
while (uart_is_readable(UART_ID) &&
UART_POS < BUFFER_SIZE) {
UART_BUFFER[UART_POS] = uart_getc(UART_ID);
UART_POS++;
}