diff --git a/flexpret b/flexpret index 68af3ab..8f2b9a1 160000 --- a/flexpret +++ b/flexpret @@ -1 +1 @@ -Subproject commit 68af3ab60fa8c1f6504cb68e1d3e2aaae8678e51 +Subproject commit 8f2b9a12bef896138e60ec6d43ea29a7a1fac6be diff --git a/programs/TCRS/sddUart/README.md b/programs/TCRS/sddUart/README.md new file mode 100644 index 0000000..e69de29 diff --git a/programs/TCRS/sddUart/receive.c b/programs/TCRS/sddUart/receive.c new file mode 100644 index 0000000..a240377 --- /dev/null +++ b/programs/TCRS/sddUart/receive.c @@ -0,0 +1,32 @@ + +#include +#include +#include + +#define RX_PIN 0 +#define RX_BAUD 115200 +#define RX_PORT 1 + +static sdd_uart_config_t uart ={.initialized = false}; +void * t1(void * arg) { + uart.pin = RX_PIN; + uart.baud = RX_BAUD; + uart.port = RX_PORT; + uart.buf_size = 8; + sdd_uart_rx_run(&uart); +} + +void main(void) { + if(read_coreid() == 0) { + thread_t tid1 = 1; + int errno = thread_map(true, &tid1, t1, 0); + assert(errno == 0); + while(!uart.initialized) {}; + char byte; + while(true) { + if (sdd_uart_rx_receive(&uart, &byte) == FP_SUCCESS) { + print_int(byte); + } + } + } +} \ No newline at end of file diff --git a/programs/TCRS/sddUart/transmit.c b/programs/TCRS/sddUart/transmit.c new file mode 100644 index 0000000..cdabffd --- /dev/null +++ b/programs/TCRS/sddUart/transmit.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include + +#define UART_PIN 0 +#define UART_BAUD 270000 +#define UART_PORT 1 + + +void* t1(void * arg) { + fp_printer_config_t cfg = { + .port=UART_PORT, + .pin=UART_PIN, + .baudrate=UART_BAUD + }; + fp_printer_run(&cfg); +} + +void main(void) { + if(read_coreid() == 0) { + thread_t tid = 1; + + int errno = thread_map(true, &tid, t1, 0); + assert(errno == 0); + + fp_printer_str("Hello World!\n"); + } +} \ No newline at end of file diff --git a/programs/print/print_intercore.c b/programs/print/print_intercore.c index 5d7e6ad..fe36a18 100644 --- a/programs/print/print_intercore.c +++ b/programs/print/print_intercore.c @@ -6,8 +6,18 @@ #include #include +#define STDIO_UART_PIN 0 +#define STDIO_UART_BAUD 115200 +#define STDIO_UART_PORT 1 + void* t1(void* arg) { - fp_printer_run(); + fp_printer_config_t cfg = { + .baudrate = STDIO_UART_BAUD, + .pin = STDIO_UART_PIN, + .port = STDIO_UART_PORT + }; + + fp_printer_run(&cfg); } void *t2(void *arg) {