updated example in readme for new interface
This commit is contained in:
parent
ed2e9d0f82
commit
b68248e069
25
README.md
25
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue