Skip to content

Commit

Permalink
[sbus] code cleaning and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierhattenberger authored and flixr committed Jul 23, 2013
1 parent 8fa5406 commit f9be3ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
7 changes: 3 additions & 4 deletions sw/airborne/arch/stm32/mcu_periph/uart_arch.c
Expand Up @@ -41,11 +41,8 @@

void uart_periph_set_baudrate(struct uart_periph* p, uint32_t baud) {

/* Configure USART */
/* Configure USART baudrate */
usart_set_baudrate((uint32_t)p->reg_addr, baud);
//usart_set_databits((uint32_t)p->reg_addr, 8);
//usart_set_stopbits((uint32_t)p->reg_addr, USART_STOPBITS_1);
//usart_set_parity((uint32_t)p->reg_addr, USART_PARITY_NONE);

/* Disable Idle Line interrupt */
USART_CR1((uint32_t)p->reg_addr) &= ~USART_CR1_IDLEIE;
Expand All @@ -62,6 +59,7 @@ void uart_periph_set_baudrate(struct uart_periph* p, uint32_t baud) {
}

void uart_periph_set_bits_stop_parity(struct uart_periph* p, uint8_t bits, uint8_t stop, uint8_t parity) {
/* Configure USART parity and data bits */
if (parity == UPARITY_EVEN) {
usart_set_parity((uint32_t)p->reg_addr, USART_PARITY_EVEN);
if (bits == UBITS_7)
Expand All @@ -80,6 +78,7 @@ void uart_periph_set_bits_stop_parity(struct uart_periph* p, uint8_t bits, uint8
usart_set_parity((uint32_t)p->reg_addr, USART_PARITY_NONE);
usart_set_databits((uint32_t)p->reg_addr, 8); // is 7bits without parity possible ?
}
/* Configure USART stop bits */
if (stop == USTOP_2)
usart_set_stopbits((uint32_t)p->reg_addr, USART_STOPBITS_2);
else // 1 stop bit by default
Expand Down
15 changes: 7 additions & 8 deletions sw/airborne/subsystems/radio_control/sbus.h
Expand Up @@ -29,13 +29,6 @@

#include "std.h"

///**
// * Architecture dependant code
// */
//#include "subsystems/radio_control/ppm_arch.h"
///* must be implemented by arch dependant code */
//extern void ppm_arch_init(void);

/**
* Dummy macro to use radio.h file
*/
Expand All @@ -50,7 +43,13 @@
#include "generated/radio.h"

/**
* Define number of channels
* Define number of channels.
*
* SBUS frame always have 16 channels
* but only the X first one will be available
* depending of the RC transmitter.
* The radio XML file is used to assign the
* input values to RC channels.
*/
#define SBUS_BUF_LENGTH 24
#define SBUS_NB_CHANNEL 16
Expand Down

0 comments on commit f9be3ce

Please sign in to comment.