#include <ao_74hc165.h>
#include <ao_radio_cmac.h>
-static __xdata uint8_t ao_pad_ignite;
-static __xdata struct ao_pad_command command;
-static __xdata struct ao_pad_query query;
-static __pdata uint8_t ao_pad_armed;
-static __pdata uint16_t ao_pad_arm_time;
-static __pdata uint8_t ao_pad_box;
-static __xdata uint8_t ao_pad_disabled;
-static __pdata uint16_t ao_pad_packet_time;
+static uint8_t ao_pad_ignite;
+static struct ao_pad_command command;
+static struct ao_pad_query query;
+static uint8_t ao_pad_armed;
+static uint16_t ao_pad_arm_time;
+static uint8_t ao_pad_box;
+static uint8_t ao_pad_disabled;
+static uint16_t ao_pad_packet_time;
#ifndef AO_PAD_RSSI_MINIMUM
#define AO_PAD_RSSI_MINIMUM -90
#define DEBUG 1
#if DEBUG
-static __pdata uint8_t ao_pad_debug;
+static uint8_t ao_pad_debug;
#define PRINTD(...) (ao_pad_debug ? (printf(__VA_ARGS__), 0) : 0)
#define FLUSHD() (ao_pad_debug ? (flush(), 0) : 0)
#else
{
uint8_t c;
uint8_t sample;
- __pdata AO_LED_TYPE prev = 0, cur = 0;
- __pdata uint8_t beeping = 0;
- __xdata volatile struct ao_data *packet;
- __pdata uint16_t arm_beep_time = 0;
+ AO_LED_TYPE prev = 0, cur = 0;
+ uint8_t beeping = 0;
+ volatile struct ao_data *packet;
+ uint16_t arm_beep_time = 0;
sample = ao_data_head;
+ ao_led_set(LEDS_AVAILABLE);
+ ao_delay(AO_MS_TO_TICKS(1000));
+ ao_led_set(0);
for (;;) {
- __pdata int16_t pyro;
+ int16_t pyro;
ao_arch_critical(
while (sample == ao_data_head)
- ao_sleep((void *) DATA_TO_XDATA(&ao_data_head));
+ ao_sleep((void *) &ao_data_head);
);
int8_t ret;
ao_pad_box = 0;
- ao_led_set(LEDS_AVAILABLE);
- ao_delay(AO_MS_TO_TICKS(500));
- ao_led_set(0);
for (;;) {
FLUSHD();
while (ao_pad_disabled)
ao_cmd_white();
if (!ao_match_word("DoIt"))
return;
- ao_cmd_decimal();
+ ignite = 1 << ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- ignite = 1 << ao_cmd_lex_i;
- ao_cmd_decimal();
+ repeat = ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success) {
repeat = 1;
ao_cmd_status = ao_cmd_success;
- } else
- repeat = ao_cmd_lex_i;
+ }
while (repeat-- > 0) {
ao_pad_ignite = ignite;
ao_wakeup(&ao_pad_ignite);
}
}
-static __xdata struct ao_task ao_pad_task;
-static __xdata struct ao_task ao_pad_ignite_task;
-static __xdata struct ao_task ao_pad_monitor_task;
+static struct ao_task ao_pad_task;
+static struct ao_task ao_pad_ignite_task;
+static struct ao_task ao_pad_monitor_task;
#if DEBUG
void
ao_pad_set_debug(void)
{
- ao_cmd_decimal();
+ uint16_t r = ao_cmd_decimal();
if (ao_cmd_status == ao_cmd_success)
- ao_pad_debug = ao_cmd_lex_i != 0;
+ ao_pad_debug = r != 0;
}
ao_pad_alarm_debug(void)
{
uint8_t which, value;
- ao_cmd_decimal();
+ which = ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- which = ao_cmd_lex_i;
- ao_cmd_decimal();
+ value = ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
return;
- value = ao_cmd_lex_i;
printf ("Set %s to %d\n", which ? "siren" : "strobe", value);
if (which)
ao_siren(value);
}
#endif
-__code struct ao_cmds ao_pad_cmds[] = {
+const struct ao_cmds ao_pad_cmds[] = {
{ ao_pad_test, "t\0Test pad continuity" },
{ ao_pad_manual, "i <key> <n>\0Fire igniter. <key> is doit with D&I" },
#if DEBUG