don't use software UART
This commit is contained in:
parent
66c25ec0fd
commit
eb47261de4
19
main.c
19
main.c
|
@ -39,7 +39,6 @@
|
|||
#include "global.h" // board definitions
|
||||
#include "usart.h" // USART utilities
|
||||
#include "usb_cdcacm.h" // USB CDC ACM utilities
|
||||
#include "uart_soft.h" // software USART utilities
|
||||
|
||||
/** @defgroup main_flags flag set in interrupts to be processed in main task
|
||||
* @{
|
||||
|
@ -153,17 +152,6 @@ void main(void)
|
|||
// minimal setup ready
|
||||
printf("welcome to the STM32F1 CuVoodoo example code\n"); // print welcome message
|
||||
|
||||
// setup software UART
|
||||
printf("setup software UART: ");
|
||||
uint32_t uart_rx_baudrates[4] = {9600,0,0,0}; // the UART baudrates for the RX signals (0 if not used)
|
||||
uint32_t uart_tx_baudrates[4] = {9600,0,0,0}; // the UART baudrates for the RX signals (0 if not used)
|
||||
|
||||
if (uart_soft_setup(uart_rx_baudrates,uart_tx_baudrates)) { // setup software UART ports
|
||||
printf("OK\n");
|
||||
} else {
|
||||
printf("KO\n");
|
||||
}
|
||||
|
||||
// setup RTC
|
||||
printf("setup internal RTC: ");
|
||||
rtc_auto_awake(RCC_LSE, 32768-1); // ensure internal RTC is on, uses the 32.678 kHz LSE, and the prescale is set to our tick speed, else update backup registers accordingly (power off the micro-controller for the change to take effect)
|
||||
|
@ -195,16 +183,9 @@ void main(void)
|
|||
c = cdcacm_getchar(); // store receive character
|
||||
char_flag = true; // notify character has been received
|
||||
}
|
||||
while (uart_soft_received[0]) { // data received over USB
|
||||
action = true; // action has been performed
|
||||
led_toggle(); // toggle LED
|
||||
c = (char)uart_soft_getbyte(0); // store receive character
|
||||
char_flag = true; // notify character has been received
|
||||
}
|
||||
while (char_flag) { // user data received
|
||||
char_flag = false; // reset flag
|
||||
action = true; // action has been performed
|
||||
uart_soft_putbyte_nonblocking(0,(uint8_t)c);
|
||||
printf("%c",c); // echo receive character
|
||||
if (c=='\r' || c=='\n') { // end of command received
|
||||
if (command_i>0) { // there is a command to process
|
||||
|
|
Loading…
Reference in New Issue