mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-09 23:18:14 +00:00
STM32: USART init changed
This commit is contained in:
parent
22529e28d8
commit
4348f4b0d4
@ -938,8 +938,8 @@ void Mprotocol_serial_init()
|
|||||||
PORTC.PIN3CTRL |= 0x40 ;
|
PORTC.PIN3CTRL |= 0x40 ;
|
||||||
#endif
|
#endif
|
||||||
#elif defined STM32_BOARD
|
#elif defined STM32_BOARD
|
||||||
Serial1.begin(100000,SERIAL_8E2);//USART2
|
usart2_begin(100000,SERIAL_8E2);
|
||||||
Serial2.begin(100000,SERIAL_8E2);//USART3
|
usart3_begin(100000,SERIAL_8E2);
|
||||||
USART2_BASE->CR1 |= USART_CR1_PCE_BIT;
|
USART2_BASE->CR1 |= USART_CR1_PCE_BIT;
|
||||||
USART3_BASE->CR1 &= ~ USART_CR1_RE;//disable
|
USART3_BASE->CR1 &= ~ USART_CR1_RE;//disable
|
||||||
USART2_BASE->CR1 &= ~ USART_CR1_TE;//disable transmit
|
USART2_BASE->CR1 &= ~ USART_CR1_TE;//disable transmit
|
||||||
|
@ -549,7 +549,7 @@ void TelemetryUpdate()
|
|||||||
USARTC0.CTRLC = 0x03 ;
|
USARTC0.CTRLC = 0x03 ;
|
||||||
#else
|
#else
|
||||||
#ifdef STM32_BOARD
|
#ifdef STM32_BOARD
|
||||||
Serial2.begin(9600); //USART3
|
usart3_begin(9600,SERIAL_8N1); //USART3
|
||||||
USART3_BASE->CR1 &= ~ USART_CR1_RE; //disable RX leave TX enabled
|
USART3_BASE->CR1 &= ~ USART_CR1_RE; //disable RX leave TX enabled
|
||||||
#else
|
#else
|
||||||
UBRR0H = 0x00;
|
UBRR0H = 0x00;
|
||||||
@ -570,7 +570,7 @@ void TelemetryUpdate()
|
|||||||
USARTC0.CTRLC = 0x03 ;*/
|
USARTC0.CTRLC = 0x03 ;*/
|
||||||
#else
|
#else
|
||||||
#ifdef STM32_BOARD
|
#ifdef STM32_BOARD
|
||||||
Serial2.begin(57600); //USART3
|
usart3_begin(57600,SERIAL_8N1); //USART3
|
||||||
USART3_BASE->CR1 &= ~ USART_CR1_RE; //disable RX leave TX enabled
|
USART3_BASE->CR1 &= ~ USART_CR1_RE; //disable RX leave TX enabled
|
||||||
#else
|
#else
|
||||||
UBRR0H = 0x00;
|
UBRR0H = 0x00;
|
||||||
@ -591,7 +591,7 @@ void TelemetryUpdate()
|
|||||||
USARTC0.CTRLC = 0x03 ;*/
|
USARTC0.CTRLC = 0x03 ;*/
|
||||||
#else
|
#else
|
||||||
#ifdef STM32_BOARD
|
#ifdef STM32_BOARD
|
||||||
Serial2.begin(125000); //USART3
|
usart3_begin(125000,SERIAL_8N1); //USART3
|
||||||
USART3_BASE->CR1 &= ~ USART_CR1_RE; //disable RX leave TX enabled
|
USART3_BASE->CR1 &= ~ USART_CR1_RE; //disable RX leave TX enabled
|
||||||
#else
|
#else
|
||||||
UBRR0H = 0x00;
|
UBRR0H = 0x00;
|
||||||
@ -641,7 +641,22 @@ void TelemetryUpdate()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef STM32_BOARD
|
||||||
|
void usart2_begin(uint32_t baud,uint32_t config )
|
||||||
|
{
|
||||||
|
usart_init(USART2);
|
||||||
|
usart_config_gpios_async(USART2,GPIOA,PIN_MAP[PA3].gpio_bit,GPIOA,PIN_MAP[PA2].gpio_bit,config);
|
||||||
|
usart_set_baud_rate(USART2, STM32_PCLK1, baud);//
|
||||||
|
usart_enable(USART2);
|
||||||
|
}
|
||||||
|
void usart3_begin(uint32_t baud,uint32_t config )
|
||||||
|
{
|
||||||
|
usart_init(USART3);
|
||||||
|
usart_config_gpios_async(USART3,GPIOB,PIN_MAP[PB11].gpio_bit,GPIOB,PIN_MAP[PB10].gpio_bit,config);
|
||||||
|
usart_set_baud_rate(USART3, STM32_PCLK1, baud);
|
||||||
|
usart_enable(USART3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#else //BASH_SERIAL
|
#else //BASH_SERIAL
|
||||||
// Routines for bit-bashed serial output
|
// Routines for bit-bashed serial output
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user