Add preliminary aoview code
[fw/altos] / ao.h
1 /*
2  * Copyright © 2009 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; version 2 of the License
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #ifndef _AO_H_
19 #define _AO_H_
20
21 #include <stdint.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include "cc1111.h"
25
26 #define TRUE 1
27 #define FALSE 0
28
29 /* Convert a __data pointer into an __xdata pointer */
30 #define DATA_TO_XDATA(a)        ((void __xdata *) ((uint8_t) (a) | 0xff00))
31
32 /* Stack runs from above the allocated __data space to 0xfe, which avoids
33  * writing to 0xff as that triggers the stack overflow indicator
34  */
35 #define AO_STACK_START  0x80
36 #define AO_STACK_END    0xfe
37 #define AO_STACK_SIZE   (AO_STACK_END - AO_STACK_START + 1)
38
39 /* An AltOS task */
40 struct ao_task {
41         __xdata void *wchan;            /* current wait channel (NULL if running) */
42         uint8_t stack_count;            /* amount of saved stack */
43         uint8_t task_id;                /* index in the task array */
44         __code char *name;              /* task name */
45         uint8_t stack[AO_STACK_SIZE];   /* saved stack */
46 };
47
48 extern __xdata struct ao_task *__data ao_cur_task;
49
50 #define AO_NUM_TASKS            16      /* maximum number of tasks */
51 #define AO_NO_TASK              0       /* no task id */
52
53 /*
54  ao_task.c
55  */
56
57 /* Suspend the current task until wchan is awoken */
58 void
59 ao_sleep(__xdata void *wchan);
60
61 /* Wake all tasks sleeping on wchan */
62 void
63 ao_wakeup(__xdata void *wchan);
64
65 /* Yield the processor to another task */
66 void
67 ao_yield(void) _naked;
68
69 /* Add a task to the run queue */
70 void
71 ao_add_task(__xdata struct ao_task * task, void (*start)(void), __code char *name) __reentrant;
72
73 /* Dump task info to console */
74 void
75 ao_task_info(void);
76
77 /* Start the scheduler. This will not return */
78 void
79 ao_start_scheduler(void);
80
81 /*
82  * ao_panic.c
83  */
84
85 #define AO_PANIC_NO_TASK        1       /* AO_NUM_TASKS is not large enough */
86 #define AO_PANIC_DMA            2       /* Attempt to start DMA while active */
87 #define AO_PANIC_MUTEX          3       /* Mis-using mutex API */
88 #define AO_PANIC_EE             4       /* Mis-using eeprom API */
89 #define AO_PANIC_LOG            5       /* Failing to read/write log data */
90 #define AO_PANIC_CMD            6       /* Too many command sets registered */
91
92 /* Stop the operating system, beeping and blinking the reason */
93 void
94 ao_panic(uint8_t reason);
95
96 /*
97  * ao_timer.c
98  */
99
100 /* Our timer runs at 100Hz */
101 #define AO_MS_TO_TICKS(ms)      ((ms) / 10)
102 #define AO_SEC_TO_TICKS(s)      ((s) * 100)
103
104 /* Returns the current time in ticks */
105 uint16_t
106 ao_time(void);
107
108 /* Suspend the current task until ticks time has passed */
109 void
110 ao_delay(uint16_t ticks);
111
112 /* Set the ADC interval */
113 void
114 ao_timer_set_adc_interval(uint8_t interval) __critical;
115
116 /* Timer interrupt */
117 void
118 ao_timer_isr(void) interrupt 9;
119
120 /* Initialize the timer */
121 void
122 ao_timer_init(void);
123
124 /*
125  * ao_adc.c
126  */
127
128 #define AO_ADC_RING     64
129 #define ao_adc_ring_next(n)     (((n) + 1) & (AO_ADC_RING - 1))
130 #define ao_adc_ring_prev(n)     (((n) - 1) & (AO_ADC_RING - 1))
131
132 /*
133  * One set of samples read from the A/D converter
134  */
135 struct ao_adc {
136         uint16_t        tick;           /* tick when the sample was read */
137         int16_t         accel;          /* accelerometer */
138         int16_t         pres;           /* pressure sensor */
139         int16_t         temp;           /* temperature sensor */
140         int16_t         v_batt;         /* battery voltage */
141         int16_t         sense_d;        /* drogue continuity sense */
142         int16_t         sense_m;        /* main continuity sense */
143 };
144
145 /*
146  * A/D data is stored in a ring, with the next sample to be written
147  * at ao_adc_head
148  */
149 extern volatile __xdata struct ao_adc   ao_adc_ring[AO_ADC_RING];
150 extern volatile __data uint8_t          ao_adc_head;
151
152 /* Trigger a conversion sequence (called from the timer interrupt) */
153 void
154 ao_adc_poll(void);
155
156 /* Suspend the current task until another A/D sample is converted */
157 void
158 ao_adc_sleep(void);
159
160 /* Get a copy of the last complete A/D sample set */
161 void
162 ao_adc_get(__xdata struct ao_adc *packet);
163
164 /* The A/D interrupt handler */
165 #if !AO_NO_ADC_ISR
166 void
167 ao_adc_isr(void) interrupt 1;
168 #endif
169
170 /* Initialize the A/D converter */
171 void
172 ao_adc_init(void);
173
174 /*
175  * ao_beep.c
176  */
177
178 /*
179  * Various pre-defined beep frequencies
180  *
181  * frequency = 1/2 (24e6/32) / beep
182  */
183
184 #define AO_BEEP_LOW     150     /* 2500Hz */
185 #define AO_BEEP_MID     94      /* 3989Hz */
186 #define AO_BEEP_HIGH    75      /* 5000Hz */
187 #define AO_BEEP_OFF     0       /* off */
188
189 #define AO_BEEP_g       240     /* 1562.5Hz */
190 #define AO_BEEP_gs      227     /* 1652Hz (1655Hz) */
191 #define AO_BEEP_aa      214     /* 1752Hz (1754Hz) */
192 #define AO_BEEP_bbf     202     /* 1856Hz (1858Hz) */
193 #define AO_BEEP_bb      190     /* 1974Hz (1969Hz) */
194 #define AO_BEEP_cc      180     /* 2083Hz (2086Hz) */
195 #define AO_BEEP_ccs     170     /* 2205Hz (2210Hz) */
196 #define AO_BEEP_dd      160     /* 2344Hz (2341Hz) */
197 #define AO_BEEP_eef     151     /* 2483Hz (2480Hz) */
198 #define AO_BEEP_ee      143     /* 2622Hz (2628Hz) */
199 #define AO_BEEP_ff      135     /* 2778Hz (2784Hz) */
200 #define AO_BEEP_ffs     127     /* 2953Hz (2950Hz) */
201 #define AO_BEEP_gg      120     /* 3125Hz */
202 #define AO_BEEP_ggs     113     /* 3319Hz (3311Hz) */
203 #define AO_BEEP_aaa     107     /* 3504Hz (3508Hz) */
204 #define AO_BEEP_bbbf    101     /* 3713Hz (3716Hz) */
205 #define AO_BEEP_bbb     95      /* 3947Hz (3937Hz) */
206 #define AO_BEEP_ccc     90      /* 4167Hz (4171Hz) */
207 #define AO_BEEP_cccs    85      /* 4412Hz (4419Hz) */
208 #define AO_BEEP_ddd     80      /* 4688Hz (4682Hz) */
209 #define AO_BEEP_eeef    76      /* 4934Hz (4961Hz) */
210 #define AO_BEEP_eee     71      /* 5282Hz (5256Hz) */
211 #define AO_BEEP_fff     67      /* 5597Hz (5568Hz) */
212 #define AO_BEEP_fffs    64      /* 5859Hz (5899Hz) */
213 #define AO_BEEP_ggg     60      /* 6250Hz */
214
215 /* Set the beeper to the specified tone */
216 void
217 ao_beep(uint8_t beep);
218
219 /* Turn on the beeper for the specified time */
220 void
221 ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant;
222
223 /* Initialize the beeper */
224 void
225 ao_beep_init(void);
226
227 /*
228  * ao_led.c
229  */
230
231 #define AO_LED_NONE     0
232 #define AO_LED_GREEN    1
233 #define AO_LED_RED      2
234
235 /* Turn on the specified LEDs */
236 void
237 ao_led_on(uint8_t colors);
238
239 /* Turn off the specified LEDs */
240 void
241 ao_led_off(uint8_t colors);
242
243 /* Set all of the LEDs to the specified state */
244 void
245 ao_led_set(uint8_t colors);
246
247 /* Toggle the specified LEDs */
248 void
249 ao_led_toggle(uint8_t colors);
250
251 /* Turn on the specified LEDs for the indicated interval */
252 void
253 ao_led_for(uint8_t colors, uint16_t ticks) __reentrant;
254
255 /* Initialize the LEDs */
256 void
257 ao_led_init(uint8_t enable);
258
259 /*
260  * ao_usb.c
261  */
262
263 /* Put one character to the USB output queue */
264 void
265 ao_usb_putchar(char c);
266
267 /* Get one character from the USB input queue */
268 char
269 ao_usb_getchar(void);
270
271 /* Flush the USB output queue */
272 void
273 ao_usb_flush(void);
274
275 /* USB interrupt handler */
276 void
277 ao_usb_isr(void) interrupt 6;
278
279 /* Enable the USB controller */
280 void
281 ao_usb_enable(void);
282
283 /* Disable the USB controller */
284 void
285 ao_usb_disable(void);
286
287 /* Initialize the USB system */
288 void
289 ao_usb_init(void);
290
291 /*
292  * ao_cmd.c
293  */
294
295 enum ao_cmd_status {
296         ao_cmd_success = 0,
297         ao_cmd_lex_error = 1,
298         ao_cmd_syntax_error = 2,
299 };
300
301 extern __xdata uint16_t ao_cmd_lex_i;
302 extern __xdata char     ao_cmd_lex_c;
303 extern __xdata enum ao_cmd_status ao_cmd_status;
304
305 void
306 ao_cmd_lex(void);
307
308 void
309 ao_cmd_put8(uint8_t v);
310
311 void
312 ao_cmd_put16(uint16_t v);
313
314 void
315 ao_cmd_white(void);
316
317 void
318 ao_cmd_hex(void);
319
320 void
321 ao_cmd_decimal(void);
322
323 struct ao_cmds {
324         char            cmd;
325         void            (*func)(void);
326         const char      *help;
327 };
328
329 void
330 ao_cmd_register(__code struct ao_cmds *cmds);
331
332 void
333 ao_cmd_init(void);
334
335 /*
336  * ao_dma.c
337  */
338
339 /* Allocate a DMA channel. the 'done' parameter will be set to 1
340  * when the dma is finished and will be used to wakeup any waiters
341  */
342 uint8_t
343 ao_dma_alloc(__xdata uint8_t * done);
344
345 /* Setup a DMA channel */
346 void
347 ao_dma_set_transfer(uint8_t id,
348                     void __xdata *srcaddr,
349                     void __xdata *dstaddr,
350                     uint16_t count,
351                     uint8_t cfg0,
352                     uint8_t cfg1);
353
354 /* Start a DMA channel */
355 void
356 ao_dma_start(uint8_t id);
357
358 /* Manually trigger a DMA channel */
359 void
360 ao_dma_trigger(uint8_t id);
361
362 /* Abort a running DMA transfer */
363 void
364 ao_dma_abort(uint8_t id);
365
366 /* DMA interrupt routine */
367 void
368 ao_dma_isr(void) interrupt 8;
369
370 /*
371  * ao_mutex.c
372  */
373
374 void
375 ao_mutex_get(__xdata uint8_t *ao_mutex) __reentrant;
376
377 void
378 ao_mutex_put(__xdata uint8_t *ao_mutex) __reentrant;
379
380 /*
381  * ao_ee.c
382  */
383
384 /*
385  * We reserve the last block on the device for
386  * configuration space. Writes and reads in this
387  * area return errors.
388  */
389
390 #define AO_EE_BLOCK_SIZE        ((uint16_t) (256))
391 #define AO_EE_DEVICE_SIZE       ((uint32_t) 128 * (uint32_t) 1024)
392 #define AO_EE_DATA_SIZE         (AO_EE_DEVICE_SIZE - (uint32_t) AO_EE_BLOCK_SIZE)
393 #define AO_EE_CONFIG_BLOCK      ((uint16_t) (AO_EE_DATA_SIZE / AO_EE_BLOCK_SIZE))
394
395 void
396 ao_ee_flush(void) __reentrant;
397
398 /* Write to the eeprom */
399 uint8_t
400 ao_ee_write(uint32_t pos, uint8_t *buf, uint16_t len) __reentrant;
401
402 /* Read from the eeprom */
403 uint8_t
404 ao_ee_read(uint32_t pos, uint8_t *buf, uint16_t len) __reentrant;
405
406 /* Write the config block (at the end of the eeprom) */
407 uint8_t
408 ao_ee_write_config(uint8_t *buf, uint16_t len) __reentrant;
409
410 /* Read the config block (at the end of the eeprom) */
411 uint8_t
412 ao_ee_read_config(uint8_t *buf, uint16_t len) __reentrant;
413
414 /* Initialize the EEPROM code */
415 void
416 ao_ee_init(void);
417
418 /*
419  * ao_log.c
420  */
421
422 /* Structure containing GPS position, either lat or lon */
423
424 struct ao_gps_pos {
425         uint8_t degrees;
426         uint8_t minutes;
427         uint16_t minutes_fraction;      /* in units of 1/10000 minutes */
428 };
429
430 /*
431  * The data log is recorded in the eeprom as a sequence
432  * of data packets.
433  *
434  * Each packet starts with a 4-byte header that has the
435  * packet type, the packet checksum and the tick count. Then
436  * they all contain 2 16 bit values which hold packet-specific
437  * data.
438  *
439  * For each flight, the first packet
440  * is FLIGHT packet, indicating the serial number of the
441  * device and a unique number marking the number of flights
442  * recorded by this device.
443  *
444  * During flight, data from the accelerometer and barometer
445  * are recorded in SENSOR packets, using the raw 16-bit values
446  * read from the A/D converter.
447  *
448  * Also during flight, but at a lower rate, the deployment
449  * sensors are recorded in DEPLOY packets. The goal here is to
450  * detect failure in the deployment circuits.
451  *
452  * STATE packets hold state transitions as the flight computer
453  * transitions through different stages of the flight.
454  */
455 #define AO_LOG_FLIGHT           'F'
456 #define AO_LOG_SENSOR           'A'
457 #define AO_LOG_TEMP_VOLT        'T'
458 #define AO_LOG_DEPLOY           'D'
459 #define AO_LOG_STATE            'S'
460 #define AO_LOG_GPS_TIME         'G'
461 #define AO_LOG_GPS_LAT          'N'
462 #define AO_LOG_GPS_LON          'W'
463 #define AO_LOG_GPS_ALT          'H'
464
465 #define AO_LOG_POS_NONE         (~0UL)
466
467 struct ao_log_record {
468         char                    type;
469         uint8_t                 csum;
470         uint16_t                tick;
471         union {
472                 struct {
473                         int16_t         ground_accel;
474                         uint16_t        flight;
475                 } flight;
476                 struct {
477                         int16_t         accel;
478                         int16_t         pres;
479                 } sensor;
480                 struct {
481                         int16_t         temp;
482                         int16_t         v_batt;
483                 } temp_volt;
484                 struct {
485                         int16_t         drogue;
486                         int16_t         main;
487                 } deploy;
488                 struct {
489                         uint16_t        state;
490                         uint16_t        reason;
491                 } state;
492                 struct {
493                         uint8_t         hour;
494                         uint8_t         minute;
495                         uint8_t         second;
496                         uint8_t         flags;
497                 } gps_time;
498                 struct ao_gps_pos gps_latitude;
499                 struct ao_gps_pos gps_longitude;
500                 struct {
501                         int16_t         altitude;
502                         uint16_t        unused;
503                 } gps_altitude;
504                 struct {
505                         uint16_t        d0;
506                         uint16_t        d1;
507                 } anon;
508         } u;
509 };
510
511 /* Write a record to the eeprom log */
512 void
513 ao_log_data(struct ao_log_record *log);
514
515 /* Flush the log */
516 void
517 ao_log_flush(void);
518
519 /* Log dumping API:
520  * ao_log_dump_first() - get first log record
521  * ao_log_dump_next()  - get next log record
522  */
523 extern __xdata struct ao_log_record ao_log_dump;
524
525 /* Retrieve first log record for the current flight */
526 uint8_t
527 ao_log_dump_first(void);
528
529 /* return next log record for the current flight */
530 uint8_t
531 ao_log_dump_next(void);
532
533 /* Logging thread main routine */
534 void
535 ao_log(void);
536
537 /* Start logging to eeprom */
538 void
539 ao_log_start(void);
540
541 /* Stop logging */
542 void
543 ao_log_stop(void);
544
545 /* Initialize the logging system */
546 void
547 ao_log_init(void);
548
549 /*
550  * ao_flight.c
551  */
552
553 enum ao_flight_state {
554         ao_flight_startup = 0,
555         ao_flight_idle = 1,
556         ao_flight_launchpad = 2,
557         ao_flight_boost = 3,
558         ao_flight_coast = 4,
559         ao_flight_apogee = 5,
560         ao_flight_drogue = 6,
561         ao_flight_main = 7,
562         ao_flight_landed = 8,
563         ao_flight_invalid = 9
564 };
565
566 extern __xdata struct ao_adc            ao_flight_data;
567 extern __pdata enum ao_flight_state     ao_flight_state;
568 extern __pdata uint16_t                 ao_flight_tick;
569 extern __pdata int16_t                  ao_flight_accel;
570 extern __pdata int16_t                  ao_flight_pres;
571 extern __pdata int16_t                  ao_ground_pres;
572 extern __pdata int16_t                  ao_ground_accel;
573 extern __pdata int16_t                  ao_min_pres;
574 extern __pdata uint16_t                 ao_launch_time;
575
576 /* Flight thread */
577 void
578 ao_flight(void);
579
580 /* Initialize flight thread */
581 void
582 ao_flight_init(void);
583
584 /*
585  * ao_report.c
586  */
587
588 void
589 ao_report_init(void);
590
591 /*
592  * ao_convert.c
593  *
594  * Given raw data, convert to SI units
595  */
596
597 /* pressure from the sensor to altitude in meters */
598 int16_t
599 ao_pres_to_altitude(int16_t pres) __reentrant;
600
601 int16_t
602 ao_altitude_to_pres(int16_t alt) __reentrant;
603
604 int16_t
605 ao_temp_to_dC(int16_t temp) __reentrant;
606
607 /*
608  * ao_dbg.c
609  *
610  * debug another telemetrum board
611  */
612
613 /* Send a byte to the dbg target */
614 void
615 ao_dbg_send_byte(uint8_t byte);
616
617 /* Receive a byte from the dbg target */
618 uint8_t
619 ao_dbg_recv_byte(void);
620
621 /* Start a bulk transfer to/from dbg target memory */
622 void
623 ao_dbg_start_transfer(uint16_t addr);
624
625 /* End a bulk transfer to/from dbg target memory */
626 void
627 ao_dbg_end_transfer(void);
628
629 /* Write a byte to dbg target memory */
630 void
631 ao_dbg_write_byte(uint8_t byte);
632
633 /* Read a byte from dbg target memory */
634 uint8_t
635 ao_dbg_read_byte(void);
636
637 /* Enable dbg mode, switching use of the pins */
638 void
639 ao_dbg_debug_mode(void);
640
641 /* Reset the dbg target */
642 void
643 ao_dbg_reset(void);
644
645 void
646 ao_dbg_init(void);
647
648 /*
649  * ao_serial.c
650  */
651
652 #if !AO_NO_SERIAL_ISR
653 void
654 ao_serial_rx1_isr(void) interrupt 3;
655
656 void
657 ao_serial_tx1_isr(void) interrupt 14;
658 #endif
659
660 char
661 ao_serial_getchar(void) __critical;
662
663 void
664 ao_serial_putchar(char c) __critical;
665
666 void
667 ao_serial_init(void);
668
669 /*
670  * ao_gps.c
671  */
672
673 #define AO_GPS_NUM_SAT_MASK     (0xf << 0)
674 #define AO_GPS_NUM_SAT_SHIFT    (0)
675
676 #define AO_GPS_VALID            (1 << 4)
677 #define AO_GPS_LONGITUDE_MASK   (1 << 5)
678 #define AO_GPS_LONGITUDE_EAST   (0 << 5)
679 #define AO_GPS_LONGITUDE_WEST   (1 << 5)
680
681 #define AO_GPS_LATITUDE_MASK    (1 << 6)
682 #define AO_GPS_LATITUDE_NORTH   (0 << 6)
683 #define AO_GPS_LATITUDE_SOUTH   (1 << 6)
684
685 struct ao_gps_data {
686         uint8_t                 hour;
687         uint8_t                 minute;
688         uint8_t                 second;
689         uint8_t                 flags;
690         struct ao_gps_pos       latitude;
691         struct ao_gps_pos       longitude;
692         int16_t                 altitude;
693 };
694
695 extern __xdata uint8_t ao_gps_mutex;
696 extern __xdata struct ao_gps_data ao_gps_data;
697
698 void
699 ao_gps(void);
700
701 void
702 ao_gps_print(__xdata struct ao_gps_data *gps_data);
703
704 void
705 ao_gps_init(void);
706
707 /*
708  * ao_gps_report.c
709  */
710
711 void
712 ao_gps_report(void);
713
714 void
715 ao_gps_report_init(void);
716
717 /*
718  * ao_telemetry.c
719  */
720
721 #define AO_MAX_CALLSIGN         8
722
723 struct ao_telemetry {
724         uint8_t                 addr;
725         uint8_t                 flight_state;
726         struct ao_adc           adc;
727         struct ao_gps_data      gps;
728         char                    callsign[AO_MAX_CALLSIGN];
729 };
730
731 /* Set delay between telemetry reports (0 to disable) */
732
733 #define AO_TELEMETRY_INTERVAL_PAD       AO_MS_TO_TICKS(1000)
734 #define AO_TELEMETRY_INTERVAL_FLIGHT    AO_MS_TO_TICKS(50)
735 #define AO_TELEMETRY_INTERVAL_RECOVER   AO_MS_TO_TICKS(1000)
736
737 void
738 ao_telemetry_set_interval(uint16_t interval);
739
740 void
741 ao_rdf_set(uint8_t rdf);
742
743 void
744 ao_telemetry_init(void);
745
746 /*
747  * ao_radio.c
748  */
749
750 void
751 ao_radio_send(__xdata struct ao_telemetry *telemetry) __reentrant;
752
753 struct ao_radio_recv {
754         struct ao_telemetry     telemetry;
755         int8_t                  rssi;
756         uint8_t                 status;
757 };
758
759 void
760 ao_radio_recv(__xdata struct ao_radio_recv *recv) __reentrant;
761
762 void
763 ao_radio_rdf(void);
764
765 void
766 ao_radio_rdf_abort(void);
767
768 void
769 ao_radio_init(void);
770
771 /*
772  * ao_monitor.c
773  */
774
775 extern const char const * const ao_state_names[];
776
777 void
778 ao_monitor(void);
779
780 void
781 ao_set_monitor(uint8_t monitoring);
782
783 void
784 ao_monitor_init(uint8_t led, uint8_t monitoring) __reentrant;
785
786 /*
787  * ao_stdio.c
788  */
789
790 void
791 flush(void);
792
793 /*
794  * ao_ignite.c
795  */
796
797 enum ao_igniter {
798         ao_igniter_drogue = 0,
799         ao_igniter_main = 1
800 };
801
802 void
803 ao_ignite(enum ao_igniter igniter);
804
805 enum ao_igniter_status {
806         ao_igniter_unknown,     /* unknown status (ambiguous voltage) */
807         ao_igniter_ready,       /* continuity detected */
808         ao_igniter_active,      /* igniter firing */
809         ao_igniter_open,        /* open circuit detected */
810 };
811
812 enum ao_igniter_status
813 ao_igniter_status(enum ao_igniter igniter);
814
815 void
816 ao_igniter_init(void);
817
818 /*
819  * ao_config.c
820  */
821
822 #define AO_CONFIG_MAJOR 1
823 #define AO_CONFIG_MINOR 0
824
825 struct ao_config {
826         uint8_t         major;
827         uint8_t         minor;
828         uint16_t        main_deploy;
829         int16_t         accel_zero_g;
830         uint8_t         radio_channel;
831         char            callsign[AO_MAX_CALLSIGN + 1];
832 };
833
834 extern __xdata struct ao_config ao_config;
835
836 void
837 ao_config_get(void);
838
839 void
840 ao_config_init(void);
841
842 /*
843  * ao_rssi.c
844  */
845
846 void
847 ao_rssi_set(int rssi_value);
848
849 void
850 ao_rssi_init(uint8_t rssi_led);
851
852 /*
853  * ao_product.c
854  *
855  * values which need to be defined for
856  * each instance of a product
857  */
858
859 extern const uint8_t ao_usb_descriptors [];
860 extern const uint16_t ao_serial_number;
861 extern const char ao_version[];
862 extern const char ao_manufacturer[];
863 extern const char ao_product[];
864
865 #endif /* _AO_H_ */