#include #include #include #include "delay.h" #include "platform/stm32g0xx/Gpio.h" #include "platform/stm32g0xx/Uart.h" using namespace perinet::platform::stm32g0xx; Uart uart1(Uart::UartDevice::UART_1, 115200); Uart uart2(Uart::UartDevice::UART_2, 115200); int main(void) { char tx_buf[] = "\r\rProgram: UART bridge\r\n\n Receive on uart2 and transmit it on uart 1\r\n"; uint8_t rec; uart1.sync_send((const uint8_t *)tx_buf, strlen(tx_buf)); while(true) { if(uart2.sync_receive(&rec)) { uart1.sync_send(&rec, 1); } if(uart1.sync_receive(&rec)) { uart2.sync_send(&rec, 1); } } }