altos: Remove ao_led_toggle API from general code
authorKeith Packard <keithp@keithp.com>
Sat, 8 Aug 2020 01:17:07 +0000 (18:17 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 8 Aug 2020 03:30:11 +0000 (20:30 -0700)
The generic implementation would need to record LED status as it
cannot be read back from the device on most hardware. Just get rid of
it and let attiny keep its implementation (which does work).

Signed-off-by: Keith Packard <keithp@keithp.com>
src/attiny/ao_arch_funcs.h
src/drivers/ao_led.c
src/drivers/ao_rn4678.c
src/kernel/ao_led.h
src/lpc/ao_led_lpc.c
src/stm/ao_led_stm.c
src/stmf0/ao_led_stmf0.c

index 69b259d9419c34b6c8c24951605f03a8a82dc070..e51f456b5965594aa4f075257109d8d292bcef79 100644 (file)
@@ -121,3 +121,5 @@ extern void ao_report_altitude(void);
 
 void ao_delay_us(uint16_t us);
 
+void
+ao_led_toggle(uint8_t colors);
index 899bee74915e0be87330b4892bb62cd15a5dfc31..b32034e7d3f2f0903a03751e7c8210ffc17462ef 100644 (file)
@@ -147,15 +147,6 @@ ao_led_set(AO_LED_TYPE colors)
                ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, (colors >> i) & 1);
 }
 
-void
-ao_led_toggle(AO_LED_TYPE colors)
-{
-       AO_LED_TYPE i;
-       for (i = 0; i < N_LED; i++)
-               if (colors & (1 << i))
-                       ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, ~ao_gpio_get(ao_leds[i].port, ao_leds[i].pin));
-}
-
 void
 ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks) 
 {
index 4d13decc46ec271bb9fff384ad937c6db8b79bd6..3983dc941598ff6e584d1e53e8b688323e7a7dd5 100644 (file)
@@ -350,11 +350,10 @@ ao_bt_panic(int where)
 {
        int i;
        for (;;) {
-               for (i = 0; i < 50; i++) {
-                       ao_led_toggle(AO_BT_LED);
+               for (i = 0; i < 25; i++) {
+                       ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(10));
                        ao_delay(AO_MS_TO_TICKS(10));
                }
-               ao_led_off(AO_BT_LED);
                ao_delay(AO_MS_TO_TICKS(500));
                for (i = 0; i < where; i++) {
                        ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(200));
@@ -548,7 +547,10 @@ 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);
-               ao_led_toggle(AO_BT_LED);
+               if (v)
+                       ao_led_on(AO_BT_LED);
+               else
+                       ao_led_off(AO_BT_LED);
        }
 
        /* And let P3_1 float again */
index b770381f7efb8aea3dcb379a5cb0981800788328..60c2d41fd10e05dbce1a7f405c020b79c76a1d91 100644 (file)
@@ -45,10 +45,6 @@ ao_led_set(AO_LED_TYPE colors);
 void
 ao_led_set_mask(AO_LED_TYPE colors, AO_LED_TYPE mask);
 
-/* Toggle the specified LEDs */
-void
-ao_led_toggle(AO_LED_TYPE colors);
-
 /* Turn on the specified LEDs for the indicated interval */
 void
 ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks);
index 46bf0495988dfa82446ab7a49cb8b43cd4cdbc15..3747df973f2ec74f1f7f289dc2b82c1028304c01 100644 (file)
@@ -42,12 +42,6 @@ ao_led_set(AO_PORT_TYPE colors)
        ao_led_on(on);
 }
 
-void
-ao_led_toggle(AO_PORT_TYPE colors)
-{
-       lpc_gpio.pin[LED_PORT] ^= colors;
-}
-
 void
 ao_led_for(AO_PORT_TYPE colors, AO_TICK_TYPE ticks) 
 {
index ed4ec1610de3dde8e645725d851231a4b1051671..7f40eaca301ceaafbcf0ddf410464cb82337ac7c 100644 (file)
@@ -68,24 +68,6 @@ ao_led_set(AO_LED_TYPE colors)
        ao_led_on(on);
 }
 
-void
-ao_led_toggle(AO_LED_TYPE colors)
-{
-#ifdef LED_PORT
-       LED_PORT->odr ^= (colors & LEDS_AVAILABLE);
-#else
-#ifdef LED_PORT_0
-       LED_PORT_0->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
-#endif
-#ifdef LED_PORT_1
-       LED_PORT_1->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#ifdef LED_PORT_2
-       LED_PORT_2->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_2_MASK) << LED_PORT_2_SHIFT;
-#endif
-#endif
-}
-
 void
 ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks) 
 {
index 1564535e8ec0a61c6c5df27f5347186d7d2d36c0..63593aff039c6153da468cc4bc154451621fc581 100644 (file)
@@ -58,21 +58,6 @@ ao_led_set(AO_LED_TYPE colors)
        ao_led_on(on);
 }
 
-void
-ao_led_toggle(AO_LED_TYPE colors)
-{
-#ifdef LED_PORT
-       LED_PORT->odr ^= (colors & LEDS_AVAILABLE);
-#else
-#ifdef LED_PORT_0
-       LED_PORT_0->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
-#endif
-#ifdef LED_PORT_1
-       LED_PORT_1->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#endif
-}
-
 void
 ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks) 
 {