From df96c7452593d06ccb9d9cb85ddcb886fe86d779 Mon Sep 17 00:00:00 2001 From: AceVest Date: Mon, 3 Jun 2019 08:19:15 +0800 Subject: [PATCH] USART.md --- learn/doc/mac_bash_profile | 2 +- learn/stm32/USART.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 learn/stm32/USART.md diff --git a/learn/doc/mac_bash_profile b/learn/doc/mac_bash_profile index e123bb7..6d3c43c 100644 --- a/learn/doc/mac_bash_profile +++ b/learn/doc/mac_bash_profile @@ -11,7 +11,7 @@ export PATH=$PATH:/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin export PATH=$PATH:$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.0.1-arduino5/bin export PATH=$PATH:/usr/local/opt/go/libexec/bin #多个GOPATH用';'分隔 go get会存到第一个目录 -export GOPATH=$HOME/go:$HOME/workspace/web/qossvr/ +export GOPATH=$HOME/workspace/go:$HOME/workspace/web/qossvr/ export RTOS_PATH=$HOME/workspace/acecode/rtos/ RED="\[\033[01;31m\]" diff --git a/learn/stm32/USART.md b/learn/stm32/USART.md new file mode 100644 index 0000000..080af4f --- /dev/null +++ b/learn/stm32/USART.md @@ -0,0 +1,28 @@ +# USART + + +# debug + +如果是用STM32CubeIDE生成的代码 + +只需要在`usart.c`里添加如下几行 + +``` +#include +#ifdef __GNUC__ + #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) +#else + #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) +#endif +PUTCHAR_PROTOTYPE +{ + HAL_UART_Transmit(&huart1 , (uint8_t *)&ch, 1, 0xFFFF); + return ch; +} +``` + +生成代码的时候,选`USART1`,其它也可以,只是OneNetMiniBoard是`USART1`连到USB + +`Mode: Asynchronous` + +`Hadware Flow Control (RS233): Disable` \ No newline at end of file -- 2.44.0