mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_NXP/TARGET_LPC15XX/serial_api.c
- Revision:
- 234:37acebda271b
- Parent:
- 227:7bd0639b8911
- Child:
- 250:a49055e7a707
diff -r 1bbc1451db33 -r 37acebda271b targets/hal/TARGET_NXP/TARGET_LPC15XX/serial_api.c --- a/targets/hal/TARGET_NXP/TARGET_LPC15XX/serial_api.c Tue Jun 17 11:30:08 2014 +0100 +++ b/targets/hal/TARGET_NXP/TARGET_LPC15XX/serial_api.c Wed Jun 18 09:00:08 2014 +0100 @@ -89,10 +89,10 @@ if (pn != NC) { // check if we have any function mapped to this pin already and remove it - for (int n = 0; n < sizeof(LPC_SWM->PINASSIGN)/sizeof(*LPC_SWM->PINASSIGN); n ++) { + for (uint32_t n = 0; n < sizeof(LPC_SWM->PINASSIGN)/sizeof(*LPC_SWM->PINASSIGN); n ++) { regVal = LPC_SWM->PINASSIGN[n]; - for (int j = 0; j <= 24; j += 8) { - if (((regVal >> j) & 0xFF) == pn) + for (uint32_t j = 0; j <= 24; j += 8) { + if (((regVal >> j) & 0xFF) == (uint32_t)pn) regVal |= (0xFF << j); } LPC_SWM->PINASSIGN[n] = regVal; @@ -105,7 +105,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { int is_stdio_uart = 0; - + int uart_n = get_available_uart(); if (uart_n == -1) { error("No available UART"); @@ -127,9 +127,8 @@ LPC_SYSCON->SYSAHBCLKCTRL1 |= (1 << (17 + uart_n)); /* Peripheral reset control to UART, a "1" bring it out of reset. */ -// LPC_SYSCON->PRESETCTRL1 &= ~(0x1 << (17 + uart_n)); LPC_SYSCON->PRESETCTRL1 |= (0x1 << (17 + uart_n)); - LPC_SYSCON->PRESETCTRL1 ^= (0x1 << (17 + uart_n)); + LPC_SYSCON->PRESETCTRL1 &= ~(0x1 << (17 + uart_n)); UARTSysClk = SystemCoreClock / LPC_SYSCON->UARTCLKDIV; @@ -143,9 +142,6 @@ /* enable uart interrupts */ NVIC_EnableIRQ((IRQn_Type)(UART0_IRQn + uart_n)); - /* Enable UART interrupt */ - // obj->uart->INTENSET = RXRDY | TXRDY | DELTA_RXBRK; - /* Enable UART */ obj->uart->CFG |= UART_EN;