set UART function without clobbering the entire func_sel register.

This commit is contained in:
Mariano Alvira 2011-05-14 21:14:43 -04:00
parent 20bb355edd
commit e9ddca37e2

View file

@ -65,7 +65,10 @@ void uart1_init(uint16_t inc, uint16_t mod, uint8_t samp) {
*UART1_UCON = (1 << 0) | (1 << 1); /* enable receive, transmit */ *UART1_UCON = (1 << 0) | (1 << 1); /* enable receive, transmit */
if(samp == UCON_SAMP_16X) if(samp == UCON_SAMP_16X)
set_bit(*UART1_UCON,UCON_SAMP); set_bit(*UART1_UCON,UCON_SAMP);
*GPIO_FUNC_SEL0 = ( (0x01 << (14*2)) | (0x01 << (15*2)) ); /* set GPIO15-14 to UART (UART1 TX and RX)*/
/* set GPIO15-14 to UART (UART1 TX and RX)*/
GPIO->FUNC_SEL.GPIO_14 = 1;
GPIO->FUNC_SEL.GPIO_15 = 1;
/* interrupt when there are this number or more bytes free in the TX buffer*/ /* interrupt when there are this number or more bytes free in the TX buffer*/
*UART1_UTXCON = 16; *UART1_UTXCON = 16;