altos/telefire*: Do voltage tests in decivolts instead of ADC units
[fw/altos] / src / drivers / ao_pad.c
1 /*
2  * Copyright © 2012 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18
19 #include <ao.h>
20 #include <ao_exti.h>
21 #include <ao_pad.h>
22 #include <ao_74hc165.h>
23 #include <ao_radio_cmac.h>
24
25 static __xdata uint8_t ao_pad_ignite;
26 static __xdata struct ao_pad_command    command;
27 static __xdata struct ao_pad_query      query;
28 static __pdata uint8_t  ao_pad_armed;
29 static __pdata uint16_t ao_pad_arm_time;
30 static __pdata uint8_t  ao_pad_box;
31 static __xdata uint8_t  ao_pad_disabled;
32 static __pdata uint16_t ao_pad_packet_time;
33
34 #ifndef AO_PAD_RSSI_MINIMUM
35 #define AO_PAD_RSSI_MINIMUM     -90
36 #endif
37
38 #define DEBUG   1
39
40 #if DEBUG
41 static __pdata uint8_t  ao_pad_debug;
42 #define PRINTD(...) (ao_pad_debug ? (printf(__VA_ARGS__), 0) : 0)
43 #define FLUSHD()    (ao_pad_debug ? (flush(), 0) : 0)
44 #else
45 #define PRINTD(...)
46 #define FLUSHD()
47 #endif
48
49 static void
50 ao_siren(uint8_t v)
51 {
52 #ifdef AO_SIREN
53         ao_gpio_set(AO_SIREN_PORT, AO_SIREN_PIN, AO_SIREN, v);
54 #else
55 #if HAS_BEEP
56         ao_beep(v ? AO_BEEP_MID : 0);
57 #else
58         (void) v;
59 #endif
60 #endif
61 }
62
63 static void
64 ao_strobe(uint8_t v)
65 {
66 #ifdef AO_STROBE
67         ao_gpio_set(AO_STROBE_PORT, AO_STROBE_PIN, AO_STROBE, v);
68 #else
69         (void) v;
70 #endif
71 }
72
73 #ifdef AO_PAD_PORT_0
74 #define pins_pad(pad)   (*((AO_PAD_ ## pad ## _PORT) == AO_PAD_PORT_0 ? (&pins0) : (&pins1)))
75 #else
76 #define pins_pad(pad)   pins0
77 #define AO_PAD_PORT_0 AO_PAD_PORT
78 #endif
79
80 static void
81 ao_pad_run(void)
82 {
83         AO_PORT_TYPE    pins0;
84 #ifdef AO_PAD_PORT_1
85         AO_PORT_TYPE    pins1;
86 #endif
87
88         for (;;) {
89                 while (!ao_pad_ignite)
90                         ao_sleep(&ao_pad_ignite);
91                 /*
92                  * Actually set the pad bits
93                  */
94                 pins0 = 0;
95 #ifdef AO_PAD_PORT_1
96                 pins1 = 0;
97 #endif
98 #if AO_PAD_NUM > 0
99                 if (ao_pad_ignite & (1 << 0))
100                         pins_pad(0) |= (1 << AO_PAD_PIN_0);
101 #endif
102 #if AO_PAD_NUM > 1
103                 if (ao_pad_ignite & (1 << 1))
104                         pins_pad(1) |= (1 << AO_PAD_PIN_1);
105 #endif
106 #if AO_PAD_NUM > 2
107                 if (ao_pad_ignite & (1 << 2))
108                         pins_pad(2) |= (1 << AO_PAD_PIN_2);
109 #endif
110 #if AO_PAD_NUM > 3
111                 if (ao_pad_ignite & (1 << 3))
112                         pins_pad(3) |= (1 << AO_PAD_PIN_3);
113 #endif
114 #if AO_PAD_NUM > 4
115                 if (ao_pad_ignite & (1 << 4))
116                         pins_pad(4) |= (1 << AO_PAD_PIN_4);
117 #endif
118 #if AO_PAD_NUM > 5
119                 if (ao_pad_ignite & (1 << 5))
120                         pins_pad(5) |= (1 << AO_PAD_PIN_5);
121 #endif
122 #if AO_PAD_NUM > 6
123                 if (ao_pad_ignite & (1 << 6))
124                         pins_pad(6) |= (1 << AO_PAD_PIN_6);
125 #endif
126 #if AO_PAD_NUM > 7
127                 if (ao_pad_ignite & (1 << 7))
128                         pins_pad(7) |= (1 << AO_PAD_PIN_7);
129 #endif
130 #ifdef AO_PAD_PORT_1
131                 PRINTD("ignite pins 0x%x 0x%x\n", pins0, pins1);
132                 ao_gpio_set_bits(AO_PAD_PORT_0, pins0);
133                 ao_gpio_set_bits(AO_PAD_PORT_1, pins1);
134 #else
135                 PRINTD("ignite pins 0x%x\n", pins0);
136                 ao_gpio_set_bits(AO_PAD_PORT_0, pins0);
137 #endif
138                 while (ao_pad_ignite) {
139                         ao_pad_ignite = 0;
140
141                         ao_delay(AO_PAD_FIRE_TIME);
142                 }
143 #ifdef AO_PAD_PORT_1
144                 ao_gpio_clr_bits(AO_PAD_PORT_0, pins0);
145                 ao_gpio_clr_bits(AO_PAD_PORT_1, pins1);
146                 PRINTD("turn off pins 0x%x 0x%x\n", pins0, pins1);
147 #else
148                 ao_gpio_set_bits(AO_PAD_PORT_0, pins0);
149                 PRINTD("turn off pins 0x%x\n", pins0);
150 #endif
151         }
152 }
153
154 #define AO_PAD_ARM_SIREN_INTERVAL       200
155
156 /* Resistor values needed for various voltage test ratios:
157  *
158  *      Net names involved:
159  *
160  *      V_BATT          Battery power, after the initial power switch
161  *      V_PYRO          Pyro power, after the pyro power switch (and initial power switch)
162  *      PYRO_SENSE      ADC input to sense V_PYRO voltage
163  *      BATT_SENSE      ADC input to sense V_BATT voltage
164  *      IGNITER         FET output to pad (the other pad lead hooks to V_PYRO)
165  *      IGNITER_SENSE   ADC input to sense igniter voltage
166  *
167  *      AO_PAD_R_V_BATT_BATT_SENSE      Resistor from battery rail to battery sense input
168  *      AO_PAD_R_BATT_SENSE_GND         Resistor from battery sense input to ground
169  *
170  *      AO_PAD_R_V_BATT_V_PYRO          Resistor from battery rail to pyro rail
171  *      AO_PAD_R_V_PYRO_PYRO_SENSE      Resistor from pyro rail to pyro sense input
172  *      AO_PAD_R_PYRO_SENSE_GND         Resistor from pyro sense input to ground
173  *
174  *      AO_PAD_R_V_PYRO_IGNITER         Optional resistors from pyro rail to FET igniter output
175  *      AO_PAD_R_IGNITER_IGNITER_SENSE  Resistors from FET igniter output to igniter sense ADC inputs
176  *      AO_PAD_R_IGNITER_SENSE_GND      Resistors from igniter sense ADC inputs to ground
177  */
178
179 int16_t
180 ao_pad_decivolt(int16_t adc, int16_t r_plus, int16_t r_minus)
181 {
182         int32_t mul = (int32_t) AO_ADC_REFERENCE_DV * (r_plus + r_minus);
183         int32_t div = (int32_t) AO_ADC_MAX * r_minus;
184         return ((int32_t) adc * mul + mul/2) / div;
185 }
186
187 static void
188 ao_pad_monitor(void)
189 {
190         uint8_t                 c;
191         uint8_t                 sample;
192         __pdata uint8_t         prev = 0, cur = 0;
193         __pdata uint8_t         beeping = 0;
194         __xdata volatile struct ao_data *packet;
195         __pdata uint16_t        arm_beep_time = 0;
196
197         sample = ao_data_head;
198         for (;;) {
199                 __pdata int16_t                 pyro;
200
201                 ao_arch_critical(
202                         while (sample == ao_data_head)
203                                 ao_sleep((void *) DATA_TO_XDATA(&ao_data_head));
204                         );
205
206
207                 packet = &ao_data_ring[sample];
208                 sample = ao_data_ring_next(sample);
209
210                 /* Reply battery voltage */
211                 query.battery = ao_pad_decivolt(packet->adc.batt, AO_PAD_R_V_BATT_BATT_SENSE, AO_PAD_R_BATT_SENSE_GND);
212
213                 /* Current pyro voltage */
214                 pyro = ao_pad_decivolt(packet->adc.pyro,
215                                        AO_PAD_R_V_PYRO_PYRO_SENSE,
216                                        AO_PAD_R_PYRO_SENSE_GND);
217
218                 cur = 0;
219                 if (pyro > query.battery * 7 / 8) {
220                         query.arm_status = AO_PAD_ARM_STATUS_ARMED;
221                         cur |= AO_LED_ARMED;
222                 } else {
223                         query.arm_status = AO_PAD_ARM_STATUS_DISARMED;
224                         arm_beep_time = 0;
225                 }
226                 if ((ao_time() - ao_pad_packet_time) > AO_SEC_TO_TICKS(2))
227                         cur |= AO_LED_RED;
228                 else if (ao_radio_cmac_rssi < AO_PAD_RSSI_MINIMUM)
229                         cur |= AO_LED_AMBER;
230                 else
231                         cur |= AO_LED_GREEN;
232
233                 for (c = 0; c < AO_PAD_NUM; c++) {
234                         int16_t         sense = ao_pad_decivolt(packet->adc.sense[c],
235                                                                 AO_PAD_R_IGNITER_IGNITER_SENSE,
236                                                                 AO_PAD_R_IGNITER_SENSE_GND);
237                         uint8_t status = AO_PAD_IGNITER_STATUS_UNKNOWN;
238
239                         /*
240                          *      Here's the resistor stack on each
241                          *      igniter channel. Note that
242                          *      AO_PAD_R_V_PYRO_IGNITER is optional
243                          *
244                          *                                      v_pyro \
245                          *      AO_PAD_R_V_PYRO_IGNITER                 igniter
246                          *                                      output /
247                          *      AO_PAD_R_IGNITER_IGNITER_SENSE         \
248                          *                                      sense   relay
249                          *      AO_PAD_R_IGNITER_SENSE_GND             /
250                          *                                      gnd ---
251                          *
252                          */
253
254 #ifdef AO_PAD_R_V_PYRO_IGNITER
255                         if (sense <= pyro / 8) {
256                                 /* close to zero → relay is closed */
257                                 status = AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_CLOSED;
258                                 if ((ao_time() % 100) < 50)
259                                         cur |= AO_LED_CONTINUITY(c);
260                         }
261                         else
262 #endif
263                         {
264                                 if (sense >= (pyro * 7) / 8) {
265
266                                         /* sense close to pyro voltage; igniter is good
267                                          */
268                                         status = AO_PAD_IGNITER_STATUS_GOOD_IGNITER_RELAY_OPEN;
269                                         cur |= AO_LED_CONTINUITY(c);
270                                 } else {
271
272                                         /* relay not shorted (if we can tell),
273                                          * and igniter not obviously present
274                                          */
275                                         status = AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_OPEN;
276                                 }
277                         }
278                         query.igniter_status[c] = status;
279                 }
280                 if (cur != prev) {
281                         PRINTD("change leds from %02x to %02x\n",
282                                prev, cur);
283                         FLUSHD();
284                         ao_led_set(cur);
285                         prev = cur;
286                 }
287
288                 if (ao_pad_armed && (int16_t) (ao_time() - ao_pad_arm_time) > AO_PAD_ARM_TIME)
289                         ao_pad_armed = 0;
290
291                 if (ao_pad_armed) {
292                         ao_strobe(1);
293                         ao_siren(1);
294                         beeping = 1;
295                 } else if (query.arm_status == AO_PAD_ARM_STATUS_ARMED && !beeping) {
296                         if (arm_beep_time == 0) {
297                                 arm_beep_time = AO_PAD_ARM_SIREN_INTERVAL;
298                                 beeping = 1;
299                                 ao_siren(1);
300                         }
301                         --arm_beep_time;
302                 } else if (beeping) {
303                         beeping = 0;
304                         ao_siren(0);
305                         ao_strobe(0);
306                 }
307         }
308 }
309
310 void
311 ao_pad_disable(void)
312 {
313         if (!ao_pad_disabled) {
314                 ao_pad_disabled = 1;
315                 ao_radio_recv_abort();
316         }
317 }
318
319 void
320 ao_pad_enable(void)
321 {
322         ao_pad_disabled = 0;
323         ao_wakeup (&ao_pad_disabled);
324 }
325
326 #if HAS_74HC165
327 static uint8_t
328 ao_pad_read_box(void)
329 {
330         uint8_t         byte = ao_74hc165_read();
331         uint8_t         h, l;
332
333         h = byte >> 4;
334         l = byte & 0xf;
335         return h * 10 + l;
336 }
337 #endif
338
339 #ifdef AO_PAD_SELECTOR_PORT
340 static int ao_pad_read_box(void) {
341         AO_PORT_TYPE    value = ao_gpio_get_all(AO_PAD_SELECTOR_PORT);
342         unsigned        pin;
343         int             select = 1;
344
345         for (pin = 0; pin < sizeof (AO_PORT_TYPE) * 8; pin++) {
346                 if (AO_PAD_SELECTOR_PINS & (1 << pin)) {
347                         if ((value & (1 << pin)) == 0)
348                                 return select;
349                         select++;
350                 }
351         }
352         return ao_config.pad_box;
353 }
354 #else
355
356 #if HAS_FIXED_PAD_BOX
357 #define ao_pad_read_box()       ao_config.pad_box
358 #endif
359
360 #ifdef PAD_BOX
361 #define ao_pad_read_box()       PAD_BOX
362 #endif
363
364 #endif
365
366 static void
367 ao_pad(void)
368 {
369         int16_t time_difference;
370         int8_t  ret;
371
372         ao_pad_box = 0;
373         ao_led_set(0);
374         for (;;) {
375                 FLUSHD();
376                 while (ao_pad_disabled)
377                         ao_sleep(&ao_pad_disabled);
378                 ret = ao_radio_cmac_recv(&command, sizeof (command), 0);
379                 PRINTD ("cmac_recv %d %d\n", ret, ao_radio_cmac_rssi);
380                 if (ret != AO_RADIO_CMAC_OK)
381                         continue;
382                 ao_pad_packet_time = ao_time();
383
384                 ao_pad_box = ao_pad_read_box();
385
386                 PRINTD ("tick %d box %d (me %d) cmd %d channels %02x\n",
387                         command.tick, command.box, ao_pad_box, command.cmd, command.channels);
388
389                 switch (command.cmd) {
390                 case AO_PAD_ARM:
391                         if (command.box != ao_pad_box) {
392                                 PRINTD ("box number mismatch\n");
393                                 break;
394                         }
395
396                         if (command.channels & ~(AO_PAD_ALL_CHANNELS))
397                                 break;
398
399                         time_difference = command.tick - ao_time();
400                         PRINTD ("arm tick %d local tick %d\n", command.tick, ao_time());
401                         if (time_difference < 0)
402                                 time_difference = -time_difference;
403                         if (time_difference > 10) {
404                                 PRINTD ("time difference too large %d\n", time_difference);
405                                 break;
406                         }
407                         PRINTD ("armed\n");
408                         ao_pad_armed = command.channels;
409                         ao_pad_arm_time = ao_time();
410                         break;
411
412                 case AO_PAD_QUERY:
413                         if (command.box != ao_pad_box) {
414                                 PRINTD ("box number mismatch\n");
415                                 break;
416                         }
417
418                         query.tick = ao_time();
419                         query.box = ao_pad_box;
420                         query.channels = AO_PAD_ALL_CHANNELS;
421                         query.armed = ao_pad_armed;
422                         PRINTD ("query tick %d box %d channels %02x arm %d arm_status %d igniter %d,%d,%d,%d\n",
423                                 query.tick, query.box, query.channels, query.armed,
424                                 query.arm_status,
425                                 query.igniter_status[0],
426                                 query.igniter_status[1],
427                                 query.igniter_status[2],
428                                 query.igniter_status[3]);
429                         ao_radio_cmac_send(&query, sizeof (query));
430                         break;
431                 case AO_PAD_FIRE:
432                         if (!ao_pad_armed) {
433                                 PRINTD ("not armed\n");
434                                 break;
435                         }
436                         if ((uint16_t) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
437                                 PRINTD ("late pad arm_time %d time %d\n",
438                                         ao_pad_arm_time, ao_time());
439                                 break;
440                         }
441                         PRINTD ("ignite\n");
442                         ao_pad_ignite = ao_pad_armed;
443                         ao_pad_arm_time = ao_time();
444                         ao_wakeup(&ao_pad_ignite);
445                         break;
446                 case AO_PAD_STATIC:
447                         if (!ao_pad_armed) {
448                                 PRINTD ("not armed\n");
449                                 break;
450                         }
451 #if HAS_LOG
452                         if (!ao_log_running) ao_log_start();
453 #endif
454                         if ((uint16_t) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
455                                 PRINTD ("late pad arm_time %d time %d\n",
456                                         ao_pad_arm_time, ao_time());
457                                 break;
458                         }
459                         PRINTD ("ignite\n");
460                         ao_pad_ignite = ao_pad_armed;
461                         ao_pad_arm_time = ao_time();
462                         ao_wakeup(&ao_pad_ignite);
463                         break;
464                 case AO_PAD_ENDSTATIC:
465 #if HAS_LOG
466                         ao_log_stop();
467 #endif
468                         break;
469                 }
470         }
471 }
472
473 void
474 ao_pad_test(void)
475 {
476         uint8_t c;
477
478         printf ("Arm switch: ");
479         switch (query.arm_status) {
480         case AO_PAD_ARM_STATUS_ARMED:
481                 printf ("Armed\n");
482                 break;
483         case AO_PAD_ARM_STATUS_DISARMED:
484                 printf ("Disarmed\n");
485                 break;
486         case AO_PAD_ARM_STATUS_UNKNOWN:
487                 printf ("Unknown\n");
488                 break;
489         }
490
491         for (c = 0; c < AO_PAD_NUM; c++) {
492                 printf ("Pad %d: ", c);
493                 switch (query.igniter_status[c]) {
494                 case AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_CLOSED:     printf ("No igniter. Relay closed\n"); break;
495                 case AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_OPEN:       printf ("No igniter. Relay open\n"); break;
496                 case AO_PAD_IGNITER_STATUS_GOOD_IGNITER_RELAY_OPEN:     printf ("Good igniter. Relay open\n"); break;
497                 case AO_PAD_IGNITER_STATUS_UNKNOWN:                     printf ("Unknown\n"); break;
498                 }
499         }
500 }
501
502 void
503 ao_pad_manual(void)
504 {
505         uint8_t ignite;
506         int     repeat;
507         ao_cmd_white();
508         if (!ao_match_word("DoIt"))
509                 return;
510         ao_cmd_decimal();
511         if (ao_cmd_status != ao_cmd_success)
512                 return;
513         ignite = 1 << ao_cmd_lex_i;
514         ao_cmd_decimal();
515         if (ao_cmd_status != ao_cmd_success) {
516                 repeat = 1;
517                 ao_cmd_status = ao_cmd_success;
518         } else
519                 repeat = ao_cmd_lex_i;
520         while (repeat-- > 0) {
521                 ao_pad_ignite = ignite;
522                 ao_wakeup(&ao_pad_ignite);
523                 ao_delay(AO_PAD_FIRE_TIME>>1);
524         }
525 }
526
527 static __xdata struct ao_task ao_pad_task;
528 static __xdata struct ao_task ao_pad_ignite_task;
529 static __xdata struct ao_task ao_pad_monitor_task;
530
531 #if DEBUG
532 void
533 ao_pad_set_debug(void)
534 {
535         ao_cmd_decimal();
536         if (ao_cmd_status == ao_cmd_success)
537                 ao_pad_debug = ao_cmd_lex_i != 0;
538 }
539
540
541 static void
542 ao_pad_alarm_debug(void)
543 {
544         uint8_t which, value;
545         ao_cmd_decimal();
546         if (ao_cmd_status != ao_cmd_success)
547                 return;
548         which = ao_cmd_lex_i;
549         ao_cmd_decimal();
550         if (ao_cmd_status != ao_cmd_success)
551                 return;
552         value = ao_cmd_lex_i;
553         printf ("Set %s to %d\n", which ? "siren" : "strobe", value);
554         if (which)
555                 ao_siren(value);
556         else
557                 ao_strobe(value);
558 }
559 #endif
560
561 __code struct ao_cmds ao_pad_cmds[] = {
562         { ao_pad_test,  "t\0Test pad continuity" },
563         { ao_pad_manual,        "i <key> <n>\0Fire igniter. <key> is doit with D&I" },
564 #if DEBUG
565         { ao_pad_set_debug,     "D <0 off, 1 on>\0Debug" },
566         { ao_pad_alarm_debug,   "S <0 strobe, 1 siren> <0 off, 1 on>\0Set alarm output" },
567 #endif
568         { 0, NULL }
569 };
570
571 #ifndef AO_PAD_PORT_1
572 #define AO_PAD_0_PORT   AO_PAD_PORT
573 #define AO_PAD_1_PORT   AO_PAD_PORT
574 #define AO_PAD_2_PORT   AO_PAD_PORT
575 #define AO_PAD_3_PORT   AO_PAD_PORT
576 #define AO_PAD_4_PORT   AO_PAD_PORT
577 #define AO_PAD_5_PORT   AO_PAD_PORT
578 #define AO_PAD_6_PORT   AO_PAD_PORT
579 #define AO_PAD_7_PORT   AO_PAD_PORT
580 #endif
581
582 void
583 ao_pad_init(void)
584 {
585 #ifdef AO_PAD_SELECTOR_PORT
586         unsigned pin;
587
588         for (pin = 0; pin < sizeof (AO_PORT_TYPE) * 8; pin++) {
589                 if (AO_PAD_SELECTOR_PINS & (1 << pin))
590                         ao_enable_input(AO_PAD_SELECTOR_PORT, pin, AO_EXTI_MODE_PULL_UP);
591         }
592 #endif
593 #if AO_PAD_NUM > 0
594         ao_enable_output(AO_PAD_0_PORT, AO_PAD_PIN_0, AO_PAD_0, 0);
595 #endif
596 #if AO_PAD_NUM > 1
597         ao_enable_output(AO_PAD_1_PORT, AO_PAD_PIN_1, AO_PAD_1, 0);
598 #endif
599 #if AO_PAD_NUM > 2
600         ao_enable_output(AO_PAD_2_PORT, AO_PAD_PIN_2, AO_PAD_2, 0);
601 #endif
602 #if AO_PAD_NUM > 3
603         ao_enable_output(AO_PAD_3_PORT, AO_PAD_PIN_3, AO_PAD_3, 0);
604 #endif
605 #if AO_PAD_NUM > 4
606         ao_enable_output(AO_PAD_4_PORT, AO_PAD_PIN_4, AO_PAD_4, 0);
607 #endif
608 #if AO_PAD_NUM > 5
609         ao_enable_output(AO_PAD_5_PORT, AO_PAD_PIN_5, AO_PAD_5, 0);
610 #endif
611 #if AO_PAD_NUM > 5
612         ao_enable_output(AO_PAD_6_PORT, AO_PAD_PIN_6, AO_PAD_6, 0);
613 #endif
614 #if AO_PAD_NUM > 7
615         ao_enable_output(AO_PAD_7_PORT, AO_PAD_PIN_7, AO_PAD_7, 0);
616 #endif
617 #ifdef AO_STROBE
618         ao_enable_output(AO_STROBE_PORT, AO_STROBE_PIN, AO_STROBE, 0);
619 #endif
620 #ifdef AO_SIREN
621         ao_enable_output(AO_SIREN_PORT, AO_SIREN_PIN, AO_SIREN, 0);
622 #endif
623         ao_cmd_register(&ao_pad_cmds[0]);
624         ao_add_task(&ao_pad_task, ao_pad, "pad listener");
625         ao_add_task(&ao_pad_ignite_task, ao_pad_run, "pad igniter");
626         ao_add_task(&ao_pad_monitor_task, ao_pad_monitor, "pad monitor");
627 }