#include <stdio.h>
#include <string.h>
#include <stddef.h>
+#include <stdbool.h>
#include <ao_pins.h>
#include <ao_arch.h>
extern int ao_putchar(char c);
extern char ao_getchar(void);
-#define TRUE 1
-#define FALSE 0
-
#ifndef HAS_TASK
#define HAS_TASK 1
#endif
typedef AO_PORT_TYPE ao_port_t;
+#ifndef AO_TICK_TYPE
+#define AO_TICK_TYPE uint32_t
+#define AO_TICK_SIGNED int32_t
+#endif
+
#if HAS_TASK
#include <ao_task.h>
#else
#define AO_PANIC_SELF_TEST_HMC5883 0x40 | 2 /* Self test failure */
#define AO_PANIC_SELF_TEST_MPU6000 0x40 | 3 /* Self test failure */
#define AO_PANIC_SELF_TEST_MPU9250 0x40 | 3 /* Self test failure */
+#define AO_PANIC_SELF_TEST_BMX160 0x40 | 3 /* Self test failure */
#define AO_PANIC_SELF_TEST_MS5607 0x40 | 4 /* Self test failure */
+#define AO_PANIC_SELF_TEST_ADS124S0X 0x40 | 5 /* Self test failure */
/* Stop the operating system, beeping and blinking the reason */
void
-ao_panic(uint8_t reason);
+ao_panic(uint8_t reason) __attribute__((noreturn));
/*
- * ao_timer.c
+ * ao_romconfig.c
*/
-#ifndef AO_TICK_TYPE
-#define AO_TICK_TYPE uint16_t
-#define AO_TICK_SIGNED int16_t
+#define AO_ROMCONFIG_VERSION 2
+
+extern AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_version;
+extern AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_check;
+extern AO_ROMCONFIG_SYMBOL uint16_t ao_serial_number;
+#if HAS_RADIO
+extern AO_ROMCONFIG_SYMBOL uint32_t ao_radio_cal;
#endif
+/*
+ * ao_timer.c
+ */
+
extern volatile AO_TICK_TYPE ao_tick_count;
/* Our timer runs at 100Hz */
AO_TICK_TYPE
ao_time(void);
+/* Returns the current time in ns */
+uint64_t
+ao_time_ns(void);
+
/* Suspend the current task until ticks time has passed */
void
-ao_delay(uint16_t ticks);
+ao_delay(AO_TICK_TYPE ticks);
/* Set the ADC interval */
void
ao_timer_set_adc_interval(uint8_t interval);
-/* Timer interrupt */
-void
-ao_timer_isr(void) ao_arch_interrupt(9);
-
/* Initialize the timer */
void
ao_timer_init(void);
ao_cmd_syntax_error = 2,
};
-extern uint16_t ao_cmd_lex_i;
-extern uint32_t ao_cmd_lex_u32;
extern char ao_cmd_lex_c;
extern enum ao_cmd_status ao_cmd_status;
ao_put_string(const char *s);
void
-ao_cmd_readline(void);
+ao_cmd_readline(const char *prompt);
char
ao_cmd_lex(void);
int8_t
ao_cmd_hexchar(char c);
-void
+uint8_t
ao_cmd_hexbyte(void);
-void
+uint32_t
ao_cmd_hex(void);
-void
+uint32_t
ao_cmd_decimal(void);
/* Read a single hex nibble off stdin. */
#include <ao_beep.h>
#endif
-#if LEDS_AVAILABLE
+#if LEDS_AVAILABLE || HAS_LED
#include <ao_led.h>
#endif
#define HAS_RADIO_RATE HAS_RADIO
#endif
-void
-ao_radio_general_isr(void) ao_arch_interrupt(16);
-
#if HAS_RADIO_XMIT
void
ao_radio_send(const void *d, uint8_t size);
ao_igniter_main = 1
};
-void
-ao_ignite(enum ao_igniter igniter);
-
enum ao_igniter_status {
ao_igniter_unknown, /* unknown status (ambiguous voltage) */
ao_igniter_ready, /* continuity detected */
#define AO_TELEPYRO_NUM_ADC 9
-#ifndef ao_xmemcpy
-#define ao_xmemcpy(d,s,c) memcpy(d,s,c)
-#define ao_xmemset(d,v,c) memset(d,v,c)
-#define ao_xmemcmp(d,s,c) memcmp(d,s,c)
-#endif
-
/*
* ao_terraui.c
*/
*/
#ifdef BATTERY_PIN
-void
-ao_battery_isr(void) ao_arch_interrupt(1);
-
uint16_t
ao_battery_get(void);