mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
[led] add LED_AVAILABLE macro
This commit is contained in:
@@ -53,13 +53,13 @@ static inline void tunnel_event(void)
|
|||||||
{
|
{
|
||||||
unsigned char inc;
|
unsigned char inc;
|
||||||
|
|
||||||
#ifdef TUNNEL_RX_LED
|
#if LED_AVAILABLE(TUNNEL_RX_LED)
|
||||||
static uint32_t rx_time=0;
|
static uint32_t rx_time=0;
|
||||||
if (get_sys_time_msec() > rx_time + BLINK_MIN) {
|
if (get_sys_time_msec() > rx_time + BLINK_MIN) {
|
||||||
LED_OFF(TUNNEL_RX_LED);
|
LED_OFF(TUNNEL_RX_LED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef TUNNEL_TX_LED
|
#if LED_AVAILABLE(TUNNEL_TX_LED)
|
||||||
static uint32_t tx_time=0;
|
static uint32_t tx_time=0;
|
||||||
if (get_sys_time_msec() > tx_time + BLINK_MIN) {
|
if (get_sys_time_msec() > tx_time + BLINK_MIN) {
|
||||||
LED_OFF(TUNNEL_TX_LED);
|
LED_OFF(TUNNEL_TX_LED);
|
||||||
@@ -67,7 +67,7 @@ static inline void tunnel_event(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (uart_char_available(&USB_TUNNEL_UART) && VCOM_check_free_space(1)) {
|
if (uart_char_available(&USB_TUNNEL_UART) && VCOM_check_free_space(1)) {
|
||||||
#ifdef TUNNEL_RX_LED
|
#if LED_AVAILABLE(TUNNEL_RX_LED)
|
||||||
LED_ON(TUNNEL_RX_LED);
|
LED_ON(TUNNEL_RX_LED);
|
||||||
rx_time = get_sys_time_msec();
|
rx_time = get_sys_time_msec();
|
||||||
#endif
|
#endif
|
||||||
@@ -75,7 +75,7 @@ static inline void tunnel_event(void)
|
|||||||
VCOM_putchar(inc);
|
VCOM_putchar(inc);
|
||||||
}
|
}
|
||||||
if (VCOM_check_available() && uart_check_free_space(&USB_TUNNEL_UART, 1)) {
|
if (VCOM_check_available() && uart_check_free_space(&USB_TUNNEL_UART, 1)) {
|
||||||
#ifdef TUNNEL_TX_LED
|
#if LED_AVAILABLE(TUNNEL_TX_LED)
|
||||||
LED_ON(TUNNEL_TX_LED);
|
LED_ON(TUNNEL_TX_LED);
|
||||||
tx_time = get_sys_time_msec();
|
tx_time = get_sys_time_msec();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -95,12 +95,16 @@ static inline void led_init ( void ) {
|
|||||||
#endif /* LED_12 */
|
#endif /* LED_12 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define _LED_AVAILABLE(i) USE_LED_ ## i
|
||||||
|
#define LED_AVAILABLE(i) _LED_AVAILABLE(i)
|
||||||
|
|
||||||
#else /* USE_LED */
|
#else /* USE_LED */
|
||||||
static inline void led_init ( void ) {}
|
static inline void led_init ( void ) {}
|
||||||
#define LED_ON(i) {}
|
#define LED_ON(i) {}
|
||||||
#define LED_OFF(i) {}
|
#define LED_OFF(i) {}
|
||||||
#define LED_TOGGLE(i) {}
|
#define LED_TOGGLE(i) {}
|
||||||
#define LED_PERIODIC() {}
|
#define LED_PERIODIC() {}
|
||||||
|
#define LED_AVAILABLE(i) 0
|
||||||
#endif /* USE_LED */
|
#endif /* USE_LED */
|
||||||
|
|
||||||
#endif /* LED_H */
|
#endif /* LED_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user