MSP430/F2xxx: fix ubr msb byte being hardcoded to zero

This commit is contained in:
Antonio Lignan 2016-09-01 10:25:07 +02:00
parent 4ce322b7b0
commit 6dd17f5eec

View file

@ -146,8 +146,8 @@ uart0_init(unsigned long ubr)
UCA0CTL1 |= UCSWRST; /* Hold peripheral in reset state */ UCA0CTL1 |= UCSWRST; /* Hold peripheral in reset state */
UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */ UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */
UCA0BR0 = ubr; /* 8MHz/115200 = 69 = 0x45 */ UCA0BR0 = ((uint8_t *)&ubr)[0]; /* 8MHz/115200 = 69 = 0x45 */
UCA0BR1 = 0x00; UCA0BR1 = ((uint8_t *)&ubr)[1];
UCA0MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */ UCA0MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */
P3DIR &= ~0x20; /* P3.5 = USCI_A0 RXD as input */ P3DIR &= ~0x20; /* P3.5 = USCI_A0 RXD as input */