make more readable & accurate

This commit is contained in:
Edward Emelianov 2023-01-07 14:37:46 +03:00
parent 8d0a16612d
commit 35ce9db36a
2 changed files with 3 additions and 1 deletions

Binary file not shown.

View File

@ -39,6 +39,8 @@ char *usart3_getline(int *wasbo){
return rbuf[!rbufno]; // current buffer is in filling stage, return old - filled - buffer
}
#define USART_BRR(speed) ((64000000 + speed/2) / speed)
// USART3 @ PD8 (Tx) and PD9 (Rx) - both AF0
void usart3_setup(){
RCC->IOPENR |= RCC_IOPENR_GPIODEN; // enable PD
@ -51,7 +53,7 @@ void usart3_setup(){
// enable USART3 clocking
RCC->APBENR1 |= RCC_APBENR1_USART3EN;
// baudrate 115200
USART3->BRR = 640000 / 1152;
USART3->BRR = USART_BRR(115200);
// eol character: '/n'
USART3->CR2 = USART_CR2_ADD_VAL('\n');
// enable DMA transmission