altos: Allow timer interrupt without needing tick count
authorKeith Packard <keithp@keithp.com>
Tue, 14 Aug 2018 00:43:13 +0000 (17:43 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 15 Aug 2018 22:40:15 +0000 (15:40 -0700)
This saves a bit of space in the fox1ihu loader which uses the timer
interrupt to poke the watchdog.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/fox1ihu/flash-loader/ao_pins.h
src/stm/ao_timer.c

index 19f29b0881822151e2dc4612807e5ed6958c7c1c..c4fa69bde8191be1ab4459e0df4005459a9c1301 100644 (file)
@@ -45,7 +45,7 @@
                AO_WATCHDOG_PORT->odr ^= (1 << AO_WATCHDOG_BIT);        \
        } while (0)
 
-#define HAS_TICK               1
+#define HAS_TICK               0
 #include <ao_flash_stm_pins.h>
 
 /* Attached signal, PB8 */
index 7b526902169abc46cbb2f7bc61fbcab8e525c293..9d118b721349d2198f69e37f7e32dd73ee593734 100644 (file)
@@ -26,6 +26,8 @@
 #define HAS_TICK 1
 #endif
 
+#if HAS_TICK || defined(AO_TIMER_HOOK)
+
 #if HAS_TICK
 volatile AO_TICK_TYPE ao_tick_count;
 
@@ -34,6 +36,7 @@ ao_time(void)
 {
        return ao_tick_count;
 }
+#endif
 
 #if AO_DATA_ALL
 volatile __data uint8_t        ao_data_interval = 1;
@@ -44,7 +47,9 @@ void stm_systick_isr(void)
 {
        ao_validate_cur_stack();
        if (stm_systick.csr & (1 << STM_SYSTICK_CSR_COUNTFLAG)) {
+#if HAS_TICK
                ++ao_tick_count;
+#endif
 #if HAS_TASK_QUEUE
                if (ao_task_alarm_tick && (int16_t) (ao_tick_count - ao_task_alarm_tick) >= 0)
                        ao_task_check_alarm((uint16_t) ao_tick_count);