#define AO_PORT_TYPE uint8_t
+#define AO_LED_TYPE uint8_t
+
/* Various definitions to make GCC look more like SDCC */
#define ao_arch_naked_declare __attribute__((naked))
+++ /dev/null
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include "ao.h"
-
-uint8_t ao_led_enable;
-
-#define LED_PORT PORTB
-#define LED_DDR DDRB
-
-void
-ao_led_on(uint8_t colors)
-{
- LED_PORT |= (colors & ao_led_enable);
-}
-
-void
-ao_led_off(uint8_t colors)
-{
- LED_PORT &= ~(colors & ao_led_enable);
-}
-
-void
-ao_led_set(uint8_t colors)
-{
- LED_PORT = (LED_PORT & ~(ao_led_enable)) | (colors & ao_led_enable);
-}
-
-void
-ao_led_toggle(uint8_t colors)
-{
- LED_PORT ^= (colors & ao_led_enable);
-}
-
-void
-ao_led_for(uint8_t colors, uint16_t ticks)
-{
- ao_led_on(colors);
- ao_delay(ticks);
- ao_led_off(colors);
-}
-
-void
-ao_led_init(uint8_t enable)
-{
- ao_led_enable = enable;
- LED_PORT &= ~enable;
- LED_DDR |= enable;
-}
--- /dev/null
+/*
+ * Copyright © 2009 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+
+#define LED_PORT PORTB
+#define LED_DDR DDRB
+
+void
+ao_led_on(uint8_t colors)
+{
+ LED_PORT |= colors;
+}
+
+void
+ao_led_off(uint8_t colors)
+{
+ LED_PORT &= ~colors;
+}
+
+void
+ao_led_set(uint8_t colors)
+{
+ LED_PORT = (LED_PORT & ~LEDS_AVAILABLE) | (colors & LEDS_AVAILABLE);
+}
+
+void
+ao_led_toggle(uint8_t colors)
+{
+ LED_PORT ^= (colors & LEDS_AVAILABLE);
+}
+
+void
+ao_led_for(uint8_t colors, AO_TICK_TYPE ticks)
+{
+ ao_led_on(colors);
+ ao_delay(ticks);
+ ao_led_off(colors);
+}
+
+void
+ao_led_init(void)
+{
+ LED_PORT &= ~LEDS_AVAILABLE;
+ LED_DDR |= LEDS_AVAILABLE;
+}
ao_stdio.c \
ao_task.c \
ao_timer.c \
- ao_led.c \
+ ao_led_avr.c \
ao_usb_avr.c \
ao_lcd.c
+++ /dev/null
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include "ao.h"
-
-uint8_t ao_led_enable;
-
-#define LED_PORT PORTB
-#define LED_DDR DDRB
-
-void
-ao_led_on(uint8_t colors)
-{
- LED_PORT |= (colors & ao_led_enable);
-}
-
-void
-ao_led_off(uint8_t colors)
-{
- LED_PORT &= ~(colors & ao_led_enable);
-}
-
-void
-ao_led_set(uint8_t colors)
-{
- LED_PORT = (LED_PORT & ~(ao_led_enable)) | (colors & ao_led_enable);
-}
-
-void
-ao_led_toggle(uint8_t colors)
-{
- LED_PORT ^= (colors & ao_led_enable);
-}
-
-void
-ao_led_for(uint8_t colors, uint16_t ticks)
-{
- ao_led_on(colors);
- ao_delay(ticks);
- ao_led_off(colors);
-}
-
-void
-ao_led_init(uint8_t enable)
-{
- ao_led_enable = enable;
- if ((LED_DDR & enable)) {
- printf ("oops! restarted\n");
- ao_panic(AO_PANIC_REBOOT);
- }
- LED_PORT &= ~enable;
- LED_DDR |= enable;
-}
--- /dev/null
+/*
+ * Copyright © 2009 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+
+uint8_t ao_led_enable;
+
+#define LED_PORT PORTB
+#define LED_DDR DDRB
+
+void
+ao_led_on(uint8_t colors)
+{
+ LED_PORT |= (colors & ao_led_enable);
+}
+
+void
+ao_led_off(uint8_t colors)
+{
+ LED_PORT &= ~(colors & ao_led_enable);
+}
+
+void
+ao_led_set(uint8_t colors)
+{
+ LED_PORT = (LED_PORT & ~(ao_led_enable)) | (colors & ao_led_enable);
+}
+
+void
+ao_led_toggle(uint8_t colors)
+{
+ LED_PORT ^= (colors & ao_led_enable);
+}
+
+void
+ao_led_for(uint8_t colors, uint16_t ticks)
+{
+ ao_led_on(colors);
+ ao_delay(ticks);
+ ao_led_off(colors);
+}
+
+void
+ao_led_init(uint8_t enable)
+{
+ ao_led_enable = enable;
+ if ((LED_DDR & enable)) {
+ printf ("oops! restarted\n");
+ ao_panic(AO_PANIC_REBOOT);
+ }
+ LED_PORT &= ~enable;
+ LED_DDR |= enable;
+}
ao_adc_fast.c \
ao_crc_stm.c \
ao_stdio.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_romconfig.c \
ao_boot_chain.c \
ao_usb_stm.c \
ao_adc_fast.c \
ao_crc_stm.c \
ao_stdio.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_romconfig.c \
ao_boot_chain.c \
ao_usb_stm.c \
void main(void)
{
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_clock_init();
ao_task_init();
ao_timer_init();
ao_spi_stm.c \
ao_exti_stm.c \
ao_stdio.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_log.c \
ao_log_mini.c \
ao_sample.c \
--- /dev/null
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+
+static const struct {
+ struct stm_gpio *port;
+ uint16_t pin;
+} ao_leds[] = {
+#ifdef LED_0_PORT
+ [0] { LED_0_PORT, LED_0_PIN },
+#endif
+#ifdef LED_1_PORT
+ [1] { LED_1_PORT, LED_1_PIN },
+#endif
+#ifdef LED_2_PORT
+ [2] { LED_2_PORT, LED_2_PIN },
+#endif
+#ifdef LED_3_PORT
+ [3] { LED_3_PORT, LED_3_PIN },
+#endif
+#ifdef LED_4_PORT
+ [4] { LED_4_PORT, LED_4_PIN },
+#endif
+#ifdef LED_5_PORT
+ [5] { LED_5_PORT, LED_5_PIN },
+#endif
+#ifdef LED_6_PORT
+ [6] { LED_6_PORT, LED_6_PIN },
+#endif
+#ifdef LED_7_PORT
+ [7] { LED_7_PORT, LED_7_PIN },
+#endif
+#ifdef LED_8_PORT
+ [8] { LED_8_PORT, LED_8_PIN },
+#endif
+#ifdef LED_9_PORT
+ [9] { LED_9_PORT, LED_9_PIN },
+#endif
+#ifdef LED_10_PORT
+ [10] { LED_10_PORT, LED_10_PIN },
+#endif
+#ifdef LED_11_PORT
+ [11] { LED_11_PORT, LED_11_PIN },
+#endif
+#ifdef LED_12_PORT
+ [12] { LED_12_PORT, LED_12_PIN },
+#endif
+#ifdef LED_13_PORT
+ [13] { LED_13_PORT, LED_13_PIN },
+#endif
+#ifdef LED_14_PORT
+ [14] { LED_14_PORT, LED_14_PIN },
+#endif
+#ifdef LED_15_PORT
+ [15] { LED_15_PORT, LED_15_PIN },
+#endif
+#ifdef LED_16_PORT
+ [16] { LED_16_PORT, LED_16_PIN },
+#endif
+#ifdef LED_17_PORT
+ [17] { LED_17_PORT, LED_17_PIN },
+#endif
+#ifdef LED_18_PORT
+ [18] { LED_18_PORT, LED_18_PIN },
+#endif
+#ifdef LED_19_PORT
+ [19] { LED_19_PORT, LED_19_PIN },
+#endif
+#ifdef LED_20_PORT
+ [20] { LED_20_PORT, LED_20_PIN },
+#endif
+#ifdef LED_21_PORT
+ [21] { LED_21_PORT, LED_21_PIN },
+#endif
+#ifdef LED_22_PORT
+ [22] { LED_22_PORT, LED_22_PIN },
+#endif
+#ifdef LED_23_PORT
+ [23] { LED_23_PORT, LED_23_PIN },
+#endif
+#ifdef LED_24_PORT
+ [24] { LED_24_PORT, LED_24_PIN },
+#endif
+#ifdef LED_25_PORT
+ [25] { LED_25_PORT, LED_25_PIN },
+#endif
+#ifdef LED_26_PORT
+ [26] { LED_26_PORT, LED_26_PIN },
+#endif
+#ifdef LED_27_PORT
+ [27] { LED_27_PORT, LED_27_PIN },
+#endif
+#ifdef LED_28_PORT
+ [28] { LED_28_PORT, LED_28_PIN },
+#endif
+#ifdef LED_29_PORT
+ [29] { LED_29_PORT, LED_29_PIN },
+#endif
+#ifdef LED_30_PORT
+ [30] { LED_30_PORT, LED_30_PIN },
+#endif
+#ifdef LED_31_PORT
+ [31] { LED_31_PORT, LED_31_PIN },
+#endif
+};
+#define N_LED (sizeof (ao_leds)/sizeof(ao_leds[0]))
+
+void
+ao_led_on(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, 1);
+}
+
+void
+ao_led_off(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, 0);
+}
+
+void
+ao_led_set(AO_LED_TYPE colors)
+{
+ AO_LED_TYPE i;
+ for (i = 0; i < N_LED; i++)
+ 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)
+{
+ ao_led_on(colors);
+ ao_delay(ticks);
+ ao_led_off(colors);
+}
+
+void
+ao_led_init(void)
+{
+ AO_LED_TYPE bit;
+
+ for (bit = 0; bit < N_LED; bit++)
+ ao_enable_output(ao_leds[bit].port, ao_leds[bit].pin, 0);
+}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
#endif
ao_task_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_romconfig.c \
ao_cmd.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
#endif
ao_task_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(AO_LED_RED|AO_LED_GREEN|AO_LED_RED_2|AO_LED_GREEN_2);
ao_timer_init();
#include <ao_beep.h>
#endif
-#if LEDS_AVAILABLE
+#if LEDS_AVAILABLE || HAS_LED
#include <ao_led.h>
#endif
#define AO_LED_NONE 0
#ifndef AO_LED_TYPE
-#define AO_LED_TYPE uint8_t
+#define AO_LED_TYPE uint32_t
#endif
/* Turn on the specified LEDs */
/* Initialize the LEDs */
void
-ao_led_init(AO_LED_TYPE enable);
+ao_led_init(void);
+
+#ifdef LED_0_PORT
+#define AO_LED_0 (1 << 0)
+#else
+#define AO_LED_0 0
+#endif
+#ifdef LED_1_PORT
+#define AO_LED_1 (1 << 1)
+#else
+#define AO_LED_1 0
+#endif
+#ifdef LED_2_PORT
+#define AO_LED_2 (1 << 2)
+#else
+#define AO_LED_2 0
+#endif
+#ifdef LED_3_PORT
+#define AO_LED_3 (1 << 3)
+#else
+#define AO_LED_3 0
+#endif
+#ifdef LED_4_PORT
+#define AO_LED_4 (1 << 4)
+#else
+#define AO_LED_4 0
+#endif
+#ifdef LED_5_PORT
+#define AO_LED_5 (1 << 5)
+#else
+#define AO_LED_5 0
+#endif
+#ifdef LED_6_PORT
+#define AO_LED_6 (1 << 6)
+#else
+#define AO_LED_6 0
+#endif
+#ifdef LED_7_PORT
+#define AO_LED_7 (1 << 7)
+#else
+#define AO_LED_7 0
+#endif
+#ifdef LED_8_PORT
+#define AO_LED_8 (1 << 8)
+#else
+#define AO_LED_8 0
+#endif
+#ifdef LED_9_PORT
+#define AO_LED_9 (1 << 9)
+#else
+#define AO_LED_9 0
+#endif
+#ifdef LED_10_PORT
+#define AO_LED_10 (1 << 10)
+#else
+#define AO_LED_10 0
+#endif
+#ifdef LED_11_PORT
+#define AO_LED_11 (1 << 11)
+#else
+#define AO_LED_11 0
+#endif
+#ifdef LED_12_PORT
+#define AO_LED_12 (1 << 12)
+#else
+#define AO_LED_12 0
+#endif
+#ifdef LED_13_PORT
+#define AO_LED_13 (1 << 13)
+#else
+#define AO_LED_13 0
+#endif
+#ifdef LED_14_PORT
+#define AO_LED_14 (1 << 14)
+#else
+#define AO_LED_14 0
+#endif
+#ifdef LED_15_PORT
+#define AO_LED_15 (1 << 15)
+#else
+#define AO_LED_15 0
+#endif
+#ifdef LED_16_PORT
+#define AO_LED_16 (1 << 16)
+#else
+#define AO_LED_16 0
+#endif
+#ifdef LED_17_PORT
+#define AO_LED_17 (1 << 17)
+#else
+#define AO_LED_17 0
+#endif
+#ifdef LED_18_PORT
+#define AO_LED_18 (1 << 18)
+#else
+#define AO_LED_18 0
+#endif
+#ifdef LED_19_PORT
+#define AO_LED_19 (1 << 19)
+#else
+#define AO_LED_19 0
+#endif
+#ifdef LED_20_PORT
+#define AO_LED_20 (1 << 20)
+#else
+#define AO_LED_20 0
+#endif
+#ifdef LED_21_PORT
+#define AO_LED_21 (1 << 21)
+#else
+#define AO_LED_21 0
+#endif
+#ifdef LED_22_PORT
+#define AO_LED_22 (1 << 22)
+#else
+#define AO_LED_22 0
+#endif
+#ifdef LED_23_PORT
+#define AO_LED_23 (1 << 23)
+#else
+#define AO_LED_23 0
+#endif
+#ifdef LED_24_PORT
+#define AO_LED_24 (1 << 24)
+#else
+#define AO_LED_24 0
+#endif
+#ifdef LED_25_PORT
+#define AO_LED_25 (1 << 25)
+#else
+#define AO_LED_25 0
+#endif
+#ifdef LED_26_PORT
+#define AO_LED_26 (1 << 26)
+#else
+#define AO_LED_26 0
+#endif
+#ifdef LED_27_PORT
+#define AO_LED_27 (1 << 27)
+#else
+#define AO_LED_27 0
+#endif
+#ifdef LED_28_PORT
+#define AO_LED_28 (1 << 28)
+#else
+#define AO_LED_28 0
+#endif
+#ifdef LED_29_PORT
+#define AO_LED_29 (1 << 29)
+#else
+#define AO_LED_29 0
+#endif
+#ifdef LED_30_PORT
+#define AO_LED_30 (1 << 30)
+#else
+#define AO_LED_30 0
+#endif
+#ifdef LED_31_PORT
+#define AO_LED_31 (1 << 31)
+#else
+#define AO_LED_31 0
+#endif
+
+#define AO_LEDS_AVAILABLE (AO_LED_0 | \
+ AO_LED_1 | \
+ AO_LED_2 | \
+ AO_LED_3 | \
+ AO_LED_4 | \
+ AO_LED_5 | \
+ AO_LED_6 | \
+ AO_LED_7 | \
+ AO_LED_8 | \
+ AO_LED_9 | \
+ AO_LED_10 | \
+ AO_LED_11 | \
+ AO_LED_12 | \
+ AO_LED_13 | \
+ AO_LED_14 | \
+ AO_LED_15 | \
+ AO_LED_16 | \
+ AO_LED_17 | \
+ AO_LED_18 | \
+ AO_LED_19 | \
+ AO_LED_20 | \
+ AO_LED_21 | \
+ AO_LED_22 | \
+ AO_LED_23 | \
+ AO_LED_24 | \
+ AO_LED_25 | \
+ AO_LED_26 | \
+ AO_LED_27 | \
+ AO_LED_28 | \
+ AO_LED_29 | \
+ AO_LED_30 | \
+ AO_LED_31)
+
+#ifndef LEDS_AVAILABLE
+#define LEDS_AVAILABLE AO_LEDS_AVAILABLE
+#endif
#endif /* _AO_LED_H_ */
ao_arch_start_scheduler();
#endif
ao_yield();
+ __builtin_unreachable();
}
/* Start the scheduler. This will not return */
void
-ao_start_scheduler(void);
+ao_start_scheduler(void) __attribute__((noreturn));
#if HAS_TASK_QUEUE
void
ao_interrupt.c \
ao_product.c \
ao_cmd.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_notask.c \
ao_stdio.c \
ao_panic.c \
void
ao_led_set(AO_PORT_TYPE colors)
{
- AO_PORT_TYPE on = colors & ao_led_enable;
- AO_PORT_TYPE off = ~colors & ao_led_enable;
+ AO_PORT_TYPE on = colors & LEDS_AVAILABLE;
+ AO_PORT_TYPE off = ~colors & LEDS_AVAILABLE;
ao_led_off(off);
ao_led_on(on);
}
void
-ao_led_init(AO_PORT_TYPE enable)
+ao_led_init(void)
{
- ao_led_enable = enable;
ao_enable_port(LED_PORT);
if (LED_PORT == 0) {
- if (enable & (1 << 11))
+ if (LEDS_AVAILABLE & (1 << 11))
lpc_ioconf.pio0_11 = LPC_IOCONF_FUNC_PIO0_11 | (1 << LPC_IOCONF_ADMODE);
- if (enable & (1 << 12))
+ if (LEDS_AVAILABLE & (1 << 12))
lpc_ioconf.pio0_12 = LPC_IOCONF_FUNC_PIO0_12 | (1 << LPC_IOCONF_ADMODE);
- if (enable & (1 << 14))
+ if (LEDS_AVAILABLE & (1 << 14))
lpc_ioconf.pio0_14 = LPC_IOCONF_FUNC_PIO0_14 | (1 << LPC_IOCONF_ADMODE);
}
- lpc_gpio.dir[LED_PORT] |= enable;
- ao_led_off(enable);
+ lpc_gpio.dir[LED_PORT] |= LEDS_AVAILABLE;
+ ao_led_off(LEDS_AVAILABLE);
}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ALTOS_SRC = \
ao_micropeak.c \
ao_spi_attiny.c \
- ao_led.c \
+ ao_led_tiny.c \
ao_clock.c \
ao_ms5607.c \
ao_exti.c \
ao_micropeak.c \
ao_spi_stm.c \
ao_dma_stm.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_timer.c \
ao_ms5607.c \
ao_exti_stm.c \
else
ao_hsi_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_task_init();
ao_timer_init();
ao_serial_init();
ALTOS_SRC = \
ao_micropeak.c \
ao_spi_attiny.c \
- ao_led.c \
+ ao_led_tiny.c \
ao_clock.c \
ao_ms5607.c \
ao_exti.c \
ALTOS_SRC = \
ao_micropeak.c \
ao_spi_attiny.c \
- ao_led.c \
+ ao_led_tiny.c \
ao_clock.c \
ao_ms5607.c \
ao_exti.c \
ALTOS_SRC = \
ao_micropeak.c \
ao_spi_attiny.c \
- ao_led.c \
+ ao_led_tiny.c \
ao_clock.c \
ao_ms5607.c \
ao_exti.c \
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_beep_stm.c \
ao_dma_stm.c \
ao_stdio.c \
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_dma_stm.c \
ao_stdio.c \
ao_mutex.c \
int
main(void)
{
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_timer_init();
/* Init external hardware */
ao_romconfig.c \
ao_cmd.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_romconfig.c \
ao_cmd.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio_newlib.c \
ao_panic.c \
ao_timer.c \
ao_romconfig.c \
ao_cmd.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
+++ /dev/null
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include "ao.h"
-
-#if LED_PER_LED
-static const struct {
- struct stm_gpio *port;
- uint16_t pin;
-} ao_leds[] = {
-#ifdef LED_0_PORT
- [0] { LED_0_PORT, LED_0_PIN },
-#endif
-#ifdef LED_1_PORT
- [1] { LED_1_PORT, LED_1_PIN },
-#endif
-#ifdef LED_2_PORT
- [2] { LED_2_PORT, LED_2_PIN },
-#endif
-#ifdef LED_3_PORT
- [3] { LED_3_PORT, LED_3_PIN },
-#endif
-#ifdef LED_4_PORT
- [4] { LED_4_PORT, LED_4_PIN },
-#endif
-#ifdef LED_5_PORT
- [5] { LED_5_PORT, LED_5_PIN },
-#endif
-#ifdef LED_6_PORT
- [6] { LED_6_PORT, LED_6_PIN },
-#endif
-#ifdef LED_7_PORT
- [7] { LED_7_PORT, LED_7_PIN },
-#endif
-#ifdef LED_8_PORT
- [8] { LED_8_PORT, LED_8_PIN },
-#endif
-#ifdef LED_9_PORT
- [9] { LED_9_PORT, LED_9_PIN },
-#endif
-#ifdef LED_10_PORT
- [10] { LED_10_PORT, LED_10_PIN },
-#endif
-#ifdef LED_11_PORT
- [11] { LED_11_PORT, LED_11_PIN },
-#endif
-#ifdef LED_12_PORT
- [12] { LED_12_PORT, LED_12_PIN },
-#endif
-#ifdef LED_13_PORT
- [13] { LED_13_PORT, LED_13_PIN },
-#endif
-#ifdef LED_14_PORT
- [14] { LED_14_PORT, LED_14_PIN },
-#endif
-#ifdef LED_15_PORT
- [15] { LED_15_PORT, LED_15_PIN },
-#endif
-};
-#define N_LED (sizeof (ao_leds)/sizeof(ao_leds[0]))
-#endif
-static AO_LED_TYPE ao_led_enable;
-
-void
-ao_led_on(AO_LED_TYPE colors)
-{
-#ifdef LED_PER_LED
- 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, 1);
-#else
-#ifdef LED_PORT
- LED_PORT->bsrr = (colors & ao_led_enable);
-#else
-#ifdef LED_PORT_0
- LED_PORT_0->bsrr = ((colors & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
-#endif
-#ifdef LED_PORT_1
- LED_PORT_1->bsrr = ((colors & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#endif
-#endif
-}
-
-void
-ao_led_off(AO_LED_TYPE colors)
-{
-#ifdef LED_PER_LED
- 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, 0);
-#else
-#ifdef LED_PORT
- LED_PORT->bsrr = (uint32_t) (colors & ao_led_enable) << 16;
-#else
-#ifdef LED_PORT_0
- LED_PORT_0->bsrr = ((uint32_t) (colors & ao_led_enable) & LED_PORT_0_MASK) << (LED_PORT_0_SHIFT + 16);
-#endif
-#ifdef LED_PORT_1
- LED_PORT_1->bsrr = ((uint32_t) (colors & ao_led_enable) & LED_PORT_1_MASK) << (LED_PORT_1_SHIFT + 16);
-#endif
-#endif
-#endif
-}
-
-void
-ao_led_set(AO_LED_TYPE colors)
-{
- AO_LED_TYPE on = colors & ao_led_enable;
- AO_LED_TYPE off = ~colors & ao_led_enable;
-
- ao_led_off(off);
- ao_led_on(on);
-}
-
-void
-ao_led_toggle(AO_LED_TYPE colors)
-{
-#ifdef LED_PER_LED
- 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));
-#else
-#ifdef LED_PORT
- LED_PORT->odr ^= (colors & ao_led_enable);
-#else
-#ifdef LED_PORT_0
- LED_PORT_0->odr ^= ((colors & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
-#endif
-#ifdef LED_PORT_1
- LED_PORT_1->odr ^= ((colors & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#endif
-#endif
-}
-
-void
-ao_led_for(AO_LED_TYPE colors, AO_LED_TYPE ticks)
-{
- ao_led_on(colors);
- ao_delay(ticks);
- ao_led_off(colors);
-}
-
-#define init_led_pin(port, bit) do { \
- stm_moder_set(port, bit, STM_MODER_OUTPUT); \
- stm_otyper_set(port, bit, STM_OTYPER_PUSH_PULL); \
- } while (0)
-
-void
-ao_led_init(AO_LED_TYPE enable)
-{
- AO_LED_TYPE bit;
-
- ao_led_enable = enable;
-#if LED_PER_LED
- for (bit = 0; bit < N_LED; bit++)
- ao_enable_output(ao_leds[bit].port, ao_leds[bit].pin, 0);
-#else
-#ifdef LED_PORT
- stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE);
- LED_PORT->odr &= ~enable;
-#else
-#ifdef LED_PORT_0
- stm_rcc.ahbenr |= (1 << LED_PORT_0_ENABLE);
- LED_PORT_0->odr &= ~((enable & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
-#endif
-#ifdef LED_PORT_1
- stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE);
- LED_PORT_1->odr &= ~((enable & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#ifdef LED_PORT_2
- stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE);
- LED_PORT_1->odr &= ~((enable & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#endif
- for (bit = 0; bit < 16; bit++) {
- if (enable & (1 << bit)) {
-#ifdef LED_PORT
- init_led_pin(LED_PORT, bit);
-#else
-#ifdef LED_PORT_0
- if (LED_PORT_0_MASK & (1 << bit))
- init_led_pin(LED_PORT_0, bit + LED_PORT_0_SHIFT);
-#endif
-#ifdef LED_PORT_1
- if (LED_PORT_1_MASK & (1 << bit))
- init_led_pin(LED_PORT_1, bit + LED_PORT_1_SHIFT);
-#endif
-#ifdef LED_PORT_2
- if (LED_PORT_2_MASK & (1 << bit))
- init_led_pin(LED_PORT_2, bit + LED_PORT_2_SHIFT);
-#endif
-#endif
- }
- }
-#endif
-}
--- /dev/null
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+
+#if LED_PER_LED
+#error LED_PER_LED support is in ao_led.c now
+#endif
+
+void
+ao_led_on(AO_LED_TYPE colors)
+{
+#ifdef LED_PORT
+ LED_PORT->bsrr = (colors & LEDS_AVAILABLE);
+#else
+#ifdef LED_PORT_0
+ LED_PORT_0->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
+#endif
+#ifdef LED_PORT_1
+ LED_PORT_1->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
+#endif
+#ifdef LED_PORT_2
+ LED_PORT_2->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_2_MASK) << LED_PORT_2_SHIFT;
+#endif
+#endif
+}
+
+void
+ao_led_off(AO_LED_TYPE colors)
+{
+#ifdef LED_PORT
+ LED_PORT->bsrr = (uint32_t) (colors & LEDS_AVAILABLE) << 16;
+#else
+#ifdef LED_PORT_0
+ LED_PORT_0->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << (LED_PORT_0_SHIFT + 16);
+#endif
+#ifdef LED_PORT_1
+ LED_PORT_1->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << (LED_PORT_1_SHIFT + 16);
+#endif
+#ifdef LED_PORT_2
+ LED_PORT_2->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_2_MASK) << (LED_PORT_2_SHIFT + 16);
+#endif
+#endif
+}
+
+void
+ao_led_set(AO_LED_TYPE colors)
+{
+ AO_LED_TYPE on = colors & LEDS_AVAILABLE;
+ AO_LED_TYPE off = ~colors & LEDS_AVAILABLE;
+
+ ao_led_off(off);
+ 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_LED_TYPE ticks)
+{
+ ao_led_on(colors);
+ ao_delay(ticks);
+ ao_led_off(colors);
+}
+
+#define init_led_pin(port, bit) do { \
+ stm_moder_set(port, bit, STM_MODER_OUTPUT); \
+ stm_otyper_set(port, bit, STM_OTYPER_PUSH_PULL); \
+ } while (0)
+
+void
+ao_led_init(void)
+{
+ AO_LED_TYPE bit;
+
+#ifdef LED_PORT
+ stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE);
+ LED_PORT->odr &= ~LEDS_AVAILABLE;
+#else
+#ifdef LED_PORT_0
+ stm_rcc.ahbenr |= (1 << LED_PORT_0_ENABLE);
+ LED_PORT_0->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
+#endif
+#ifdef LED_PORT_1
+ stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE);
+ LED_PORT_1->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
+#endif
+#ifdef LED_PORT_2
+ stm_rcc.ahbenr |= (1 << LED_PORT_2_ENABLE);
+ LED_PORT_2->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_2_MASK) << LED_PORT_2_SHIFT;
+#endif
+#endif
+ for (bit = 0; bit < sizeof (AO_LED_TYPE) * 8; bit++) {
+ if (LEDS_AVAILABLE & (1 << bit)) {
+#ifdef LED_PORT
+ init_led_pin(LED_PORT, bit);
+#else
+#ifdef LED_PORT_0
+ if (LED_PORT_0_MASK & (1 << bit))
+ init_led_pin(LED_PORT_0, bit + LED_PORT_0_SHIFT);
+#endif
+#ifdef LED_PORT_1
+ if (LED_PORT_1_MASK & (1 << bit))
+ init_led_pin(LED_PORT_1, bit + LED_PORT_1_SHIFT);
+#endif
+#ifdef LED_PORT_2
+ if (LED_PORT_2_MASK & (1 << bit))
+ init_led_pin(LED_PORT_2, bit + LED_PORT_2_SHIFT);
+#endif
+#endif
+ }
+ }
+}
ALTOS_SRC = \
ao_interrupt.c \
ao_panic.c \
- ao_timer.c
+ ao_timer.c \
+ ao_led.c \
+ ao_task.c \
+ ao_stdio.c
CFLAGS = $(STM32F4_CFLAGS)
#include <ao.h>
-void main(void)
+static struct ao_task red_task;
+static struct ao_task green_task;
+
+static void
+red(void)
{
- float x;
- int r = 1;
- int g = 0;
+ for (;;) {
+ ao_led_toggle(LED_RED);
+ ao_delay(AO_MS_TO_TICKS(500));
+ }
+}
- ao_clock_init();
+static void
+green(void)
+{
+ for (;;) {
+ ao_led_toggle(LED_GREEN);
+ ao_delay(AO_MS_TO_TICKS(450));
+ }
+}
+void main(void)
+{
+ ao_clock_init();
ao_timer_init();
+ ao_led_init();
+ ao_task_init();
- ao_enable_output(LED_GREEN_PORT, LED_GREEN_PIN, 0);
- ao_enable_output(LED_RED_PORT, LED_RED_PIN, 1);
- for (;;) {
- ao_gpio_set(LED_GREEN_PORT, LED_GREEN_PIN, g);
- ao_gpio_set(LED_RED_PORT, LED_RED_PIN, r);
- g ^= 1;
- r ^= 1;
- for (x = 0.0f; x < 100000.0f; x = x + 0.1f)
- ao_arch_nop();
- }
+ ao_add_task(&red_task, red, "red");
+ ao_add_task(&green_task, green, "green");
+ ao_start_scheduler();
}
#ifndef _AO_PINS_H_
#define _AO_PINS_H_
-#define HAS_BEEP 0
-
-#define B_USER_PORT (&stm_gpioa)
-#define B_USER_PIN 0
-
-#define LED_GREEN_PORT (&stm_gpioc)
-#define LED_GREEN_PIN 5
-#define LED_RED_PORT (&stm_gpioe)
-#define LED_RED_PIN 3
-
+/* Clock tree configuration */
#define AO_HSE 8000000 /* fed from st/link processor */
#define AO_HSE_BYPASS 1 /* no xtal, directly fed */
#define DEBUG_THE_CLOCK 1
+#define HAS_USB 0
+#define HAS_BEEP 0
+
+#define B_USER_PORT (&stm_gpioa)
+#define B_USER_PIN 0
+
+/* LEDs */
+
+#define HAS_LED 1
+
+#define LED_0_PORT (&stm_gpioc)
+#define LED_0_PIN 5
+#define LED_GREEN (1 << 0)
+
+#define LED_1_PORT (&stm_gpioe)
+#define LED_1_PIN 3
+#define LED_RED (1 << 1)
+
#endif /* _AO_PINS_H_ */
#define ao_arch_task_members\
uint32_t *sp; /* saved stack pointer */
-#define ao_arch_block_interrupts() asm("cpsid i")
-#define ao_arch_release_interrupts() asm("cpsie i")
-
#define ao_arch_naked_declare __attribute__((naked))
#define ao_arch_naked_define
#ifndef _AO_ARCH_FUNCS_H_
#define _AO_ARCH_FUNCS_H_
+/* task functions */
+
+#define ARM_PUSH32(stack, val) (*(--(stack)) = (val))
+
+typedef uint32_t ao_arch_irq_t;
+
+static inline void
+ao_arch_block_interrupts(void) {
+#ifdef AO_NONMASK_INTERRUPTS
+ asm("msr basepri,%0" : : "r" (AO_STM_NVIC_BASEPRI_MASK));
+#else
+ asm("cpsid i");
+#endif
+}
+
+static inline void
+ao_arch_release_interrupts(void) {
+#ifdef AO_NONMASK_INTERRUPTS
+ asm("msr basepri,%0" : : "r" (0x0));
+#else
+ asm("cpsie i");
+#endif
+}
+
+static inline uint32_t
+ao_arch_irqsave(void) {
+ uint32_t val;
+#ifdef AO_NONMASK_INTERRUPTS
+ asm("mrs %0,basepri" : "=r" (val));
+#else
+ asm("mrs %0,primask" : "=r" (val));
+#endif
+ ao_arch_block_interrupts();
+ return val;
+}
+
+static inline void
+ao_arch_irqrestore(uint32_t basepri) {
+#ifdef AO_NONMASK_INTERRUPTS
+ asm("msr basepri,%0" : : "r" (basepri));
+#else
+ asm("msr primask,%0" : : "r" (basepri));
+#endif
+}
+
+static inline void
+ao_arch_memory_barrier() {
+ asm volatile("" ::: "memory");
+}
+
+static inline void
+ao_arch_irq_check(void) {
+#ifdef AO_NONMASK_INTERRUPTS
+ uint32_t basepri;
+ asm("mrs %0,basepri" : "=r" (basepri));
+ if (basepri == 0)
+ ao_panic(AO_PANIC_IRQ);
+#else
+ uint32_t primask;
+ asm("mrs %0,primask" : "=r" (primask));
+ if ((primask & 1) == 0)
+ ao_panic(AO_PANIC_IRQ);
+#endif
+}
+
+#if HAS_TASK
+static inline void
+ao_arch_init_stack(struct ao_task *task, void *start)
+{
+ uint32_t *sp = (uint32_t *) ((void*) task->stack + AO_STACK_SIZE);
+ uint32_t a = (uint32_t) start;
+ int i;
+
+ /* Return address (goes into LR) */
+ ARM_PUSH32(sp, a);
+
+ /* Clear register values r0-r12 */
+ i = 13;
+ while (i--)
+ ARM_PUSH32(sp, 0);
+
+ /* APSR */
+ ARM_PUSH32(sp, 0);
+
+ /* Clear register values s0-s31 */
+ i = 32;
+ while (i--)
+ ARM_PUSH32(sp, 0);
+
+ /* FPSCR */
+ ARM_PUSH32(sp, 0);
+
+ /* BASEPRI with interrupts enabled */
+ ARM_PUSH32(sp, 0);
+
+ task->sp = sp;
+}
+
+static inline void ao_arch_save_regs(void) {
+ /* Save general registers */
+ asm("push {r0-r12,lr}");
+
+ /* Save APSR */
+ asm("mrs r0,apsr");
+ asm("push {r0}");
+
+ /* Save FPU registers */
+ asm("vpush {s0-s15}");
+ asm("vpush {s16-s31}");
+
+ /* Save FPSCR */
+ asm("vmrs r0,fpscr");
+ asm("push {r0}");
+
+#ifdef AO_NONMASK_INTERRUPTS
+ /* Save BASEPRI */
+ asm("mrs r0,basepri");
+#else
+ /* Save PRIMASK */
+ asm("mrs r0,primask");
+#endif
+ asm("push {r0}");
+}
+
+static inline void ao_arch_save_stack(void) {
+ uint32_t *sp;
+ asm("mov %0,sp" : "=&r" (sp) );
+ ao_cur_task->sp = (sp);
+}
+
+static inline void ao_arch_restore_stack(void) {
+ /* Switch stacks */
+ asm("mov sp, %0" : : "r" (ao_cur_task->sp) );
+
+#ifdef AO_NONMASK_INTERRUPTS
+ /* Restore BASEPRI */
+ asm("pop {r0}");
+ asm("msr basepri,r0");
+#else
+ /* Restore PRIMASK */
+ asm("pop {r0}");
+ asm("msr primask,r0");
+#endif
+
+ /* Restore FPSCR */
+ asm("pop {r0}");
+ asm("vmsr fpscr,r0");
+
+ /* Restore FPU registers */
+ asm("vpop {s16-s31}");
+ asm("vpop {s0-s15}");
+
+ /* Restore APSR */
+ asm("pop {r0}");
+ asm("msr apsr_nczvq,r0");
+
+ /* Restore general registers */
+ asm("pop {r0-r12,lr}\n");
+
+ /* Return to calling function */
+ asm("bx lr");
+}
+
+#ifndef HAS_SAMPLE_PROFILE
+#define HAS_SAMPLE_PROFILE 0
+#endif
+
+#if DEBUG
+#define HAS_ARCH_VALIDATE_CUR_STACK 1
+
+static inline void
+ao_validate_cur_stack(void)
+{
+ uint8_t *psp;
+
+ asm("mrs %0,psp" : "=&r" (psp));
+ if (ao_cur_task &&
+ psp <= ao_cur_task->stack &&
+ psp >= ao_cur_task->stack - 256)
+ ao_panic(AO_PANIC_STACK);
+}
+#endif
+
+#if !HAS_SAMPLE_PROFILE
+#define HAS_ARCH_START_SCHEDULER 1
+
+static inline void ao_arch_start_scheduler(void) {
+ uint32_t sp;
+ uint32_t control;
+
+ asm("mrs %0,msp" : "=&r" (sp));
+ asm("msr psp,%0" : : "r" (sp));
+ asm("mrs %0,control" : "=r" (control));
+ control |= (1 << 1);
+ asm("msr control,%0" : : "r" (control));
+ asm("isb");
+}
+#endif
+
+#define ao_arch_isr_stack()
+
+#endif
+
+static inline void
+ao_arch_wait_interrupt(void) {
+#ifdef AO_NONMASK_INTERRUPTS
+ asm(
+ "dsb\n" /* Serialize data */
+ "isb\n" /* Serialize instructions */
+ "cpsid i\n" /* Block all interrupts */
+ "msr basepri,%0\n" /* Allow all interrupts through basepri */
+ "wfi\n" /* Wait for an interrupt */
+ "cpsie i\n" /* Allow all interrupts */
+ "msr basepri,%1\n" /* Block interrupts through basepri */
+ : : "r" (0), "r" (AO_STM_NVIC_BASEPRI_MASK));
+#else
+ asm("\twfi\n");
+ ao_arch_release_interrupts();
+ ao_arch_block_interrupts();
+#endif
+}
+
+#define ao_arch_critical(b) do { \
+ uint32_t __mask = ao_arch_irqsave(); \
+ do { b } while (0); \
+ ao_arch_irqrestore(__mask); \
+ } while (0)
+
/* GPIO functions */
#define ao_power_register(gpio)
+++ /dev/null
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include "ao.h"
-
-uint16_t ao_led_enable;
-
-void
-ao_led_on(uint16_t colors)
-{
-#ifdef LED_PORT
- LED_PORT->bsrr = (colors & ao_led_enable);
-#else
-#ifdef LED_PORT_0
- LED_PORT_0->bsrr = ((colors & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
-#endif
-#ifdef LED_PORT_1
- LED_PORT_1->bsrr = ((colors & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#endif
-}
-
-void
-ao_led_off(uint16_t colors)
-{
-#ifdef LED_PORT
- LED_PORT->bsrr = (uint32_t) (colors & ao_led_enable) << 16;
-#else
-#ifdef LED_PORT_0
- LED_PORT_0->bsrr = ((uint32_t) (colors & ao_led_enable) & LED_PORT_0_MASK) << (LED_PORT_0_SHIFT + 16);
-#endif
-#ifdef LED_PORT_1
- LED_PORT_1->bsrr = ((uint32_t) (colors & ao_led_enable) & LED_PORT_1_MASK) << (LED_PORT_1_SHIFT + 16);
-#endif
-#endif
-}
-
-void
-ao_led_set(uint16_t colors)
-{
- uint16_t on = colors & ao_led_enable;
- uint16_t off = ~colors & ao_led_enable;
-
- ao_led_off(off);
- ao_led_on(on);
-}
-
-void
-ao_led_toggle(uint16_t colors)
-{
-#ifdef LED_PORT
- LED_PORT->odr ^= (colors & ao_led_enable);
-#else
-#ifdef LED_PORT_0
- LED_PORT_0->odr ^= ((colors & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
-#endif
-#ifdef LED_PORT_1
- LED_PORT_1->odr ^= ((colors & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#endif
-}
-
-void
-ao_led_for(uint16_t colors, uint16_t ticks)
-{
- ao_led_on(colors);
- ao_delay(ticks);
- ao_led_off(colors);
-}
-
-#define init_led_pin(port, bit) do { \
- stm_moder_set(port, bit, STM_MODER_OUTPUT); \
- stm_otyper_set(port, bit, STM_OTYPER_PUSH_PULL); \
- } while (0)
-
-void
-ao_led_init(uint16_t enable)
-{
- int bit;
-
- ao_led_enable = enable;
-#ifdef LED_PORT
- stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE);
- LED_PORT->odr &= ~enable;
-#else
-#ifdef LED_PORT_0
- stm_rcc.ahbenr |= (1 << LED_PORT_0_ENABLE);
- LED_PORT_0->odr &= ~((enable & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
-#endif
-#ifdef LED_PORT_1
- stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE);
- LED_PORT_1->odr &= ~((enable & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
-#endif
-#endif
- for (bit = 0; bit < 16; bit++) {
- if (enable & (1 << bit)) {
-#ifdef LED_PORT
- init_led_pin(LED_PORT, bit);
-#else
-#ifdef LED_PORT_0
- if (LED_PORT_0_MASK & (1 << bit))
- init_led_pin(LED_PORT_0, bit + LED_PORT_0_SHIFT);
-#endif
-#ifdef LED_PORT_1
- if (LED_PORT_1_MASK & (1 << bit))
- init_led_pin(LED_PORT_1, bit + LED_PORT_1_SHIFT);
-#endif
-#endif
- }
- }
-}
--- /dev/null
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+
+void
+ao_led_on(AO_LED_TYPE colors)
+{
+#ifdef LED_PORT
+ LED_PORT->bsrr = (colors & LEDS_AVAILABLE);
+#else
+#ifdef LED_PORT_0
+ LED_PORT_0->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
+#endif
+#ifdef LED_PORT_1
+ LED_PORT_1->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
+#endif
+#endif
+}
+
+void
+ao_led_off(AO_LED_TYPE colors)
+{
+#ifdef LED_PORT
+ LED_PORT->bsrr = (uint32_t) (colors & LEDS_AVAILABLE) << 16;
+#else
+#ifdef LED_PORT_0
+ LED_PORT_0->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << (LED_PORT_0_SHIFT + 16);
+#endif
+#ifdef LED_PORT_1
+ LED_PORT_1->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << (LED_PORT_1_SHIFT + 16);
+#endif
+#endif
+}
+
+void
+ao_led_set(AO_LED_TYPE colors)
+{
+ AO_LED_TYPE on = colors & LEDS_AVAILABLE;
+ AO_LED_TYPE off = ~colors & LEDS_AVAILABLE;
+
+ ao_led_off(off);
+ 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)
+{
+ ao_led_on(colors);
+ ao_delay(ticks);
+ ao_led_off(colors);
+}
+
+#define init_led_pin(port, bit) do { \
+ stm_moder_set(port, bit, STM_MODER_OUTPUT); \
+ stm_otyper_set(port, bit, STM_OTYPER_PUSH_PULL); \
+ } while (0)
+
+void
+ao_led_init(void)
+{
+ int bit;
+
+#ifdef LED_PORT
+ stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE);
+ LED_PORT->odr &= ~LEDS_AVAILABLE;
+#else
+#ifdef LED_PORT_0
+ stm_rcc.ahbenr |= (1 << LED_PORT_0_ENABLE);
+ LED_PORT_0->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_0_MASK) << LED_PORT_0_SHIFT;
+#endif
+#ifdef LED_PORT_1
+ stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE);
+ LED_PORT_1->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_1_MASK) << LED_PORT_1_SHIFT;
+#endif
+#endif
+ for (bit = 0; bit < 16; bit++) {
+ if (LEDS_AVAILABLE & (1 << bit)) {
+#ifdef LED_PORT
+ init_led_pin(LED_PORT, bit);
+#else
+#ifdef LED_PORT_0
+ if (LED_PORT_0_MASK & (1 << bit))
+ init_led_pin(LED_PORT_0, bit + LED_PORT_0_SHIFT);
+#endif
+#ifdef LED_PORT_1
+ if (LED_PORT_1_MASK & (1 << bit))
+ init_led_pin(LED_PORT_1, bit + LED_PORT_1_SHIFT);
+#endif
+#endif
+ }
+ }
+}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_task_init();
ao_serial_init();
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_RED);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_spi_init();
#if HAS_SAMPLE_PROFILE
ao_sample_profile_init();
#endif
-
+ ao_led_off(LEDS_AVAILABLE);
+
ao_start_scheduler();
return 0;
}
ao_config.c \
ao_data.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_clock_init();
ao_task_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_config.c \
ao_data.c \
ao_task.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_clock_init();
ao_task_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
#endif
ao_task_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
#define AO_CC1200_INT_GPIO 2
#define AO_CC1200_INT_GPIO_IOCFG CC1200_IOCFG2
-#define LED_PER_LED 1
+#define HAS_LED 1
#define LED_TYPE uint16_t
/* Continuity leds 1-8 */
#define LED_7_PORT (&stm_gpioa)
#define LED_7_PIN 10
-#define LED_PIN_CONTINUITY_0 0
-#define LED_PIN_CONTINUITY_1 1
-#define LED_PIN_CONTINUITY_2 2
-#define LED_PIN_CONTINUITY_3 3
-#define LED_PIN_CONTINUITY_4 4
-#define LED_PIN_CONTINUITY_5 5
-#define LED_PIN_CONTINUITY_6 6
-#define LED_PIN_CONTINUITY_7 7
+#define AO_LED_CONTINUITY(c) (1 << (c))
+#define AO_LED_CONTINUITY_MASK (0xff)
/* ARM */
#define LED_8_PORT (&stm_gpioe)
#define LED_11_PORT (&stm_gpioe)
#define LED_11_PIN 6
-#define LED_PIN_GREEN 9
-#define LED_PIN_AMBER 10
-#define LED_PIN_RED 11
-
-#define AO_LED_CONTINUITY(c) (1 << (c))
-#define AO_LED_CONTINUITY_MASK (0xff)
-
-#define AO_LED_ARMED (1 << LED_PIN_ARMED)
-#define AO_LED_GREEN (1 << LED_PIN_GREEN)
-#define AO_LED_AMBER (1 << LED_PIN_AMBER)
-#define AO_LED_RED (1 << LED_PIN_RED)
-
-#define LEDS_AVAILABLE (0xfff)
+#define AO_LED_ARMED AO_LED_8
+#define AO_LED_GREEN AO_LED_9
+#define AO_LED_AMBER AO_LED_10
+#define AO_LED_RED AO_LED_11
/* Alarm A */
#define AO_SIREN
{
ao_clock_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_task_init();
// ao_radio_cmac_cmd_init();
+ ao_led_off(LEDS_AVAILABLE);
+
ao_start_scheduler();
}
ao_data.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_data.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
{
ao_clock_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_task_init();
// ao_radio_cmac_cmd_init();
+ ao_led_off(LEDS_AVAILABLE);
+
ao_start_scheduler();
}
ao_data.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ALTOS_SRC = \
ao_adc_stm.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_interrupt.c \
ao_boot_chain.c \
ao_product.c \
ao_cmd_init();
ao_config_init();
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_GREEN);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
/* internal systems */
ao_timer_init();
ao_telemetry_init();
ao_tracker_init();
- ao_led_off(AO_LED_GREEN);
+ ao_led_off(LEDS_AVAILABLE);
ao_start_scheduler();
- return 0;
}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_timer_init();
ao_dma_init();
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_GREEN);
-
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_spi_init();
ao_exti_init();
ao_lco_cmd_init();
// ao_radio_cmac_cmd_init();
+ ao_led_off(LEDS_AVAILABLE);
+
ao_start_scheduler();
return 0;
}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
main(void)
{
ao_clock_init();
-
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_GREEN);
+
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_task_init();
ao_timer_init();
ao_button_init();
ao_eeprom_init();
-
+
ao_radio_init();
ao_usb_init();
ao_config_init();
-
+
ao_lco_init();
ao_lco_cmd_init();
// ao_radio_cmac_cmd_init();
-
+
+ ao_led_off(LEDS_AVAILABLE);
+
ao_start_scheduler();
return 0;
}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
{
ao_clock_init();
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_GREEN);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_task_init();
ao_timer_init();
ao_lco_cmd_init();
// ao_radio_cmac_cmd_init();
+ ao_led_off(LEDS_AVAILABLE);
+
ao_start_scheduler();
return 0;
}
ao_seven_segment_set(AO_LCO_BOX_DIGIT_1, 8 | 0x10);
ao_seven_segment_set(AO_LCO_BOX_DIGIT_10, 8 | 0x10);
ao_mutex_put(&ao_lco_display_mutex);
- ao_led_on(LEDS_AVAILABLE);
+ ao_led_on(AO_LEDS_AVAILABLE);
ao_delay(AO_MS_TO_TICKS(1000));
- ao_led_off(LEDS_AVAILABLE);
+ ao_led_off(AO_LEDS_AVAILABLE);
}
static void
#define LOW_LEVEL_DEBUG 0
-#define LED_PER_LED 1
-#define LED_TYPE uint16_t
-
-#define LED_ENABLE_BITS ((1 << STM_RCC_AHBENR_GPIOAEN) | \
- (1 << STM_RCC_AHBENR_GPIOCEN) | \
- (1 << STM_RCC_AHBENR_GPIODEN) | \
- (1 << STM_RCC_AHBENR_GPIOEEN))
+#define HAS_LED 1
/* PC7 - PC9, LED 0 - 2 */
#define LED_0_PORT (&stm_gpioc)
#define LED_15_PORT (&stm_gpioa)
#define LED_15_PIN 5
-#define LED_PIN_RED 0
-#define LED_PIN_AMBER 1
-#define LED_PIN_GREEN 2
-#define LED_PIN_BOX 3
-#define LED_PIN_PAD 4
-#define LED_PIN_DRAG 5
-#define LED_PIN_CONTINUITY_7 6
-#define LED_PIN_CONTINUITY_6 7
-#define LED_PIN_CONTINUITY_5 8
-#define LED_PIN_CONTINUITY_4 9
-#define LED_PIN_CONTINUITY_3 10
-#define LED_PIN_CONTINUITY_2 11
-#define LED_PIN_CONTINUITY_1 12
-#define LED_PIN_CONTINUITY_0 13
-#define LED_PIN_REMOTE_ARM 14
-#define LED_PIN_FIRE 15
-#define AO_LED_RED (1 << LED_PIN_RED)
-#define AO_LED_AMBER (1 << LED_PIN_AMBER)
-#define AO_LED_GREEN (1 << LED_PIN_GREEN)
-#define AO_LED_BOX (1 << LED_PIN_BOX)
-#define AO_LED_PAD (1 << LED_PIN_PAD)
-#define AO_LED_DRAG (1 << LED_PIN_DRAG)
-#define AO_LED_CONTINUITY_7 (1 << LED_PIN_CONTINUITY_7)
-#define AO_LED_CONTINUITY_6 (1 << LED_PIN_CONTINUITY_6)
-#define AO_LED_CONTINUITY_5 (1 << LED_PIN_CONTINUITY_5)
-#define AO_LED_CONTINUITY_4 (1 << LED_PIN_CONTINUITY_4)
-#define AO_LED_CONTINUITY_3 (1 << LED_PIN_CONTINUITY_3)
-#define AO_LED_CONTINUITY_2 (1 << LED_PIN_CONTINUITY_2)
-#define AO_LED_CONTINUITY_1 (1 << LED_PIN_CONTINUITY_1)
-#define AO_LED_CONTINUITY_0 (1 << LED_PIN_CONTINUITY_0)
+#define AO_LED_RED AO_LED_0
+#define AO_LED_AMBER AO_LED_1
+#define AO_LED_GREEN AO_LED_2
+#define AO_LED_BOX AO_LED_3
+#define AO_LED_PAD AO_LED_4
+#define AO_LED_DRAG AO_LED_5
+#define AO_LED_CONTINUITY_7 AO_LED_6
+#define AO_LED_CONTINUITY_6 AO_LED_7
+#define AO_LED_CONTINUITY_5 AO_LED_8
+#define AO_LED_CONTINUITY_4 AO_LED_9
+#define AO_LED_CONTINUITY_3 AO_LED_10
+#define AO_LED_CONTINUITY_2 AO_LED_11
+#define AO_LED_CONTINUITY_1 AO_LED_12
+#define AO_LED_CONTINUITY_0 AO_LED_13
#define AO_LED_CONTINUITY_NUM 8
-#define AO_LED_REMOTE_ARM (1 << LED_PIN_REMOTE_ARM)
-#define AO_LED_FIRE (1 << LED_PIN_FIRE)
-
-#define LEDS_AVAILABLE (AO_LED_RED | \
- AO_LED_AMBER | \
- AO_LED_GREEN | \
- AO_LED_BOX | \
- AO_LED_PAD | \
- AO_LED_DRAG | \
- AO_LED_CONTINUITY_7 | \
- AO_LED_CONTINUITY_6 | \
- AO_LED_CONTINUITY_5 | \
- AO_LED_CONTINUITY_4 | \
- AO_LED_CONTINUITY_3 | \
- AO_LED_CONTINUITY_2 | \
- AO_LED_CONTINUITY_1 | \
- AO_LED_CONTINUITY_0 | \
- AO_LED_REMOTE_ARM | \
- AO_LED_FIRE)
+#define AO_LED_REMOTE_ARM AO_LED_14
+#define AO_LED_FIRE AO_LED_15
/* LCD displays */
{
ao_clock_init();
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_GREEN);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_task_init();
ao_timer_init();
ao_lco_cmd_init();
// ao_radio_cmac_cmd_init();
+ ao_led_off(LEDS_AVAILABLE);
+
ao_start_scheduler();
return 0;
}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
{
ao_clock_init();
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_GREEN);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_beep_init();
ao_task_init();
ao_lco_cmd_init();
// ao_radio_cmac_cmd_init();
+ ao_led_off(LEDS_AVAILABLE);
+
ao_start_scheduler();
return 0;
}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_task_init();
ao_serial_init();
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_GREEN);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_i2c_init();
ao_sample_profile_init();
#endif
+ ao_led_off(LEDS_AVAILABLE);
ao_start_scheduler();
return 0;
}
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_task_init();
ao_serial_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_task_init();
ao_serial_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_task_init();
ao_serial_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_task_init();
ao_serial_init();
- ao_led_init(LEDS_AVAILABLE);
+ ao_led_init();
ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_task_init();
ao_serial_init();
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_RED);
+ ao_led_init();
+ ao_led_on(LEDS_AVAILABLE);
ao_timer_init();
ao_spi_init();
#if HAS_SAMPLE_PROFILE
ao_sample_profile_init();
#endif
+ ao_led_off(LEDS_AVAILABLE);
ao_start_scheduler();
return 0;
ao_stdio.c \
ao_task.c \
ao_timer.c \
- ao_led.c \
+ ao_led_avr.c \
ao_avr_stdio.c \
ao_romconfig.c \
ao_usb_avr.c \
ao_stdio.c \
ao_task.c \
ao_timer.c \
- ao_led.c \
+ ao_led_avr.c \
ao_avr_stdio.c \
ao_romconfig.c \
ao_usb_avr.c \
ao_stdio.c \
ao_task.c \
ao_timer.c \
- ao_led.c \
+ ao_led_avr.c \
ao_avr_stdio.c \
ao_romconfig.c \
ao_usb_avr.c \
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_cmd.c \
ao_config.c \
ao_task.c \
- ao_led.c \
+ ao_led_stm.c \
ao_stdio.c \
ao_panic.c \
ao_timer.c \
ao_adc_fast.c \
ao_crc_stm.c \
ao_stdio.c \
- ao_led.c \
+ ao_led_stmf0.c \
ao_romconfig.c \
ao_boot_chain.c \
ao_cmd.c \