telelco-v3.0: Support ambient light sensor
[fw/altos] / src / telelco-v3.0 / ao_lco_v3.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_lco.h>
21 #include <ao_event.h>
22 #include <ao_quadrature.h>
23 #include <ao_radio_cmac.h>
24 #include <ao_st7565.h>
25 #include <ao_adc_single.h>
26 #include <ao_pwm.h>
27 #include <limits.h>
28
29 #define WIDTH   AO_ST7565_WIDTH
30 #define HEIGHT  AO_ST7565_HEIGHT
31 #define STRIDE  AO_BITMAP_STRIDE(WIDTH)
32
33 static uint32_t image[STRIDE * HEIGHT];
34
35 static struct ao_bitmap fb = {
36         .base = image,
37         .stride = STRIDE,
38         .width = WIDTH,
39         .height = HEIGHT,
40         .damage = AO_BOX_INIT,
41 };
42
43 static const struct ao_transform logo_transform = {
44         .x_scale = 40, .x_off = 8,
45         .y_scale = 40, .y_off = 0,
46 };
47
48 static const struct ao_transform show_transform = {
49         .x_scale = 36, .x_off = 100,
50         .y_scale = 36, .y_off = 0,
51 };
52
53 #define BIG_FONT BitstreamVeraSans_Roman_58_font
54 #define VOLT_FONT BitstreamVeraSans_Roman_58_font
55 #define SMALL_FONT BitstreamVeraSans_Roman_12_font
56 #define TINY_FONT BitstreamVeraSans_Roman_10_font
57 #define LOGO_FONT BenguiatGothicStd_Bold_24_font
58
59 #define LABEL_Y         (int16_t) (SMALL_FONT.ascent)
60 #define VALUE_Y         (int16_t) (LABEL_Y + 5 + BIG_FONT.ascent)
61
62 #define SEP_X           82
63 #define SEP_WIDTH       2
64
65 #define BOX_X           (SEP_X / 2)
66 #define PAD_X           ((WIDTH + SEP_X + SEP_WIDTH) / 2)
67
68 #define VALUE_LABEL_X   64
69 #define RSSI_LABEL_X    15
70
71 #define SCAN_X          (WIDTH - 100) / 2
72 #define SCAN_Y          50
73 #define SCAN_HEIGHT     3
74 #define SCANNING_X      (WIDTH / 2)
75 #define SCANNING_Y      (SCAN_Y - 2)
76 #define FOUND_Y         63
77 #define FOUND_X         3
78 #define FOUND_WIDTH     (WIDTH - 6)
79 #define CONTRAST_LABEL_X        37
80 #define CONTRAST_WIDTH  100
81 #define CONTRAST_X      (WIDTH - CONTRAST_WIDTH) / 2
82 #define CONTRAST_Y      20
83 #define CONTRAST_HEIGHT 20
84 #define CONTRAST_VALUE_X        64
85 #define CONTRAST_VALUE_Y        (CONTRAST_Y + CONTRAST_HEIGHT + SMALL_FONT.ascent + 3)
86 #define BACKLIGHT_LABEL_X       37
87 #define BACKLIGHT_WIDTH 100
88 #define BACKLIGHT_X     (WIDTH - BACKLIGHT_WIDTH) / 2
89 #define BACKLIGHT_Y     20
90 #define BACKLIGHT_HEIGHT        20
91 #define BACKLIGHT_VALUE_X       64
92 #define BACKLIGHT_VALUE_Y       (BACKLIGHT_Y + BACKLIGHT_HEIGHT + SMALL_FONT.ascent + 3)
93 #define INFO_FONT       TINY_FONT
94 #define INFO_START_Y    ((int16_t) (INFO_FONT.ascent + 2))
95 #define INFO_STEP_Y     ((int16_t) (INFO_FONT.ascent + 2))
96
97 #define AO_LCO_DRAG_RACE_START_TIME     AO_SEC_TO_TICKS(5)
98 #define AO_LCO_DRAG_RACE_STOP_TIME      AO_SEC_TO_TICKS(2)
99
100 /* UI values */
101 static uint8_t  ao_lco_select_mode;
102 static uint8_t  ao_lco_event_debug;
103
104 #define PRINTE(...) do { if (!ao_lco_debug && !ao_lco_event_debug) break; printf ("\r%5lu %s: ", (unsigned long) ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } while(0)
105 #define AO_LCO_SELECT_BOX       0
106 #define AO_LCO_SELECT_PAD       1
107
108 static uint8_t  ao_lco_display_mutex;
109
110 static uint8_t          ao_sample_data;
111 static struct ao_data   ao_data_cur;
112
113 static void
114 _ao_center_text(int16_t x, int16_t y, const struct ao_font *font, const char *str)
115 {
116         int16_t width = ao_text_width(font, str);
117         ao_text(&fb, font, x - width/2, y, str, AO_BLACK, AO_COPY);
118 }
119
120 static void
121 _ao_lco_show_pad(int8_t pad)
122 {
123         char    str[5];
124
125         _ao_center_text(PAD_X, LABEL_Y, &SMALL_FONT, "Pad");
126         snprintf(str, sizeof(str), "%d", pad);
127         _ao_center_text(PAD_X, VALUE_Y, &BIG_FONT, str);
128 }
129
130 static void
131 _ao_lco_show_box(int16_t box)
132 {
133         char    str[7];
134
135         _ao_center_text(BOX_X, LABEL_Y, &SMALL_FONT, "Bank");
136         snprintf(str, sizeof(str), "%d", box);
137         _ao_center_text(BOX_X, VALUE_Y, &BIG_FONT, str);
138 }
139
140 static void
141 _ao_format_voltage(char *str, size_t size, uint16_t decivolts)
142 {
143         snprintf(str, size, "%d.%d", decivolts / 10, decivolts % 10);
144 }
145
146 #if AO_LCO_HAS_CONTRAST
147 static void
148 _ao_lco_show_contrast(void)
149 {
150         char buf[8];
151         uint8_t brightness = ao_st7565_get_brightness();
152         int16_t contrast = (int16_t) (brightness * CONTRAST_WIDTH / AO_LCO_MAX_CONTRAST);
153
154         _ao_center_text(WIDTH/2, LABEL_Y, &SMALL_FONT, "Contrast");
155         ao_rect(&fb, CONTRAST_X, CONTRAST_Y, contrast, CONTRAST_HEIGHT, AO_BLACK, AO_COPY);
156         snprintf(buf, sizeof(buf), "%d %%", brightness * 100 / AO_LCO_MAX_CONTRAST);
157         _ao_center_text(WIDTH/2, CONTRAST_VALUE_Y, &SMALL_FONT, buf);
158 }
159 #endif
160
161 #if AO_LCO_HAS_BACKLIGHT_UI
162 static void
163 _ao_lco_show_backlight(void)
164 {
165         char buf[8];
166         int32_t backlight = ao_lco_get_backlight();
167         int16_t value = (int16_t) (backlight * BACKLIGHT_WIDTH / AO_LCO_MAX_BACKLIGHT);
168
169         _ao_center_text(WIDTH/2, LABEL_Y, &SMALL_FONT, "Backlight");
170         ao_rect(&fb, BACKLIGHT_X, BACKLIGHT_Y, value, BACKLIGHT_HEIGHT, AO_BLACK, AO_COPY);
171         snprintf(buf, sizeof(buf), "%ld %%", backlight * 100 / AO_LCO_MAX_BACKLIGHT);
172         _ao_center_text(WIDTH/2, BACKLIGHT_VALUE_Y, &SMALL_FONT, buf);
173 }
174 #endif
175
176 static int16_t info_y;
177
178 static void
179 _ao_lco_info(const char *format, ...)
180 {
181         va_list a;
182         char    buf[20];
183         va_start(a, format);
184         vsnprintf(buf, sizeof(buf), format, a);
185         va_end(a);
186         ao_text(&fb, &INFO_FONT, 0, info_y, buf, AO_BLACK, AO_COPY);
187         info_y += INFO_STEP_Y;
188 }
189
190 static void
191 _ao_lco_show_lco_info(void)
192 {
193         char            battery[7];
194         int16_t         decivolt;
195
196         ao_logo_poly(&fb, &show_transform, AO_BLACK, AO_COPY);
197
198         decivolt = ao_battery_decivolt(ao_data_cur.adc.v_batt);
199         _ao_format_voltage(battery, sizeof(battery), (uint16_t) decivolt);
200
201         info_y = INFO_START_Y;
202         _ao_lco_info("%s", ao_product);
203         _ao_lco_info("Serial: %d", ao_serial_number);
204         _ao_lco_info("Battery: %sV", battery);
205         _ao_lco_info("Version: %s", ao_version);
206         _ao_lco_info("Callsign: %s", ao_config.callsign);
207         _ao_lco_info("Frequency: %ld.%03d",
208                      ao_config.frequency / 1000,
209                      (int) (ao_config.frequency % 1000));
210 }
211
212 static uint8_t
213 popcount(uint32_t value)
214 {
215         uint8_t count = 0;
216         while(value != 0) {
217                 count += value & 1;
218                 value >>= 1;
219         }
220         return count;
221 }
222
223 static void
224 _ao_lco_show_pad_info(void)
225 {
226         char    pad_battery[7];
227
228         ao_logo_poly(&fb, &show_transform, AO_BLACK, AO_COPY);
229         info_y = INFO_START_Y;
230         _ao_lco_info("Bank: %d", ao_lco_box);
231         if (!(ao_lco_valid[ao_lco_box] & AO_LCO_VALID_LAST)) {
232                 _ao_lco_info("Contact lost");
233                 _ao_lco_info("Last RSSI: %ddBm", ao_radio_cmac_last_rssi);
234         } else {
235                 _ao_lco_info("Total pads: %d", popcount(ao_pad_query.channels));
236                 _ao_lco_info("RSSI: %ddBm", ao_radio_cmac_rssi);
237                 _ao_format_voltage(pad_battery, sizeof(pad_battery), ao_pad_query.battery);
238                 _ao_lco_info("Battery: %sV", pad_battery);
239                 _ao_lco_info("Arming switch: %s", ao_pad_query.arm_status ? "On" : "Off");
240         }
241 }
242
243 #define AO_LCO_DIM_BACKLIGHT    (AO_LCO_MIN_BACKLIGHT + 3 * AO_LCO_BACKLIGHT_STEP)
244 #define AO_AUTO_BACKLIGHT_RANGE (AO_LCO_MAX_BACKLIGHT - AO_LCO_DIM_BACKLIGHT)
245 #define AO_AUTO_BACKLIGHT_GAP   AO_ADC_MAX / 6
246
247 static struct {
248         int16_t v_als;
249         int32_t backlight;
250 } ao_lco_backlight_map[] = {
251         { .v_als = AO_ADC_MAX / 6, .backlight = AO_LCO_DIM_BACKLIGHT },
252         { .v_als = AO_ADC_MAX / 3, .backlight = (AO_LCO_MAX_BACKLIGHT - AO_LCO_MIN_BACKLIGHT) / 2 },
253         { .v_als = AO_ADC_MAX / 2, .backlight = AO_LCO_MAX_BACKLIGHT },
254         { .v_als = AO_ADC_MAX * 3 / 4,  .backlight = 0 },
255 };
256
257 #define NUM_BACKLIGHT_MAP sizeof(ao_lco_backlight_map)/sizeof(ao_lco_backlight_map[0])
258
259 static unsigned ao_backlight_prev = NUM_BACKLIGHT_MAP - 1;
260
261 static void
262 ao_auto_backlight(int16_t als_min, int16_t als_max)
263 {
264         unsigned ao_backlight;
265
266         PRINTD("ao_auto_backlight min %d max %d\n", als_min, als_max);
267         ao_backlight = ao_backlight_prev;
268         while (als_min > ao_lco_backlight_map[ao_backlight].v_als + AO_AUTO_BACKLIGHT_GAP) {
269                 if (ao_backlight == NUM_BACKLIGHT_MAP - 1)
270                         break;
271                 ao_backlight++;
272         }
273         while (als_max < ao_lco_backlight_map[ao_backlight].v_als - AO_AUTO_BACKLIGHT_GAP) {
274                 if (ao_backlight == 0)
275                         return;
276                 ao_backlight--;
277         }
278         if (ao_backlight != ao_backlight_prev)
279         {
280                 PRINTD("   set backlight to %ld\n", ao_lco_backlight_map[ao_backlight].backlight);
281                 ao_lco_set_backlight(ao_lco_backlight_map[ao_backlight].backlight);
282                 ao_backlight_prev = ao_backlight;
283         }
284 }
285
286 #define AO_LCO_BACKLIGHT_INTERVAL       AO_SEC_TO_TICKS(2)
287
288 static void
289 ao_lco_data(void)
290 {
291         AO_TICK_TYPE    backlight_tick = ao_time() + AO_LCO_BACKLIGHT_INTERVAL;
292         AO_TICK_TYPE    now;
293         int16_t         als_min = INT16_MAX;
294         int16_t         als_max = INT16_MIN;
295
296         ao_timer_set_adc_interval(AO_MS_TO_TICKS(100));
297         for (;;) {
298                 ao_sleep((void *) &ao_data_head);
299
300                 while (ao_sample_data != ao_data_head) {
301                         struct ao_data *ao_data;
302
303                         /* Capture a sample */
304                         ao_data = (struct ao_data *) &ao_data_ring[ao_sample_data];
305
306                         ao_data_cur = *ao_data;
307                         if (ao_data_cur.adc.v_als < als_min)
308                                 als_min = ao_data_cur.adc.v_als;
309                         if (ao_data_cur.adc.v_als > als_max)
310                                 als_max = ao_data_cur.adc.v_als;
311                         ao_sample_data = ao_data_ring_next(ao_sample_data);
312                 }
313                 now = ao_time();
314                 if ((AO_TICK_SIGNED) (backlight_tick - now) < 0) {
315                         backlight_tick = now + AO_LCO_BACKLIGHT_INTERVAL;
316                         ao_auto_backlight(als_min, als_max);
317                         als_min = INT16_MAX;
318                         als_max = INT16_MIN;
319                 }
320         }
321 }
322
323 void
324 ao_lco_show(void)
325 {
326         ao_mutex_get(&ao_lco_display_mutex);
327         ao_rect(&fb, 0, 0, WIDTH, HEIGHT, AO_WHITE, AO_COPY);
328         switch (ao_lco_box) {
329 #if AO_LCO_HAS_CONTRAST
330         case AO_LCO_CONTRAST:
331                 _ao_lco_show_contrast();
332                 break;
333 #endif
334 #if AO_LCO_HAS_BACKLIGHT_UI
335         case AO_LCO_BACKLIGHT:
336                 _ao_lco_show_backlight();
337                 break;
338 #endif
339         case AO_LCO_LCO_INFO:
340                 _ao_lco_show_lco_info();
341                 break;
342         default:
343                 switch (ao_lco_pad) {
344                 case AO_LCO_PAD_INFO:
345                         _ao_lco_show_pad_info();
346                         break;
347                 default:
348                         _ao_lco_show_pad(ao_lco_pad);
349                         _ao_lco_show_box(ao_lco_box);
350                         ao_rect(&fb, SEP_X, 0, SEP_WIDTH, HEIGHT, AO_BLACK, AO_COPY);
351                 }
352                 break;
353         }
354         ao_st7565_update(&fb);
355         ao_mutex_put(&ao_lco_display_mutex);
356 }
357
358 static void
359 ao_lco_set_select(void)
360 {
361         if (ao_lco_armed) {
362                 ao_led_off(AO_LED_PAD);
363                 ao_led_off(AO_LED_BOX);
364         } else {
365                 switch (ao_lco_select_mode) {
366                 case AO_LCO_SELECT_PAD:
367                         ao_led_off(AO_LED_BOX);
368                         ao_led_on(AO_LED_PAD);
369                         break;
370                 case AO_LCO_SELECT_BOX:
371                         ao_led_off(AO_LED_PAD);
372                         ao_led_on(AO_LED_BOX);
373                         break;
374                 default:
375                         break;
376                 }
377         }
378 }
379
380
381 #if AO_LCO_HAS_CONTRAST
382 void
383 ao_lco_set_contrast(int32_t contrast)
384 {
385         ao_st7565_set_brightness((uint8_t) contrast);
386 }
387
388 int32_t
389 ao_lco_get_contrast(void)
390 {
391         return (int32_t) ao_st7565_get_brightness();
392 }
393 #endif
394
395 #if AO_LCO_HAS_BACKLIGHT
396 static uint16_t ao_backlight;
397
398 void
399 ao_lco_set_backlight(int32_t backlight)
400 {
401         ao_backlight = (uint16_t) backlight;
402         ao_pwm_set(AO_LCD_BL_PWM_CHAN, ao_backlight);
403 }
404
405 int32_t
406 ao_lco_get_backlight(void)
407 {
408         return (int32_t) ao_backlight;
409 }
410 #endif
411
412 static struct ao_task   ao_lco_drag_task;
413
414 static void
415 ao_lco_drag_monitor(void)
416 {
417         AO_TICK_TYPE    delay = ~0UL;
418         AO_TICK_TYPE    now;
419
420         ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
421         for (;;) {
422                 PRINTD("Drag monitor count %d delay %lu\n", ao_lco_drag_beep_count, (unsigned long) delay);
423                 if (delay == (AO_TICK_TYPE) ~0)
424                         ao_sleep(&ao_lco_drag_beep_count);
425                 else
426                         ao_sleep_for(&ao_lco_drag_beep_count, delay);
427
428                 delay = ~0UL;
429                 now = ao_time();
430                 delay = ao_lco_drag_warn_check(now, delay);
431                 delay = ao_lco_drag_beep_check(now, delay);
432         }
433 }
434
435 static void
436 ao_lco_input(void)
437 {
438         static struct ao_event  event;
439
440         for (;;) {
441                 ao_event_get(&event);
442                 PRINTE("event type %d unit %d value %ld\n",
443                        event.type, event.unit, (long) event.value);
444                 switch (event.type) {
445                 case AO_EVENT_QUADRATURE:
446                         switch (event.unit) {
447                         case AO_QUADRATURE_SELECT:
448                                 if (!ao_lco_armed) {
449                                         switch (ao_lco_select_mode) {
450                                         case AO_LCO_SELECT_PAD:
451                                                 ao_lco_step_pad((int8_t) event.value);
452                                                 break;
453                                         case AO_LCO_SELECT_BOX:
454                                                 ao_lco_step_box((int8_t) event.value);
455                                                 break;
456                                         default:
457                                                 break;
458                                         }
459                                 }
460                                 break;
461                         }
462                         break;
463                 case AO_EVENT_BUTTON:
464                         switch (event.unit) {
465                         case AO_BUTTON_ARM:
466                                 ao_lco_set_armed((uint8_t) event.value);
467                                 ao_lco_set_select();
468                                 break;
469                         case AO_BUTTON_FIRE:
470                                 if (ao_lco_armed)
471                                         ao_lco_set_firing((uint8_t) event.value);
472                                 break;
473                         case AO_BUTTON_DRAG_SELECT:
474                                 if (event.value)
475                                         ao_lco_toggle_drag();
476                                 break;
477                         case AO_BUTTON_DRAG_MODE:
478                                 if (event.value)
479                                         ao_lco_drag_enable();
480                                 else
481                                         ao_lco_drag_disable();
482                                 break;
483                         case AO_BUTTON_ENCODER_SELECT:
484                                 if (event.value) {
485                                         if (!ao_lco_armed) {
486                                                 ao_lco_select_mode = 1 - ao_lco_select_mode;
487                                                 ao_lco_set_select();
488                                         }
489                                 }
490                                 break;
491                         }
492                         break;
493                 }
494         }
495 }
496
497 /*
498  * Light up everything for a second at power on to let the user
499  * visually inspect the system for correct operation
500  */
501 static void
502 ao_lco_display_test(void)
503 {
504         ao_led_on(AO_LEDS_AVAILABLE);
505         ao_rect(&fb, 0, 0, WIDTH, HEIGHT, AO_BLACK, AO_COPY);
506         ao_st7565_update(&fb);
507         ao_delay(AO_MS_TO_TICKS(1000));
508         ao_led_off(AO_LEDS_AVAILABLE);
509 }
510
511 static struct ao_task ao_lco_input_task;
512 static struct ao_task ao_lco_monitor_task;
513 static struct ao_task ao_lco_data_task;
514 static struct ao_task ao_lco_arm_warn_task;
515 static struct ao_task ao_lco_igniter_status_task;
516
517 static int16_t  found_width;
518 #define MAX_FOUND       32
519 static int16_t  found_boxes[MAX_FOUND];
520 static uint8_t  nfound;
521
522 void
523 ao_lco_search_start(void)
524 {
525         ao_rect(&fb, 0, 0, WIDTH, HEIGHT, AO_WHITE, AO_COPY);
526         ao_logo(&fb, &logo_transform, &LOGO_FONT, AO_BLACK, AO_COPY);
527         _ao_center_text(SCANNING_X, SCANNING_Y, &TINY_FONT, "Scanning...");
528         found_width = 0;
529         nfound = 0;
530 }
531
532 void
533 ao_lco_search_box_check(int16_t box)
534 {
535         if (box > 0)
536                 ao_rect(&fb, SCAN_X, SCAN_Y, box, SCAN_HEIGHT, AO_BLACK, AO_COPY);
537         ao_st7565_update(&fb);
538 }
539
540 void
541 ao_lco_search_box_present(int16_t box)
542 {
543         char    str[8];
544         int16_t width;
545         int16_t box_top = FOUND_Y - TINY_FONT.ascent;
546         int16_t x;
547         uint8_t n;
548
549         snprintf(str, sizeof(str), "%s%u", nfound ? ", " : "", box);
550         width = ao_text_width(&TINY_FONT, str);
551         while (found_width + width > FOUND_WIDTH || nfound == MAX_FOUND)
552         {
553                 snprintf(str, sizeof(str), "%u, ", found_boxes[0]);
554                 found_width -= ao_text_width(&TINY_FONT, str);
555                 memmove(&found_boxes[0], &found_boxes[1], (nfound - 1) * sizeof (int16_t));
556                 nfound--;
557         }
558         found_boxes[nfound++] = box;
559
560         ao_rect(&fb, FOUND_X, FOUND_Y - TINY_FONT.ascent, FOUND_WIDTH, HEIGHT - box_top, AO_WHITE, AO_COPY);
561         x = FOUND_X;
562         for (n = 0; n < nfound; n++) {
563                 snprintf(str, sizeof(str), "%s%u", n ? ", " : "", found_boxes[n]);
564                 int16_t next_x = ao_text(&fb, &TINY_FONT, x, FOUND_Y, str, AO_BLACK, AO_COPY);
565                 x = next_x;
566         }
567         found_width = x - FOUND_X;
568 }
569
570 void
571 ao_lco_search_done(void)
572 {
573         ao_st7565_update(&fb);
574 }
575
576 static void
577 ao_lco_main(void)
578 {
579         ao_lco_display_test();
580         ao_lco_search();
581         ao_add_task(&ao_lco_input_task, ao_lco_input, "lco input");
582         ao_add_task(&ao_lco_arm_warn_task, ao_lco_arm_warn, "lco arm warn");
583         ao_add_task(&ao_lco_igniter_status_task, ao_lco_igniter_status, "lco igniter status");
584         ao_add_task(&ao_lco_drag_task, ao_lco_drag_monitor, "drag race");
585         ao_lco_monitor();
586 }
587
588 #if DEBUG
589 static void
590 ao_lco_set_debug(void)
591 {
592         uint32_t r = ao_cmd_decimal();
593         if (ao_cmd_status == ao_cmd_success){
594                 ao_lco_debug = r & 1;
595                 ao_lco_event_debug = (r & 2) >> 1;
596         }
597 }
598
599 const struct ao_cmds ao_lco_cmds[] = {
600         { ao_lco_set_debug,     "D <0 off, 1 on>\0Debug" },
601         { ao_lco_search,        "s\0Search for pad boxes" },
602         { ao_lco_pretend,       "p\0Pretend there are lots of pad boxes" },
603         { 0, NULL }
604 };
605 #endif
606
607 void
608 ao_lco_init(void)
609 {
610         ao_add_task(&ao_lco_monitor_task, ao_lco_main, "lco monitor");
611         ao_add_task(&ao_lco_data_task, ao_lco_data, "lco data");
612 #if DEBUG
613         ao_cmd_register(&ao_lco_cmds[0]);
614 #endif
615 }