From b68248e069d2f66866d6b3f0144c3de2916661c5 Mon Sep 17 00:00:00 2001 From: jakegoodwin Date: Sun, 15 Jan 2023 14:37:57 -0800 Subject: [PATCH] updated example in readme for new interface --- README.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bcd751e..fbc2d71 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,28 @@ likely end up being the end result. ```C #include "avr_usart.h" -void send_bt_cmd(char* cmd) { +/* + *Description: Echos a single char back to the term. + */ +void echo_char(char* cmd) { init_usart(); - unsigned char data[] = "AT+WAKE\0"; - uint8_t result = usart_send_str(data); - if(result) { - raise_error(); + unsigned char data[1] = "0"; + uint8_t data_len = 1; + + //clear the buffer + serial0_flush_rxbuf(); + + //receive the char. + serial0_read(data, data_len); + + //Now echo it. + serial0_write(data, data_len); +} + +int main() { + while(1) { + echo_char(); } }