mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 13:55:40 +08:00
[lpc21][uart] also disable tx via USE_UARTx_TX=FALSE
This commit is contained in:
@@ -68,8 +68,8 @@ ap.CFLAGS += -DLOG_XBEE
|
||||
#ap.CFLAGS += -DLOG_PPRZ
|
||||
|
||||
#set the speed
|
||||
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B57600 -DUSE_UART0_RX_ONLY
|
||||
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DUSE_UART1_RX_ONLY
|
||||
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B57600 -DUSE_UART0_TX=FALSE
|
||||
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DUSE_UART1_TX=FALSE
|
||||
ap.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
#set SPI interface for SD card (0 or 1)
|
||||
|
||||
@@ -21,8 +21,8 @@ ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_logger.
|
||||
ap.CFLAGS += -DLOG_XBEE
|
||||
|
||||
#set the speed
|
||||
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B57600 -DUSE_UART0_RX_ONLY
|
||||
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DUSE_UART1_RX_ONLY
|
||||
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B57600 -DUSE_UART0_TX=FALSE
|
||||
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DUSE_UART1_TX=FALSE
|
||||
ap.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
</makefile>
|
||||
|
||||
@@ -44,8 +44,8 @@ LOG_MSG_FMT = LOG_PPRZ
|
||||
endif
|
||||
|
||||
#set the speed
|
||||
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=$(UART0_BAUD) -DUSE_UART0_RX_ONLY -DPERIPHERALS_AUTO_INIT
|
||||
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=$(UART1_BAUD) -DUSE_UART1_RX_ONLY
|
||||
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=$(UART0_BAUD) -DUSE_UART0_TX=FALSE -DPERIPHERALS_AUTO_INIT
|
||||
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=$(UART1_BAUD) -DUSE_UART1_TX=FALSE
|
||||
ap.CFLAGS += -DLOG_STOP_KEY=$(LOG_STOP_KEY)
|
||||
ap.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
ap.srcs += mcu_periph/uart.c
|
||||
|
||||
@@ -163,6 +163,19 @@ static inline void uart_ISR(struct uart_periph* p)
|
||||
#define UART0_VIC_SLOT 5
|
||||
#endif
|
||||
|
||||
/* by default enable UART Tx and Rx */
|
||||
#ifndef USE_UART0_TX
|
||||
#ifdef USE_UART0_RX_ONLY
|
||||
#warning "USE_UART0_RX_ONLY is deprecated, please set USE_UART0_TX=FALSE instead"
|
||||
#define USE_UART0_TX FALSE
|
||||
#else
|
||||
#define USE_UART0_TX TRUE
|
||||
#endif
|
||||
#endif
|
||||
#ifndef USE_UART0_RX
|
||||
#define USE_UART0_RX TRUE
|
||||
#endif
|
||||
|
||||
void uart0_ISR(void) __attribute__((naked));
|
||||
|
||||
void uart0_ISR(void) {
|
||||
@@ -180,16 +193,18 @@ void uart0_init( void ) {
|
||||
uart_periph_init(&uart0);
|
||||
uart0.reg_addr = UART0_BASE;
|
||||
|
||||
#ifdef USE_UART0_RX_ONLY
|
||||
// only use the RX0 P0.1 pin, no TX
|
||||
PINSEL0 = (PINSEL0 & ~U0_PINMASK_RX) | U0_PINSEL_RX;
|
||||
#else
|
||||
#if USE_UART0_RX && USE_UART0_TX
|
||||
// set port pins for UART0
|
||||
PINSEL0 = (PINSEL0 & ~U0_PINMASK) | U0_PINSEL;
|
||||
#elif USE_UART0_RX
|
||||
// only use the RX0 P0.1 pin, no TX
|
||||
PINSEL0 = (PINSEL0 & ~U0_PINMASK_RX) | U0_PINSEL_RX;
|
||||
#elif USE_UART0_TX
|
||||
// only use tx
|
||||
PINSEL0 = (PINSEL0 & ~U0_PINMASK_TX) | U0_PINSEL_TX;
|
||||
#endif
|
||||
|
||||
// initialize uart parameters
|
||||
uart_disable_interrupts(&uart0);
|
||||
uart_set_baudrate(&uart0, UART0_BAUD);
|
||||
|
||||
// initialize the interrupt vector
|
||||
@@ -209,6 +224,19 @@ void uart0_init( void ) {
|
||||
#define UART1_VIC_SLOT 6
|
||||
#endif
|
||||
|
||||
/* by default enable UART Tx and Rx */
|
||||
#ifndef USE_UART1_TX
|
||||
#ifdef USE_UART1_RX_ONLY
|
||||
#warning "USE_UART1_RX_ONLY is deprecated, please set USE_UART1_TX=FALSE instead"
|
||||
#define USE_UART1_TX FALSE
|
||||
#else
|
||||
#define USE_UART1_TX TRUE
|
||||
#endif
|
||||
#endif
|
||||
#ifndef USE_UART1_RX
|
||||
#define USE_UART1_RX TRUE
|
||||
#endif
|
||||
|
||||
void uart1_ISR(void) __attribute__((naked));
|
||||
|
||||
void uart1_ISR(void) {
|
||||
@@ -226,15 +254,17 @@ void uart1_init( void ) {
|
||||
uart_periph_init(&uart1);
|
||||
uart1.reg_addr = UART1_BASE;
|
||||
|
||||
#ifdef USE_UART1_RX_ONLY
|
||||
// only use the RX1 P0.9 pin, no TX
|
||||
PINSEL0 = (PINSEL0 & ~U1_PINMASK_RX) | U1_PINSEL_RX;
|
||||
#else
|
||||
#if USE_UART1_RX && USE_UART0_TX
|
||||
// set port pins for UART1
|
||||
PINSEL0 = (PINSEL0 & ~U1_PINMASK) | U1_PINSEL;
|
||||
#elif USE_UART1_RX
|
||||
// only use the RX0 P0.1 pin, no TX
|
||||
PINSEL0 = (PINSEL0 & ~U1_PINMASK_RX) | U1_PINSEL_RX;
|
||||
#elif USE_UART1_TX
|
||||
// only use tx
|
||||
PINSEL0 = (PINSEL0 & ~U1_PINMASK_TX) | U1_PINSEL_TX;
|
||||
#endif
|
||||
|
||||
uart_disable_interrupts(&uart1);
|
||||
uart_set_baudrate(&uart1, UART1_BAUD);
|
||||
|
||||
// initialize the interrupt vector
|
||||
|
||||
Reference in New Issue
Block a user