From: Keith Packard Date: Sat, 8 Aug 2020 01:17:07 +0000 (-0700) Subject: altos: Remove ao_led_toggle API from general code X-Git-Tag: 1.9.5~1^2~32 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=a6baf04bae3fe6a6b3da2f456419732ffeb4d056;hp=0385d7d68c51e05f5b555749ccc20e3c7c202370 altos: Remove ao_led_toggle API from general code 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 --- diff --git a/src/attiny/ao_arch_funcs.h b/src/attiny/ao_arch_funcs.h index 69b259d9..e51f456b 100644 --- a/src/attiny/ao_arch_funcs.h +++ b/src/attiny/ao_arch_funcs.h @@ -121,3 +121,5 @@ extern void ao_report_altitude(void); void ao_delay_us(uint16_t us); +void +ao_led_toggle(uint8_t colors); diff --git a/src/drivers/ao_led.c b/src/drivers/ao_led.c index 899bee74..b32034e7 100644 --- a/src/drivers/ao_led.c +++ b/src/drivers/ao_led.c @@ -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) { diff --git a/src/drivers/ao_rn4678.c b/src/drivers/ao_rn4678.c index 4d13decc..3983dc94 100644 --- a/src/drivers/ao_rn4678.c +++ b/src/drivers/ao_rn4678.c @@ -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 */ diff --git a/src/kernel/ao_led.h b/src/kernel/ao_led.h index b770381f..60c2d41f 100644 --- a/src/kernel/ao_led.h +++ b/src/kernel/ao_led.h @@ -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); diff --git a/src/lpc/ao_led_lpc.c b/src/lpc/ao_led_lpc.c index 46bf0495..3747df97 100644 --- a/src/lpc/ao_led_lpc.c +++ b/src/lpc/ao_led_lpc.c @@ -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) { diff --git a/src/stm/ao_led_stm.c b/src/stm/ao_led_stm.c index ed4ec161..7f40eaca 100644 --- a/src/stm/ao_led_stm.c +++ b/src/stm/ao_led_stm.c @@ -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) { diff --git a/src/stmf0/ao_led_stmf0.c b/src/stmf0/ao_led_stmf0.c index 1564535e..63593aff 100644 --- a/src/stmf0/ao_led_stmf0.c +++ b/src/stmf0/ao_led_stmf0.c @@ -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) {