Fixed style / be more defensive writing register
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9869 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
566f91822b
commit
6de99ec69c
|
@ -139,11 +139,7 @@ static void usart0_init(const SerialConfig *config) {
|
||||||
uint8_t ucsr0c;
|
uint8_t ucsr0c;
|
||||||
|
|
||||||
UBRR0L = config->sc_brr;
|
UBRR0L = config->sc_brr;
|
||||||
#if defined(__AVR_ATmega162__)
|
|
||||||
UBRR0H = (config->sc_brr >> 8) & 0x0f;
|
UBRR0H = (config->sc_brr >> 8) & 0x0f;
|
||||||
#else
|
|
||||||
UBRR0H = config->sc_brr >> 8;
|
|
||||||
#endif
|
|
||||||
UCSR0A = 0;
|
UCSR0A = 0;
|
||||||
UCSR0B = (1 << RXEN0) | (1 << TXEN0) | (1 << RXCIE0);
|
UCSR0B = (1 << RXEN0) | (1 << TXEN0) | (1 << RXCIE0);
|
||||||
switch (config->sc_bits_per_char) {
|
switch (config->sc_bits_per_char) {
|
||||||
|
@ -180,7 +176,7 @@ static void usart0_deinit(void) {
|
||||||
UCSR0A = 0;
|
UCSR0A = 0;
|
||||||
UCSR0B = 0;
|
UCSR0B = 0;
|
||||||
#if defined(__AVR_ATmega162__)
|
#if defined(__AVR_ATmega162__)
|
||||||
UCSR0C = (1 << URSEL0) | 0;
|
UCSR0C = (1 << URSEL0);
|
||||||
#else
|
#else
|
||||||
UCSR0C = 0;
|
UCSR0C = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -204,11 +200,7 @@ static void usart1_init(const SerialConfig *config) {
|
||||||
uint8_t ucsr1c;
|
uint8_t ucsr1c;
|
||||||
|
|
||||||
UBRR1L = config->sc_brr;
|
UBRR1L = config->sc_brr;
|
||||||
#if defined(__AVR_ATmega162__)
|
|
||||||
UBRR1H = (config->sc_brr >> 8) & 0x0f;
|
UBRR1H = (config->sc_brr >> 8) & 0x0f;
|
||||||
#else
|
|
||||||
UBRR1H = config->sc_brr >> 8;
|
|
||||||
#endif
|
|
||||||
UCSR1A = 0;
|
UCSR1A = 0;
|
||||||
UCSR1B = (1 << RXEN1) | (1 << TXEN1) | (1 << RXCIE1);
|
UCSR1B = (1 << RXEN1) | (1 << TXEN1) | (1 << RXCIE1);
|
||||||
switch (config->sc_bits_per_char) {
|
switch (config->sc_bits_per_char) {
|
||||||
|
@ -245,7 +237,7 @@ static void usart1_deinit(void) {
|
||||||
UCSR1A = 0;
|
UCSR1A = 0;
|
||||||
UCSR1B = 0;
|
UCSR1B = 0;
|
||||||
#if defined(__AVR_ATmega162__)
|
#if defined(__AVR_ATmega162__)
|
||||||
UCSR1C = (1 << URSEL1) | 0;
|
UCSR1C = (1 << URSEL1);
|
||||||
#else
|
#else
|
||||||
UCSR1C = 0;
|
UCSR1C = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue