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>
void ao_delay_us(uint16_t us);
void ao_delay_us(uint16_t us);
+void
+ao_led_toggle(uint8_t colors);
ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, (colors >> i) & 1);
}
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)
{
void
ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks)
{
- 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_delay(AO_MS_TO_TICKS(10));
}
ao_delay(AO_MS_TO_TICKS(500));
for (i = 0; i < where; i++) {
ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(200));
ao_delay(AO_MS_TO_TICKS(500));
for (i = 0; i < where; i++) {
ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(200));
v = 1-v;
ao_delay(AO_MS_TO_TICKS(50));
ao_gpio_set(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, v);
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 */
}
/* And let P3_1 float again */
void
ao_led_set_mask(AO_LED_TYPE colors, AO_LED_TYPE mask);
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);
/* Turn on the specified LEDs for the indicated interval */
void
ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks);
-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)
{
void
ao_led_for(AO_PORT_TYPE colors, AO_TICK_TYPE ticks)
{
-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)
{
void
ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks)
{
-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)
{
void
ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks)
{