make possible use of BT module without LEDs tirepyro
authorBdale Garbee <bdale@gag.com>
Sat, 24 Feb 2024 08:21:30 +0000 (01:21 -0700)
committerBdale Garbee <bdale@gag.com>
Sat, 24 Feb 2024 08:22:12 +0000 (01:22 -0700)
src/drivers/ao_rn4678.c

index 3c07e7216cc34b3c084bffeee28ce12eed5aa44d..318902a0cc78e6e2152ec6dee31a317a0494c38d 100644 (file)
@@ -351,12 +351,16 @@ ao_bt_panic(int where)
        int i;
        for (;;) {
                for (i = 0; i < 25; i++) {
+#if AO_BT_LED
                        ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(10));
+#endif
                        ao_delay(AO_MS_TO_TICKS(10));
                }
                ao_delay(AO_MS_TO_TICKS(500));
                for (i = 0; i < where; i++) {
+#if AO_BT_LED
                        ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(200));
+#endif
                        ao_delay(AO_MS_TO_TICKS(200));
                }
        }
@@ -506,7 +510,9 @@ ao_rn(void)
                        ao_sleep(&ao_rn_connected);
                ao_arch_release_interrupts();
                while (ao_rn_connected) {
+#if AO_BT_LED
                        ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(20));
+#endif
                        if (ao_rn_buf_cnt != 0)
                                ao_wakeup(&ao_stdin_ready);
                        ao_delay(AO_SEC_TO_TICKS(3));
@@ -547,10 +553,12 @@ ao_rn_factory(void)
                v = 1-v;
                ao_delay(AO_MS_TO_TICKS(50));
                ao_gpio_set(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, v);
+#if AO_BT_LED
                if (v)
                        ao_led_on(AO_BT_LED);
                else
                        ao_led_off(AO_BT_LED);
+#endif
        }
 
        /* And let P3_1 float again */