1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

bootcfg: remove baudrate #defines for USARTs

The initial baud rates of each interface are now forced in the
board init code.

Any modules using USARTs should have fields added to
their settings object to allow the user to change the
baud rate from the default by using the COM layer APIs.

Developers requiring custom baud rates before the settings
objects are in place should locally edit the cfg structs
to specify the desired baud rates.
This commit is contained in:
Stacey Sheldon 2011-07-06 23:03:54 -04:00
parent a8787ee015
commit 226f095a2e
8 changed files with 11 additions and 80 deletions

View File

@ -208,11 +208,7 @@ void PIOS_ADC_handler() {
static const struct pios_usart_cfg pios_usart_aux_cfg = { static const struct pios_usart_cfg pios_usart_aux_cfg = {
.regs = USART3, .regs = USART3,
.init = { .init = {
#if defined (PIOS_USART_BAUDRATE) .USART_BaudRate = 230400,
.USART_BaudRate = PIOS_USART_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,

View File

@ -208,11 +208,7 @@ void PIOS_ADC_handler() {
static const struct pios_usart_cfg pios_usart_telem_main_cfg = { static const struct pios_usart_cfg pios_usart_telem_main_cfg = {
.regs = USART1, .regs = USART1,
.init = { .init = {
#if defined (PIOS_COM_TELEM_BAUDRATE) .USART_BaudRate = 57600,
.USART_BaudRate = PIOS_COM_TELEM_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -249,11 +245,7 @@ static const struct pios_usart_cfg pios_usart_telem_main_cfg = {
static const struct pios_usart_cfg pios_usart_telem_flexi_cfg = { static const struct pios_usart_cfg pios_usart_telem_flexi_cfg = {
.regs = USART3, .regs = USART3,
.init = { .init = {
#if defined (PIOS_COM_TELEM_BAUDRATE) .USART_BaudRate = 57600,
.USART_BaudRate = PIOS_COM_TELEM_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -295,11 +287,7 @@ static const struct pios_usart_cfg pios_usart_telem_flexi_cfg = {
static const struct pios_usart_cfg pios_usart_gps_main_cfg = { static const struct pios_usart_cfg pios_usart_gps_main_cfg = {
.regs = USART1, .regs = USART1,
.init = { .init = {
#if defined (PIOS_COM_GPS_BAUDRATE) .USART_BaudRate = 57600,
.USART_BaudRate = PIOS_COM_GPS_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -336,11 +324,7 @@ static const struct pios_usart_cfg pios_usart_gps_main_cfg = {
static const struct pios_usart_cfg pios_usart_gps_flexi_cfg = { static const struct pios_usart_cfg pios_usart_gps_flexi_cfg = {
.regs = USART3, .regs = USART3,
.init = { .init = {
#if defined (PIOS_COM_GPS_BAUDRATE) .USART_BaudRate = 57600,
.USART_BaudRate = PIOS_COM_GPS_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -384,11 +368,7 @@ static const struct pios_usart_cfg pios_usart_gps_flexi_cfg = {
static const struct pios_usart_cfg pios_usart_spektrum_main_cfg = { static const struct pios_usart_cfg pios_usart_spektrum_main_cfg = {
.regs = USART1, .regs = USART1,
.init = { .init = {
#if defined (PIOS_COM_SPEKTRUM_BAUDRATE) .USART_BaudRate = 115200,
.USART_BaudRate = PIOS_COM_SPEKTRUM_BAUDRATE,
#else
.USART_BaudRate = 115200,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -437,11 +417,7 @@ static const struct pios_spektrum_cfg pios_spektrum_main_cfg = {
static const struct pios_usart_cfg pios_usart_spektrum_flexi_cfg = { static const struct pios_usart_cfg pios_usart_spektrum_flexi_cfg = {
.regs = USART3, .regs = USART3,
.init = { .init = {
#if defined (PIOS_COM_SPEKTRUM_BAUDRATE) .USART_BaudRate = 115200,
.USART_BaudRate = PIOS_COM_SPEKTRUM_BAUDRATE,
#else
.USART_BaudRate = 115200,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -498,11 +474,7 @@ static const struct pios_spektrum_cfg pios_spektrum_flexi_cfg = {
static const struct pios_usart_cfg pios_usart_sbus_main_cfg = { static const struct pios_usart_cfg pios_usart_sbus_main_cfg = {
.regs = USART1, .regs = USART1,
.init = { .init = {
#if defined (PIOS_COM_SBUS_BAUDRATE) .USART_BaudRate = 100000,
.USART_BaudRate = PIOS_COM_SBUS_BAUDRATE,
#else
.USART_BaudRate = 100000,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_Even, .USART_Parity = USART_Parity_Even,
.USART_StopBits = USART_StopBits_2, .USART_StopBits = USART_StopBits_2,

View File

@ -268,11 +268,7 @@ void PIOS_SPI_accel_irq_handler(void)
static const struct pios_usart_cfg pios_usart_gps_cfg = { static const struct pios_usart_cfg pios_usart_gps_cfg = {
.regs = USART1, .regs = USART1,
.init = { .init = {
#if defined (PIOS_USART_BAUDRATE)
.USART_BaudRate = PIOS_USART_BAUDRATE,
#else
.USART_BaudRate = 57600, .USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -316,11 +312,7 @@ static const struct pios_usart_cfg pios_usart_gps_cfg = {
static const struct pios_usart_cfg pios_usart_aux_cfg = { static const struct pios_usart_cfg pios_usart_aux_cfg = {
.regs = USART4, .regs = USART4,
.init = { .init = {
#if defined (PIOS_USART_BAUDRATE)
.USART_BaudRate = PIOS_USART_BAUDRATE,
#else
.USART_BaudRate = 57600, .USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,

View File

@ -313,11 +313,7 @@ void PIOS_ADC_handler() {
static const struct pios_usart_cfg pios_usart_telem_cfg = { static const struct pios_usart_cfg pios_usart_telem_cfg = {
.regs = USART2, .regs = USART2,
.init = { .init = {
#if defined (PIOS_COM_TELEM_BAUDRATE) .USART_BaudRate = 57600,
.USART_BaudRate = PIOS_COM_TELEM_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -358,11 +354,7 @@ static const struct pios_usart_cfg pios_usart_gps_cfg = {
.regs = USART3, .regs = USART3,
.remap = GPIO_PartialRemap_USART3, .remap = GPIO_PartialRemap_USART3,
.init = { .init = {
#if defined (PIOS_COM_GPS_BAUDRATE) .USART_BaudRate = 57600,
.USART_BaudRate = PIOS_COM_GPS_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,
@ -403,11 +395,6 @@ static const struct pios_usart_cfg pios_usart_gps_cfg = {
static const struct pios_usart_cfg pios_usart_aux_cfg = { static const struct pios_usart_cfg pios_usart_aux_cfg = {
.regs = USART1, .regs = USART1,
.init = { .init = {
#if defined (PIOS_COM_AUX_BAUDRATE)
.USART_BaudRate = PIOS_COM_AUX_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_BaudRate = 57600, .USART_BaudRate = 57600,
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
@ -482,11 +469,7 @@ void PIOS_RTC_IRQ_Handler (void)
static const struct pios_usart_cfg pios_usart_spektrum_cfg = { static const struct pios_usart_cfg pios_usart_spektrum_cfg = {
.regs = USART1, .regs = USART1,
.init = { .init = {
#if defined (PIOS_COM_SPEKTRUM_BAUDRATE) .USART_BaudRate = 115200,
.USART_BaudRate = PIOS_COM_SPEKTRUM_BAUDRATE,
#else
.USART_BaudRate = 115200,
#endif
.USART_WordLength = USART_WordLength_8b, .USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No, .USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1, .USART_StopBits = USART_StopBits_1,

View File

@ -120,7 +120,6 @@ extern uint32_t pios_i2c_main_adapter_id;
#define PIOS_USART_MAX_DEVS 2 #define PIOS_USART_MAX_DEVS 2
#define PIOS_USART_RX_BUFFER_SIZE 256 #define PIOS_USART_RX_BUFFER_SIZE 256
#define PIOS_USART_TX_BUFFER_SIZE 256 #define PIOS_USART_TX_BUFFER_SIZE 256
#define PIOS_USART_BAUDRATE 230400
//------------------------- //-------------------------
// PIOS_COM // PIOS_COM

View File

@ -141,13 +141,11 @@ extern uint32_t pios_i2c_main_adapter_id;
//------------------------- //-------------------------
#define PIOS_COM_MAX_DEVS 4 #define PIOS_COM_MAX_DEVS 4
#define PIOS_COM_TELEM_BAUDRATE 57600
extern uint32_t pios_com_telem_rf_id; extern uint32_t pios_com_telem_rf_id;
#define PIOS_COM_TELEM_RF (pios_com_telem_rf_id) #define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
#define PIOS_COM_DEBUG PIOS_COM_TELEM_RF #define PIOS_COM_DEBUG PIOS_COM_TELEM_RF
#if defined(PIOS_INCLUDE_GPS) #if defined(PIOS_INCLUDE_GPS)
#define PIOS_COM_GPS_BAUDRATE 57600
extern uint32_t pios_com_gps_id; extern uint32_t pios_com_gps_id;
#define PIOS_COM_GPS (pios_com_gps_id) #define PIOS_COM_GPS (pios_com_gps_id)
#endif /* PIOS_INCLUDE_GPS */ #endif /* PIOS_INCLUDE_GPS */
@ -156,13 +154,11 @@ extern uint32_t pios_com_telem_usb_id;
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id) #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
#ifdef PIOS_INCLUDE_SPEKTRUM #ifdef PIOS_INCLUDE_SPEKTRUM
#define PIOS_COM_SPEKTRUM_BAUDRATE 115200
extern uint32_t pios_com_spektrum_id; extern uint32_t pios_com_spektrum_id;
#define PIOS_COM_SPEKTRUM (pios_com_spektrum_id) #define PIOS_COM_SPEKTRUM (pios_com_spektrum_id)
#endif #endif
#ifdef PIOS_INCLUDE_SBUS #ifdef PIOS_INCLUDE_SBUS
#define PIOS_COM_SBUS_BAUDRATE 100000
extern uint32_t pios_com_sbus_id; extern uint32_t pios_com_sbus_id;
#define PIOS_COM_SBUS (pios_com_sbus_id) #define PIOS_COM_SBUS (pios_com_sbus_id)
#endif #endif

View File

@ -135,12 +135,10 @@ extern uint32_t pios_i2c_gyro_adapter_id;
//------------------------- //-------------------------
#define PIOS_COM_MAX_DEVS 2 #define PIOS_COM_MAX_DEVS 2
#define PIOS_COM_GPS_BAUDRATE 57600
extern uint32_t pios_com_gps_id; extern uint32_t pios_com_gps_id;
#define PIOS_COM_GPS (pios_com_gps_id) #define PIOS_COM_GPS (pios_com_gps_id)
#ifdef PIOS_ENABLE_AUX_UART #ifdef PIOS_ENABLE_AUX_UART
#define PIOS_COM_AUX_BAUDRATE 57600
extern uint32_t pios_com_aux_id; extern uint32_t pios_com_aux_id;
#define PIOS_COM_AUX (pios_com_aux_id) #define PIOS_COM_AUX (pios_com_aux_id)
#define PIOS_COM_DEBUG PIOS_COM_AUX #define PIOS_COM_DEBUG PIOS_COM_AUX

View File

@ -149,11 +149,9 @@ extern uint32_t pios_i2c_main_adapter_id;
//------------------------- //-------------------------
#define PIOS_COM_MAX_DEVS 4 #define PIOS_COM_MAX_DEVS 4
#define PIOS_COM_TELEM_BAUDRATE 57600
extern uint32_t pios_com_telem_rf_id; extern uint32_t pios_com_telem_rf_id;
#define PIOS_COM_TELEM_RF (pios_com_telem_rf_id) #define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
#define PIOS_COM_GPS_BAUDRATE 57600
extern uint32_t pios_com_gps_id; extern uint32_t pios_com_gps_id;
#define PIOS_COM_GPS (pios_com_gps_id) #define PIOS_COM_GPS (pios_com_gps_id)
@ -161,20 +159,17 @@ extern uint32_t pios_com_telem_usb_id;
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id) #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
#ifdef PIOS_ENABLE_AUX_UART #ifdef PIOS_ENABLE_AUX_UART
#define PIOS_COM_AUX_BAUDRATE 57600
extern uint32_t pios_com_aux_id; extern uint32_t pios_com_aux_id;
#define PIOS_COM_AUX (pios_com_aux_id) #define PIOS_COM_AUX (pios_com_aux_id)
#define PIOS_COM_DEBUG PIOS_COM_AUX #define PIOS_COM_DEBUG PIOS_COM_AUX
#endif #endif
#ifdef PIOS_INCLUDE_SPEKTRUM #ifdef PIOS_INCLUDE_SPEKTRUM
#define PIOS_COM_SPEKTRUM_BAUDRATE 115200
extern uint32_t pios_com_spektrum_id; extern uint32_t pios_com_spektrum_id;
#define PIOS_COM_SPEKTRUM (pios_com_spektrum_id) #define PIOS_COM_SPEKTRUM (pios_com_spektrum_id)
#endif #endif
#ifdef PIOS_INCLUDE_SBUS #ifdef PIOS_INCLUDE_SBUS
#define PIOS_COM_SBUS_BAUDRATE 100000
extern uint32_t pios_com_sbus_id; extern uint32_t pios_com_sbus_id;
#define PIOS_COM_SBUS (pios_com_sbus_id) #define PIOS_COM_SBUS (pios_com_sbus_id)
#endif #endif