Skip to content

Commit

Permalink
[uart] replace #ifdef USE_UARTx with #if USE_UARTx
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Dec 27, 2013
1 parent dee2ee5 commit 0166f09
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion conf/modules/ahrs_chimu_uart.xml
Expand Up @@ -17,7 +17,7 @@
<define name="AHRS_TRIGGERED_ATTITUDE_LOOP"/>
<define name="USE_AHRS"/>
<define name="USE_INS_MODULE"/>
<define name="USE_UART$(CHIMU_UART_NR)"/>
<define name="USE_UART$(CHIMU_UART_NR)" value="1"/>
<define name="INS_LINK" value="UART$(CHIMU_UART_NR)"/>
<define name="UART$(CHIMU_UART_NR)_BAUD" value="B115200"/>
<file name="ahrs_chimu_uart.c"/>
Expand Down
2 changes: 1 addition & 1 deletion conf/modules/extra_dl.xml
Expand Up @@ -11,7 +11,7 @@
<makefile>
<define name="EXTRA_DOWNLINK_DEVICE" value="UART0"/>
<define name="EXTRA_PPRZ_UART" value="UART0"/>
<define name="USE_UART0"/>
<define name="USE_UART0" value="1"/>
<define name="UART0_BAUD" value="B57600"/>
<file name="extra_pprz_dl.c"/>
</makefile>
Expand Down
2 changes: 1 addition & 1 deletion conf/modules/ins_xsens_MTiG_Uart0.xml
Expand Up @@ -12,7 +12,7 @@
<init fun="ins_init()"/>
<periodic fun="ins_periodic()" freq="60"/>
<makefile>
<define name="USE_UART0"/>
<define name="USE_UART0" value="1"/>
<define name="INS_LINK" value="UART0"/>
<define name="UART0_BAUD" value="B115200"/>
<define name="USE_GPS_XSENS"/>
Expand Down
2 changes: 1 addition & 1 deletion conf/modules/ins_xsens_MTi_Uart0.xml
Expand Up @@ -11,7 +11,7 @@
<init fun="ins_init()"/>
<periodic fun="ins_periodic()" freq="60"/>
<makefile>
<define name="USE_UART0"/>
<define name="USE_UART0" value="1"/>
<define name="INS_LINK" value="UART0"/>
<define name="UART0_BAUD" value="B115200"/>
<!-- calibrated, orientation, status -->
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/arch/lpc21/mcu_periph/uart_arch.c
Expand Up @@ -161,7 +161,7 @@ static inline void uart_ISR(struct uart_periph* p)
}
}

#ifdef USE_UART0
#if USE_UART0

#ifndef UART0_VIC_SLOT
#define UART0_VIC_SLOT 5
Expand Down Expand Up @@ -222,7 +222,7 @@ void uart0_init( void ) {

#endif /* USE_UART0 */

#ifdef USE_UART1
#if USE_UART1

#ifndef UART1_VIC_SLOT
#define UART1_VIC_SLOT 6
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/arch/lpc21/usb_ser_hw.c
Expand Up @@ -350,13 +350,13 @@ void set_linecoding(TLineCoding linecoding)
break;
}

#ifdef USE_UART0
#if USE_UART0
U0LCR = ULCR_DLAB_ENABLE; // select divisor latches
U0DLL = (uint8_t)baud; // set for baud low byte
U0DLM = (uint8_t)(baud >> 8); // set for baud high byte
U0LCR = (mode & ~ULCR_DLAB_ENABLE);
#endif
#ifdef USE_UART1
#if USE_UART1
U1LCR = ULCR_DLAB_ENABLE; // select divisor latches
U1DLL = (uint8_t)baud; // set for baud low byte
U1DLM = (uint8_t)(baud >> 8); // set for baud high byte
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/lpc21/usb_tunnel.c
Expand Up @@ -55,7 +55,7 @@ int main( void ) {

LED_ON(3);

#ifdef USE_UART0
#if USE_UART0
while(1) {
if (T0TC > (rx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(1);
if (T0TC > (tx_time+((PCLK / T0_PCLK_DIV) / BLINK_MIN))) LED_OFF(2);
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/arch/omap/mcu_periph/uart_arch.c
Expand Up @@ -117,7 +117,7 @@ static inline void uart_handler(struct uart_periph* periph) {

}

#ifdef USE_UART0
#if USE_UART0

void uart0_init( void ) {
uart_periph_init(&uart0);
Expand All @@ -132,7 +132,7 @@ void uart0_handler(void) {

#endif /* USE_UART0 */

#ifdef USE_UART1
#if USE_UART1

void uart1_init( void ) {
uart_periph_init(&uart1);
Expand Down
8 changes: 4 additions & 4 deletions sw/airborne/arch/stm32/mcu_periph/uart_arch.c
Expand Up @@ -183,7 +183,7 @@ static inline void usart_enable_irq(uint8_t IRQn) {
}


#ifdef USE_UART1
#if USE_UART1

/* by default enable UART Tx and Rx */
#ifndef USE_UART1_TX
Expand Down Expand Up @@ -247,7 +247,7 @@ void usart1_isr(void) { usart_isr(&uart1); }
#endif /* USE_UART1 */


#ifdef USE_UART2
#if USE_UART2

/* by default enable UART Tx and Rx */
#ifndef USE_UART2_TX
Expand Down Expand Up @@ -311,7 +311,7 @@ void usart2_isr(void) { usart_isr(&uart2); }
#endif /* USE_UART2 */


#ifdef USE_UART3
#if USE_UART3

/* by default enable UART Tx and Rx */
#ifndef USE_UART3_TX
Expand Down Expand Up @@ -426,7 +426,7 @@ void uart4_isr(void) { usart_isr(&uart4); }
#endif /* USE_UART4 */


#ifdef USE_UART5
#if USE_UART5

/* by default enable UART Tx and Rx */
#ifndef USE_UART5_TX
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/firmwares/beth/overo_test_uart.c
Expand Up @@ -130,10 +130,10 @@ static void main_periodic(int my_sig_num) {
RunOnceEvery(50, {DOWNLINK_SEND_ALIVE(gcs_com.udp_transport, 16, MD5SUM);});
RunOnceEvery(5, {DOWNLINK_SEND_ADC_GENERIC(gcs_com.udp_transport,&adc1,&adc2);});

#ifdef USE_UART0
#if USE_UART0
uart0_handler();
#endif
#ifdef USE_UART1
#if USE_UART1
uart1_handler();
#endif
DatalinkEvent()
Expand Down
12 changes: 6 additions & 6 deletions sw/airborne/firmwares/beth/uart_hw.c
Expand Up @@ -30,7 +30,7 @@
#include "serial_port.h"


#ifdef USE_UART0
#if USE_UART0

volatile uint16_t uart0_rx_insert_idx, uart0_rx_extract_idx;
uint8_t uart0_rx_buffer[UART0_RX_BUFFER_SIZE];
Expand Down Expand Up @@ -156,7 +156,7 @@ void uart0_handler(void) {

#endif /* USE_UART0 */

#ifdef USE_UART1
#if USE_UART1

volatile uint16_t uart1_rx_insert_idx, uart1_rx_extract_idx;
uint8_t uart1_rx_buffer[UART1_RX_BUFFER_SIZE];
Expand Down Expand Up @@ -250,17 +250,17 @@ void uart1_handler(void) {

void uart_init( void )
{
#ifdef USE_UART0
#if USE_UART0
uart0_init();
#endif
#ifdef USE_UART1
#if USE_UART1
uart1_init();
#endif
//TODO: add uart2 and greater
#ifdef USE_UART2
#if USE_UART2
uart2_init();
#endif
#ifdef USE_UART3
#if USE_UART3
uart3_init();
#endif
}
4 changes: 2 additions & 2 deletions sw/airborne/firmwares/beth/uart_hw.h
Expand Up @@ -44,7 +44,7 @@ extern void uart0_handler(void);
#endif


#ifdef USE_UART0
#if USE_UART0
#define UART0_RX_BUFFER_SIZE 128
#define UART0_TX_BUFFER_SIZE 128

Expand All @@ -69,7 +69,7 @@ extern void uart1_handler(void);
#endif


#ifdef USE_UART1
#if USE_UART1
#define UART1_RX_BUFFER_SIZE 128
#define UART1_TX_BUFFER_SIZE 128

Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/firmwares/logger/main_logger.c
Expand Up @@ -447,7 +447,7 @@ int do_log(void)
}
#endif

#ifdef USE_UART0
#if USE_UART0
temp = 0;
while (uart_char_available(&uart0) && (temp++ < 128))
{
Expand All @@ -464,7 +464,7 @@ int do_log(void)
#endif
}
#endif
#ifdef USE_UART1
#if USE_UART1
temp = 0;
while (uart_char_available(&uart1) && (temp++ < 128))
{
Expand Down
14 changes: 7 additions & 7 deletions sw/airborne/mcu.c
Expand Up @@ -71,25 +71,25 @@ void mcu_init(void) {
#if defined RADIO_CONTROL & defined RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT & defined RADIO_CONTROL_BIND_IMPL_FUNC
RADIO_CONTROL_BIND_IMPL_FUNC();
#endif
#ifdef USE_UART0
#if USE_UART0
uart0_init();
#endif
#ifdef USE_UART1
#if USE_UART1
uart1_init();
#endif
#ifdef USE_UART2
#if USE_UART2
uart2_init();
#endif
#ifdef USE_UART3
#if USE_UART3
uart3_init();
#endif
#ifdef USE_UART4
#if USE_UART4
uart4_init();
#endif
#ifdef USE_UART5
#if USE_UART5
uart5_init();
#endif
#ifdef USE_UART6
#if USE_UART6
uart6_init();
#endif
#ifdef USE_I2C0
Expand Down
14 changes: 7 additions & 7 deletions sw/airborne/mcu_periph/uart.c
Expand Up @@ -26,7 +26,7 @@
#include "subsystems/datalink/telemetry.h"
#endif

#ifdef USE_UART0
#if USE_UART0
struct uart_periph uart0;

#if DOWNLINK
Expand All @@ -42,7 +42,7 @@ static void send_uart0_err(void) {

#endif

#ifdef USE_UART1
#if USE_UART1
struct uart_periph uart1;

#if DOWNLINK
Expand All @@ -58,7 +58,7 @@ static void send_uart1_err(void) {

#endif

#ifdef USE_UART2
#if USE_UART2
struct uart_periph uart2;

#if DOWNLINK
Expand All @@ -74,7 +74,7 @@ static void send_uart2_err(void) {

#endif

#ifdef USE_UART3
#if USE_UART3
struct uart_periph uart3;

#if DOWNLINK
Expand All @@ -90,7 +90,7 @@ static void send_uart3_err(void) {

#endif

#ifdef USE_UART4
#if USE_UART4
struct uart_periph uart4;

#if DOWNLINK
Expand All @@ -106,7 +106,7 @@ static void send_uart4_err(void) {

#endif

#ifdef USE_UART5
#if USE_UART5
struct uart_periph uart5;

#if DOWNLINK
Expand All @@ -122,7 +122,7 @@ static void send_uart5_err(void) {

#endif

#ifdef USE_UART6
#if USE_UART6
struct uart_periph uart6;

#if DOWNLINK
Expand Down
14 changes: 7 additions & 7 deletions sw/airborne/mcu_periph/uart.h
Expand Up @@ -92,7 +92,7 @@ static inline uint16_t uart_char_available(struct uart_periph* p) {
}


#ifdef USE_UART0
#if USE_UART0
extern struct uart_periph uart0;
extern void uart0_init(void);

Expand All @@ -108,7 +108,7 @@ extern void uart0_init(void);

#endif // USE_UART0

#ifdef USE_UART1
#if USE_UART1
extern struct uart_periph uart1;
extern void uart1_init(void);

Expand All @@ -124,7 +124,7 @@ extern void uart1_init(void);

#endif // USE_UART1

#ifdef USE_UART2
#if USE_UART2
extern struct uart_periph uart2;
extern void uart2_init(void);

Expand All @@ -140,7 +140,7 @@ extern void uart2_init(void);

#endif // USE_UART2

#ifdef USE_UART3
#if USE_UART3
extern struct uart_periph uart3;
extern void uart3_init(void);

Expand All @@ -156,7 +156,7 @@ extern void uart3_init(void);

#endif // USE_UART3

#ifdef USE_UART4
#if USE_UART4
extern struct uart_periph uart4;
extern void uart4_init(void);

Expand All @@ -172,7 +172,7 @@ extern void uart4_init(void);

#endif // USE_UART4

#ifdef USE_UART5
#if USE_UART5
extern struct uart_periph uart5;
extern void uart5_init(void);

Expand All @@ -188,7 +188,7 @@ extern void uart5_init(void);

#endif // USE_UART5

#ifdef USE_UART6
#if USE_UART6
extern struct uart_periph uart6;
extern void uart6_init(void);

Expand Down

0 comments on commit 0166f09

Please sign in to comment.