#define HAS_TASK 1
#endif
-#ifndef AO_PORT_TYPE
-#define AO_PORT_TYPE uint8_t
-#endif
-
typedef AO_PORT_TYPE ao_port_t;
#if HAS_TASK
#define AO_PANIC_BUFIO 15 /* Mis-using bufio API */
#define AO_PANIC_EXTI 16 /* Mis-using exti API */
#define AO_PANIC_FAST_TIMER 17 /* Mis-using fast timer API */
+#define AO_PANIC_ADC 18 /* Mis-using ADC interface */
#define AO_PANIC_SELF_TEST_CC1120 0x40 | 1 /* Self test failure */
#define AO_PANIC_SELF_TEST_HMC5883 0x40 | 2 /* Self test failure */
#define AO_PANIC_SELF_TEST_MPU6000 0x40 | 3 /* Self test failure */
*/
#ifndef ao_mutex_get
+uint8_t
+ao_mutex_try(__xdata uint8_t *ao_mutex, uint8_t task_id) __reentrant;
+
void
ao_mutex_get(__xdata uint8_t *ao_mutex) __reentrant;
* Given raw data, convert to SI units
*/
+#if HAS_BARO
/* pressure from the sensor to altitude in meters */
-int16_t
-ao_pres_to_altitude(int16_t pres) __reentrant;
+alt_t
+ao_pres_to_altitude(pres_t pres) __reentrant;
-int16_t
-ao_altitude_to_pres(int16_t alt) __reentrant;
+pres_t
+ao_altitude_to_pres(alt_t alt) __reentrant;
int16_t
ao_temp_to_dC(int16_t temp) __reentrant;
+#endif
/*
* ao_convert_pa.c
#include <ao_data.h>
+#if HAS_BARO
alt_t
-ao_pa_to_altitude(int32_t pa);
+ao_pa_to_altitude(pres_t pa);
int32_t
ao_altitude_to_pa(alt_t alt);
+#endif
#if HAS_DBG
#include <ao_dbg.h>
/* Set delay between telemetry reports (0 to disable) */
-#ifdef AO_SEND_ALL_BARO
-#define AO_TELEMETRY_INTERVAL_PAD AO_MS_TO_TICKS(100)
-#define AO_TELEMETRY_INTERVAL_FLIGHT AO_MS_TO_TICKS(100)
-#define AO_TELEMETRY_INTERVAL_RECOVER AO_MS_TO_TICKS(100)
-#else
#define AO_TELEMETRY_INTERVAL_PAD AO_MS_TO_TICKS(1000)
#define AO_TELEMETRY_INTERVAL_FLIGHT AO_MS_TO_TICKS(100)
#define AO_TELEMETRY_INTERVAL_RECOVER AO_MS_TO_TICKS(1000)
-#endif
-#define AO_RADIO_RATE_38400 0
-#define AO_RADIO_RATE_9600 1
-#define AO_RADIO_RATE_2400 2
+void
+ao_telemetry_reset_interval(void);
void
ao_telemetry_set_interval(uint16_t interval);
extern __xdata union ao_monitor ao_monitor_ring[AO_MONITOR_RING];
#define ao_monitor_ring_next(n) (((n) + 1) & (AO_MONITOR_RING - 1))
+#define ao_monitor_ring_prev(n) (((n) - 1) & (AO_MONITOR_RING - 1))
extern __data uint8_t ao_monitoring;
extern __data uint8_t ao_monitor_head;