mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Merge pull request #10509 from NXPmicro/LPC55S69_Add_UART_Flowcontrol
LPC55S69: Add support for UART hardware flow controlpull/10530/head
						commit
						b21c278274
					
				| 
						 | 
				
			
			@ -28,6 +28,7 @@
 | 
			
		|||
#include "fsl_usart.h"
 | 
			
		||||
#include "PeripheralPins.h"
 | 
			
		||||
#include "clock_config.h"
 | 
			
		||||
#include "gpio_api.h"
 | 
			
		||||
 | 
			
		||||
static uint32_t serial_irq_ids[FSL_FEATURE_SOC_USART_COUNT] = {0};
 | 
			
		||||
static uart_irq_handler irq_handler;
 | 
			
		||||
| 
						 | 
				
			
			@ -381,6 +382,48 @@ void serial_break_clear(serial_t *obj)
 | 
			
		|||
    uart_addrs[obj->index]->CTL &= ~USART_CTL_TXBRKEN_MASK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if DEVICE_SERIAL_FC
 | 
			
		||||
/*
 | 
			
		||||
 * Only hardware flow control is implemented in this API.
 | 
			
		||||
 */
 | 
			
		||||
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow)
 | 
			
		||||
{
 | 
			
		||||
    gpio_t gpio;
 | 
			
		||||
 | 
			
		||||
    switch(type) {
 | 
			
		||||
        case FlowControlRTS:
 | 
			
		||||
            pinmap_pinout(rxflow, PinMap_UART_RTS);
 | 
			
		||||
            uart_addrs[obj->index]->CFG &= ~USART_CFG_CTSEN_MASK;
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case FlowControlCTS:
 | 
			
		||||
            /* Do not use RTS, configure pin to GPIO input */
 | 
			
		||||
            gpio_init(&gpio, rxflow);
 | 
			
		||||
            gpio_dir(&gpio, PIN_INPUT);
 | 
			
		||||
 | 
			
		||||
            pinmap_pinout(txflow, PinMap_UART_CTS);
 | 
			
		||||
            uart_addrs[obj->index]->CFG |= USART_CFG_CTSEN_MASK;
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case FlowControlRTSCTS:
 | 
			
		||||
            pinmap_pinout(rxflow, PinMap_UART_RTS);
 | 
			
		||||
            pinmap_pinout(txflow, PinMap_UART_CTS);
 | 
			
		||||
            uart_addrs[obj->index]->CFG |= USART_CFG_CTSEN_MASK;
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case FlowControlNone:
 | 
			
		||||
            /* Do not use RTS, configure pin to GPIO input */
 | 
			
		||||
            gpio_init(&gpio, rxflow);
 | 
			
		||||
            gpio_dir(&gpio, PIN_INPUT);
 | 
			
		||||
 | 
			
		||||
            uart_addrs[obj->index]->CFG &= ~USART_CFG_CTSEN_MASK;
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        default:
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
const PinMap *serial_tx_pinmap()
 | 
			
		||||
{
 | 
			
		||||
    return PinMap_UART_TX;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,21 +65,27 @@ const PinMap PinMap_I2C_SCL[] = {
 | 
			
		|||
/************UART***************/
 | 
			
		||||
const PinMap PinMap_UART_TX[] = {
 | 
			
		||||
    {P0_30, UART_0, 1},
 | 
			
		||||
    {P1_6,  UART_0, 1},
 | 
			
		||||
    {P0_27, UART_1, 1},
 | 
			
		||||
    {NC   ,  NC   , 0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const PinMap PinMap_UART_RX[] = {
 | 
			
		||||
    {P0_29, UART_0, 1},
 | 
			
		||||
    {P1_5,  UART_0, 1},
 | 
			
		||||
    {P1_24, UART_1, 1},
 | 
			
		||||
    {NC   ,  NC   , 0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const PinMap PinMap_UART_CTS[] = {
 | 
			
		||||
    {P1_8,  UART_0, 1},
 | 
			
		||||
    {P1_26, UART_1, 1},
 | 
			
		||||
    {NC   , NC    , 0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const PinMap PinMap_UART_RTS[] = {
 | 
			
		||||
    {P1_7,  UART_0, 1},
 | 
			
		||||
    {P1_27, UART_1, 1},
 | 
			
		||||
    {NC   , NC    , 0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2088,6 +2088,7 @@
 | 
			
		|||
            "PORTINOUT",
 | 
			
		||||
            "PORTOUT",
 | 
			
		||||
            "SERIAL",
 | 
			
		||||
            "SERIAL_FC",
 | 
			
		||||
            "SLEEP",
 | 
			
		||||
            "SPI",
 | 
			
		||||
            "SPISLAVE",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue