Merge branch 'easymotor-v3'
[fw/altos] / ao-tools / lib / ao-eeprom-read.h
1 /*
2  * Copyright © 2017 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
15 #ifndef _AO_EEPROM_READ_H_
16 #define _AO_EEPROM_READ_H_
17
18 #include <stdint.h>
19 #include <stdio.h>
20 #include <ao-ms5607.h>
21
22 #define AO_MAX_CALLSIGN 8
23 #define AO_AES_LEN      16
24 #define AO_PYRO_NUM     8
25
26 /* required functions from the underlying log system */
27
28 #define AO_LOG_FORMAT_UNKNOWN           0       /* unknown; altosui will have to guess */
29 #define AO_LOG_FORMAT_FULL              1       /* 8 byte typed log records */
30 #define AO_LOG_FORMAT_TINY              2       /* two byte state/baro records */
31 #define AO_LOG_FORMAT_TELEMETRY         3       /* 32 byte ao_telemetry records */
32 #define AO_LOG_FORMAT_TELESCIENCE       4       /* 32 byte typed telescience records */
33 #define AO_LOG_FORMAT_TELEMEGA_OLD      5       /* 32 byte typed telemega records */
34 #define AO_LOG_FORMAT_EASYMINI1         6       /* 16-byte MS5607 baro only, 3.0V supply */
35 #define AO_LOG_FORMAT_TELEMETRUM        7       /* 16-byte typed telemetrum records */
36 #define AO_LOG_FORMAT_TELEMINI2         8       /* 16-byte MS5607 baro only, 3.3V supply, cc1111 SoC */
37 #define AO_LOG_FORMAT_TELEGPS           9       /* 32 byte telegps records */
38 #define AO_LOG_FORMAT_TELEMEGA          10      /* 32 byte typed telemega records with 32 bit gyro cal */
39 #define AO_LOG_FORMAT_DETHERM           11      /* 16-byte MS5607 baro only, no ADC */
40 #define AO_LOG_FORMAT_TELEMINI3         12      /* 16-byte MS5607 baro only, 3.3V supply, stm32f042 SoC */
41 #define AO_LOG_FORMAT_TELEFIRETWO       13      /* 32-byte test stand data */
42 #define AO_LOG_FORMAT_EASYMINI2         14      /* 16-byte MS5607 baro only, 3.3V supply, stm32f042 SoC */
43 #define AO_LOG_FORMAT_TELEMEGA_3        15      /* 32 byte typed telemega records with 32 bit gyro cal and mpu9250 */
44 #define AO_LOG_FORMAT_EASYMEGA_2        16      /* 32 byte typed telemega records with 32 bit gyro cal, mpu9250 rotated 90° and adxl375 */
45 #define AO_LOG_FORMAT_TELESTATIC        17      /* 32 byte typed telestatic records */
46 #define AO_LOG_FORMAT_MICROPEAK2        18      /* 2-byte baro values with header */
47 #define AO_LOG_FORMAT_TELEMEGA_4        19      /* 32 byte typed telemega records with 32 bit gyro cal and Bmx160 */
48 #define AO_LOG_FORMAT_EASYMOTOR         20      /* 16 byte typed easymotor records with pressure sensor and adxl375 */
49 #define AO_LOG_FORMAT_NONE              127     /* No log at all */
50
51 enum ao_pyro_flag {
52         ao_pyro_none                    = 0x00000000,
53
54         ao_pyro_accel_less              = 0x00000001,
55         ao_pyro_accel_greater           = 0x00000002,
56
57         ao_pyro_speed_less              = 0x00000004,
58         ao_pyro_speed_greater           = 0x00000008,
59
60         ao_pyro_height_less             = 0x00000010,
61         ao_pyro_height_greater          = 0x00000020,
62
63         ao_pyro_orient_less             = 0x00000040,
64         ao_pyro_orient_greater          = 0x00000080,
65
66         ao_pyro_time_less               = 0x00000100,
67         ao_pyro_time_greater            = 0x00000200,
68
69         ao_pyro_ascending               = 0x00000400,
70         ao_pyro_descending              = 0x00000800,
71
72         ao_pyro_after_motor             = 0x00001000,
73
74         ao_pyro_delay                   = 0x00002000,
75
76         ao_pyro_state_less              = 0x00004000,
77         ao_pyro_state_greater_or_equal  = 0x00008000,
78 };
79
80 struct ao_pyro {
81         enum ao_pyro_flag       flags;
82         int16_t                 accel_less, accel_greater;
83         int16_t                 speed_less, speed_greater;
84         int16_t                 height_less, height_greater;
85         int16_t                 orient_less, orient_greater;
86         int16_t                 time_less, time_greater;
87         int16_t                 delay;
88         uint8_t                 state_less, state_greater_or_equal;
89         int16_t                 motor;
90         uint16_t                delay_done;
91         uint8_t                 _unused;        /* was 'fired' */
92 };
93
94 struct ao_config {
95         uint8_t         major;
96         uint8_t         minor;
97         uint16_t        main_deploy;
98         int16_t         accel_plus_g;           /* changed for minor version 2 */
99         uint8_t         _legacy_radio_channel;
100         char            callsign[AO_MAX_CALLSIGN + 1];
101         uint8_t         apogee_delay;           /* minor version 1 */
102         int16_t         accel_minus_g;          /* minor version 2 */
103         uint32_t        radio_cal;              /* minor version 3 */
104         uint32_t        flight_log_max;         /* minor version 4 */
105         uint8_t         ignite_mode;            /* minor version 5 */
106         uint8_t         pad_orientation;        /* minor version 6 */
107         uint32_t        radio_setting;          /* minor version 7 */
108         uint8_t         radio_enable;           /* minor version 8 */
109         uint8_t         aes_key[AO_AES_LEN];    /* minor version 9 */
110         uint32_t        frequency;              /* minor version 10 */
111         uint16_t        apogee_lockout;         /* minor version 11 */
112         struct ao_pyro  pyro[AO_PYRO_NUM];      /* minor version 12 */
113         uint16_t        aprs_interval;          /* minor version 13 */
114         uint8_t         radio_power;            /* minor version 14 */
115         uint8_t         radio_amp;              /* minor version 14 */
116         int16_t         accel_zero_along;       /* minor version 15 */
117         int16_t         accel_zero_across;      /* minor version 15 */
118         int16_t         accel_zero_through;     /* minor version 15 */
119         uint8_t         mid_beep;               /* minor version 16 */
120         uint16_t        tracker_motion;         /* minor version 17 */
121         uint8_t         tracker_interval;       /* minor version 17 */
122         uint16_t        pyro_time;              /* minor version 18 */
123         uint8_t         aprs_ssid;              /* minor version 19 */
124         uint8_t         radio_rate;             /* minor version 20 */
125         uint32_t        send_frequency;         /* minor version 21 */
126         uint8_t         aprs_format;            /* minor version 22 */
127         uint8_t         pad_box;                /* minor version 22 */
128         uint8_t         pad_idle;               /* minor version 23 */
129 };
130
131 /*
132  * ao_log_big.c
133  */
134
135 /*
136  * The data log is recorded in the eeprom as a sequence
137  * of data packets.
138  *
139  * Each packet starts with a 4-byte header that has the
140  * packet type, the packet checksum and the tick count. Then
141  * they all contain 2 16 bit values which hold packet-specific
142  * data.
143  *
144  * For each flight, the first packet
145  * is FLIGHT packet, indicating the serial number of the
146  * device and a unique number marking the number of flights
147  * recorded by this device.
148  *
149  * During flight, data from the accelerometer and barometer
150  * are recorded in SENSOR packets, using the raw 16-bit values
151  * read from the A/D converter.
152  *
153  * Also during flight, but at a lower rate, the deployment
154  * sensors are recorded in DEPLOY packets. The goal here is to
155  * detect failure in the deployment circuits.
156  *
157  * STATE packets hold state transitions as the flight computer
158  * transitions through different stages of the flight.
159  */
160 #define AO_LOG_FLIGHT           'F'
161 #define AO_LOG_SENSOR           'A'
162 #define AO_LOG_TEMP_VOLT        'T'
163 #define AO_LOG_DEPLOY           'D'
164 #define AO_LOG_STATE            'S'
165 #define AO_LOG_GPS_TIME         'G'
166 #define AO_LOG_GPS_LAT          'N'
167 #define AO_LOG_GPS_LON          'W'
168 #define AO_LOG_GPS_ALT          'H'
169 #define AO_LOG_GPS_SAT          'V'
170 #define AO_LOG_GPS_DATE         'Y'
171 #define AO_LOG_GPS_POS          'P'
172
173 #define AO_LOG_POS_NONE         (~0UL)
174
175 /* Common header in all log formats */
176 struct ao_log_header {
177         char                    type;                           /* 0 */
178         uint8_t                 csum;                           /* 1 */
179         uint16_t                tick;                           /* 2 */
180 };
181
182 struct ao_log_record {
183         char                    type;                           /* 0 */
184         uint8_t                 csum;                           /* 1 */
185         uint16_t                tick;                           /* 2 */
186         union {
187                 struct {
188                         int16_t         ground_accel;           /* 4 */
189                         uint16_t        flight;                 /* 6 */
190                 } flight;
191                 struct {
192                         int16_t         accel;                  /* 4 */
193                         int16_t         pres;                   /* 6 */
194                 } sensor;
195                 struct {
196                         int16_t         temp;
197                         int16_t         v_batt;
198                 } temp_volt;
199                 struct {
200                         int16_t         drogue;
201                         int16_t         main;
202                 } deploy;
203                 struct {
204                         uint16_t        state;
205                         uint16_t        reason;
206                 } state;
207                 struct {
208                         uint8_t         hour;
209                         uint8_t         minute;
210                         uint8_t         second;
211                         uint8_t         flags;
212                 } gps_time;
213                 int32_t         gps_latitude;
214                 int32_t         gps_longitude;
215                 struct {
216                         uint16_t        altitude_low;
217                         int16_t         altitude_high;
218                 } gps_altitude;
219                 struct {
220                         uint16_t        svid;
221                         uint8_t         unused;
222                         uint8_t         c_n;
223                 } gps_sat;
224                 struct {
225                         uint8_t         year;
226                         uint8_t         month;
227                         uint8_t         day;
228                         uint8_t         extra;
229                 } gps_date;
230                 struct {
231                         uint16_t        d0;
232                         uint16_t        d1;
233                 } anon;
234         } u;
235 };
236
237 struct ao_log_mega {
238         char                    type;                   /* 0 */
239         uint8_t                 csum;                   /* 1 */
240         uint16_t                tick;                   /* 2 */
241         union {                                         /* 4 */
242                 /* AO_LOG_FLIGHT */
243                 struct {
244                         uint16_t        flight;                 /* 4 */
245                         int16_t         ground_accel;           /* 6 */
246                         uint32_t        ground_pres;            /* 8 */
247                         int16_t         ground_accel_along;     /* 12 */
248                         int16_t         ground_accel_across;    /* 14 */
249                         int16_t         ground_accel_through;   /* 16 */
250                         int16_t         pad_18;                 /* 18 */
251                         int32_t         ground_roll;            /* 20 */
252                         int32_t         ground_pitch;           /* 24 */
253                         int32_t         ground_yaw;             /* 28 */
254                 } flight;                                       /* 32 */
255                 struct {
256                         uint16_t        flight;                 /* 4 */
257                         int16_t         ground_accel;           /* 6 */
258                         uint32_t        ground_pres;            /* 8 */
259                         int16_t         ground_accel_along;     /* 12 */
260                         int16_t         ground_accel_across;    /* 14 */
261                         int16_t         ground_accel_through;   /* 16 */
262                         int16_t         ground_roll;            /* 18 */
263                         int16_t         ground_pitch;           /* 20 */
264                         int16_t         ground_yaw;             /* 22 */
265                 } flight_old;                                   /* 24 */
266                 /* AO_LOG_STATE */
267                 struct {
268                         uint16_t        state;
269                         uint16_t        reason;
270                 } state;
271                 /* AO_LOG_SENSOR */
272                 struct {
273                         uint32_t        pres;           /* 4 */
274                         uint32_t        temp;           /* 8 */
275                         int16_t         accel_x;        /* 12 */
276                         int16_t         accel_y;        /* 14 */
277                         int16_t         accel_z;        /* 16 */
278                         int16_t         gyro_x;         /* 18 */
279                         int16_t         gyro_y;         /* 20 */
280                         int16_t         gyro_z;         /* 22 */
281                         int16_t         mag_x;          /* 24 */
282                         int16_t         mag_z;          /* 26 */
283                         int16_t         mag_y;          /* 28 */
284                         int16_t         accel;          /* 30 */
285                 } sensor;       /* 32 */
286                 /* AO_LOG_TEMP_VOLT */
287                 struct {
288                         int16_t         v_batt;         /* 4 */
289                         int16_t         v_pbatt;        /* 6 */
290                         int16_t         n_sense;        /* 8 */
291                         int16_t         sense[10];      /* 10 */
292                         uint16_t        pyro;           /* 30 */
293                 } volt;                                 /* 32 */
294                 /* AO_LOG_GPS_TIME */
295                 struct {
296                         int32_t         latitude;       /* 4 */
297                         int32_t         longitude;      /* 8 */
298                         uint16_t        altitude_low;   /* 12 */
299                         uint8_t         hour;           /* 14 */
300                         uint8_t         minute;         /* 15 */
301                         uint8_t         second;         /* 16 */
302                         uint8_t         flags;          /* 17 */
303                         uint8_t         year;           /* 18 */
304                         uint8_t         month;          /* 19 */
305                         uint8_t         day;            /* 20 */
306                         uint8_t         course;         /* 21 */
307                         uint16_t        ground_speed;   /* 22 */
308                         int16_t         climb_rate;     /* 24 */
309                         uint8_t         pdop;           /* 26 */
310                         uint8_t         hdop;           /* 27 */
311                         uint8_t         vdop;           /* 28 */
312                         uint8_t         mode;           /* 29 */
313                         int16_t         altitude_high;  /* 30 */
314                 } gps;  /* 32 */
315                 /* AO_LOG_GPS_SAT */
316                 struct {
317                         uint16_t        channels;       /* 4 */
318                         struct {
319                                 uint8_t svid;
320                                 uint8_t c_n;
321                         } sats[12];                     /* 6 */
322                 } gps_sat;                              /* 30 */
323         } u;
324 };
325
326 #define AO_LOG_MEGA_GPS_ALTITUDE(l)     ((int32_t) ((l)->u.gps.altitude_high << 16) | ((l)->u.gps.altitude_low))
327 #define AO_LOG_MEGA_SET_GPS_ALTITUDE(l,a)       (((l)->u.gps.mode |= AO_GPS_MODE_ALTITUDE_24), \
328                                                  ((l)->u.gps.altitude_high = (a) >> 16), \
329                                                  (l)->u.gps.altitude_low = (a))
330
331 struct ao_log_firetwo {
332         char                    type;                   /* 0 */
333         uint8_t                 csum;                   /* 1 */
334         uint16_t                tick;                   /* 2 */
335         union {                                         /* 4 */
336                 /* AO_LOG_FLIGHT */
337                 struct {
338                         uint16_t        flight;         /* 4 */
339                 } flight;       /* 6 */
340                 /* AO_LOG_STATE */
341                 struct {
342                         uint16_t        state;          /* 4 */
343                         uint16_t        reason;         /* 6 */
344                 } state;        /* 8 */
345                 /* AO_LOG_SENSOR */
346                 struct {
347                         uint16_t        pressure;       /* 4 */
348                         uint16_t        thrust;         /* 6 */
349                         uint16_t        thermistor[4];  /* 8 */
350                 } sensor;       /* 24 */
351                 uint8_t         align[28];              /* 4 */
352         } u;    /* 32 */
353 };
354
355 struct ao_log_telestatic {
356         char                    type;                   /* 0 */
357         uint8_t                 csum;                   /* 1 */
358         uint16_t                tick;                   /* 2 */
359         union {                                         /* 4 */
360                 /* AO_LOG_FLIGHT */
361                 struct {
362                         uint16_t        flight;         /* 4 */
363                 } flight;       /* 6 */
364                 /* AO_LOG_STATE */
365                 struct {
366                         uint16_t        state;          /* 4 */
367                         uint16_t        reason;         /* 6 */
368                 } state;        /* 8 */
369                 /* AO_LOG_SENSOR */
370                 struct {
371                         uint32_t        pressure;       /* 4 */
372                         uint32_t        pressure2;      /* 8 */
373                         uint32_t        thrust;         /* 12 */
374                         uint32_t        mass;           /* 16 */
375                         uint16_t        t_low;          /* 20 */
376                         uint16_t        t_high[4];      /* 22 */
377                 } sensor;       /* 30 */
378                 uint8_t         align[28];              /* 4 */
379         } u;    /* 32 */
380 };
381
382 struct ao_log_metrum {
383         char                    type;                   /* 0 */
384         uint8_t                 csum;                   /* 1 */
385         uint16_t                tick;                   /* 2 */
386         union {                                         /* 4 */
387                 /* AO_LOG_FLIGHT */
388                 struct {
389                         uint16_t        flight;         /* 4 */
390                         int16_t         ground_accel;   /* 6 */
391                         uint32_t        ground_pres;    /* 8 */
392                         uint32_t        ground_temp;    /* 12 */
393                 } flight;       /* 16 */
394                 /* AO_LOG_STATE */
395                 struct {
396                         uint16_t        state;          /* 4 */
397                         uint16_t        reason;         /* 6 */
398                 } state;        /* 8 */
399                 /* AO_LOG_SENSOR */
400                 struct {
401                         uint32_t        pres;           /* 4 */
402                         uint32_t        temp;           /* 8 */
403                         int16_t         accel;          /* 12 */
404                 } sensor;       /* 14 */
405                 /* AO_LOG_TEMP_VOLT */
406                 struct {
407                         int16_t         v_batt;         /* 4 */
408                         int16_t         sense_a;        /* 6 */
409                         int16_t         sense_m;        /* 8 */
410                 } volt;         /* 10 */
411                 /* AO_LOG_GPS_POS */
412                 struct {
413                         int32_t         latitude;       /* 4 */
414                         int32_t         longitude;      /* 8 */
415                         uint16_t        altitude_low;   /* 12 */
416                         int16_t         altitude_high;  /* 14 */
417                 } gps;          /* 16 */
418                 /* AO_LOG_GPS_TIME */
419                 struct {
420                         uint8_t         hour;           /* 4 */
421                         uint8_t         minute;         /* 5 */
422                         uint8_t         second;         /* 6 */
423                         uint8_t         flags;          /* 7 */
424                         uint8_t         year;           /* 8 */
425                         uint8_t         month;          /* 9 */
426                         uint8_t         day;            /* 10 */
427                         uint8_t         pdop;           /* 11 */
428                 } gps_time;     /* 12 */
429                 /* AO_LOG_GPS_SAT (up to three packets) */
430                 struct {
431                         uint8_t channels;               /* 4 */
432                         uint8_t more;                   /* 5 */
433                         struct {
434                                 uint8_t svid;
435                                 uint8_t c_n;
436                         } sats[4];                      /* 6 */
437                 } gps_sat;                              /* 14 */
438                 uint8_t         raw[12];                /* 4 */
439         } u;    /* 16 */
440 };
441
442 struct ao_log_mini {
443         char            type;                           /* 0 */
444         uint8_t         csum;                           /* 1 */
445         uint16_t        tick;                           /* 2 */
446         union {                                         /* 4 */
447                 /* AO_LOG_FLIGHT */
448                 struct {
449                         uint16_t        flight;         /* 4 */
450                         uint16_t        r6;
451                         uint32_t        ground_pres;    /* 8 */
452                 } flight;
453                 /* AO_LOG_STATE */
454                 struct {
455                         uint16_t        state;          /* 4 */
456                         uint16_t        reason;         /* 6 */
457                 } state;
458                 /* AO_LOG_SENSOR */
459                 struct {
460                         uint8_t         pres[3];        /* 4 */
461                         uint8_t         temp[3];        /* 7 */
462                         int16_t         sense_a;        /* 10 */
463                         int16_t         sense_m;        /* 12 */
464                         int16_t         v_batt;         /* 14 */
465                 } sensor;                               /* 16 */
466         } u;                                            /* 16 */
467 };                                                      /* 16 */
468
469 struct ao_log_motor {
470         char                    type;                   /* 0 */
471         uint8_t                 csum;                   /* 1 */
472         uint16_t                tick;                   /* 2 */
473         union {                                         /* 4 */
474                 /* AO_LOG_FLIGHT */
475                 struct {
476                         uint16_t        flight;                 /* 4 */
477                         int16_t         ground_accel;           /* 6 */
478                         int16_t         ground_accel_along;     /* 8 */
479                         int16_t         ground_accel_across;    /* 10 */
480                         int16_t         ground_accel_through;   /* 12 */
481                         int16_t         ground_motor_pressure;  /* 14 */
482                 } flight;                                       /* 16 */
483                 /* AO_LOG_STATE */
484                 struct {
485                         uint16_t        state;                  /* 4 */
486                         uint16_t        reason;                 /* 6 */
487                 } state;
488                 /* AO_LOG_SENSOR */
489                 struct {
490                         uint16_t        pressure;               /* 4 */
491                         uint16_t        v_batt;                 /* 6 */
492                         int16_t         accel;                  /* 8 */
493                         int16_t         accel_across;           /* 10 */
494                         int16_t         accel_along;            /* 12 */
495                         int16_t         accel_through;          /* 14 */
496                 } sensor;                                       /* 16 */
497         } u;
498 };
499
500 #define ao_log_pack24(dst,value) do {           \
501                 (dst)[0] = (value);             \
502                 (dst)[1] = (value) >> 8;        \
503                 (dst)[2] = (value) >> 16;       \
504         } while (0)
505
506 struct ao_log_gps {
507         char                    type;                   /* 0 */
508         uint8_t                 csum;                   /* 1 */
509         uint16_t                tick;                   /* 2 */
510         union {                                         /* 4 */
511                 /* AO_LOG_FLIGHT */
512                 struct {
513                         uint16_t        flight;                 /* 4 */
514                         int16_t         start_altitude;         /* 6 */
515                         int32_t         start_latitude;         /* 8 */
516                         int32_t         start_longitude;        /* 12 */
517                 } flight;                                       /* 16 */
518                 /* AO_LOG_GPS_TIME */
519                 struct {
520                         int32_t         latitude;       /* 4 */
521                         int32_t         longitude;      /* 8 */
522                         uint16_t        altitude_low;   /* 12 */
523                         uint8_t         hour;           /* 14 */
524                         uint8_t         minute;         /* 15 */
525                         uint8_t         second;         /* 16 */
526                         uint8_t         flags;          /* 17 */
527                         uint8_t         year;           /* 18 */
528                         uint8_t         month;          /* 19 */
529                         uint8_t         day;            /* 20 */
530                         uint8_t         course;         /* 21 */
531                         uint16_t        ground_speed;   /* 22 */
532                         int16_t         climb_rate;     /* 24 */
533                         uint8_t         pdop;           /* 26 */
534                         uint8_t         hdop;           /* 27 */
535                         uint8_t         vdop;           /* 28 */
536                         uint8_t         mode;           /* 29 */
537                         int16_t         altitude_high;  /* 30 */
538                 } gps;  /* 31 */
539                 /* AO_LOG_GPS_SAT */
540                 struct {
541                         uint16_t        channels;       /* 4 */
542                         struct {
543                                 uint8_t svid;
544                                 uint8_t c_n;
545                         } sats[12];                     /* 6 */
546                 } gps_sat;                              /* 30 */
547         } u;
548 };
549
550 struct ao_log_motor {
551         char                    type;                   /* 0 */
552         uint8_t                 csum;                   /* 1 */
553         uint16_t                tick;                   /* 2 */
554         union {                                         /* 4 */
555                 /* AO_LOG_FLIGHT */
556                 struct {
557                         uint16_t        flight;                 /* 4 */
558                         int16_t         ground_accel;           /* 6 */
559                         int16_t         ground_accel_along;     /* 8 */
560                         int16_t         ground_accel_across;    /* 10 */
561                         int16_t         ground_accel_through;   /* 12 */
562                         int16_t         ground_motor_pressure;  /* 14 */
563                 } flight;                                       /* 16 */
564                 /* AO_LOG_STATE */
565                 struct {
566                         uint16_t        state;                  /* 4 */
567                         uint16_t        reason;                 /* 6 */
568                 } state;
569                 /* AO_LOG_SENSOR */
570                 struct {
571                         uint16_t        pressure;               /* 4 */
572                         uint16_t        v_batt;                 /* 6 */
573                         int16_t         accel;                  /* 8 */
574                         int16_t         accel_across;           /* 10 */
575                         int16_t         accel_along;            /* 12 */
576                         int16_t         accel_through;          /* 14 */
577                 } sensor;                                       /* 16 */
578         } u;
579 };
580
581 struct ao_eeprom {
582         struct ao_config        config;
583         struct ao_ms5607_prom   ms5607_prom;
584         int                     log_format;
585         uint16_t                serial_number;
586         uint8_t                 *data;
587         uint32_t                len;
588 };
589
590 struct ao_eeprom *ao_eeprom_read(FILE *file);
591
592 struct ao_eeprom *ao_eeprom_read_old(FILE *file);
593
594 void ao_eeprom_free_data(struct ao_eeprom *ao_eeprom);
595
596 #endif /* _AO_EEPROM_READ_H_ */