exaples/softuart: add basic example for softuart
This commit is contained in:
parent
cd43eb4311
commit
5192f73183
3 changed files with 57 additions and 0 deletions
30
examples/softuart/main.c
Normal file
30
examples/softuart/main.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Softuart example
|
||||
*
|
||||
* Copyright (C) 2016 Bernhard Guillon <Bernhard.Guillon@web.de>
|
||||
* Copyright (c) 2015 plieningerweb
|
||||
*
|
||||
* MIT Licensed as described in the file LICENSE
|
||||
*/
|
||||
#include <esp/gpio.h>
|
||||
#include <esp/uart.h>
|
||||
#include <espressif/esp_common.h>
|
||||
#include <stdio.h>
|
||||
#include "softuart/softuart.h"
|
||||
|
||||
void user_init(void)
|
||||
{
|
||||
// setup real UART for now
|
||||
uart_set_baud(0, 115200);
|
||||
printf("SDK version:%s\n\n", sdk_system_get_sdk_version());
|
||||
|
||||
// setup software rx to 9600 8n1
|
||||
softuart_init(9600);
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (!softuart_available())
|
||||
continue;
|
||||
printf("%c",softuart_read());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue