2 * Copyright © 2013 Keith Packard <keithp@keithp.com>
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.
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.
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.
23 #ifndef USE_STORAGE_CONFIG
24 #define USE_STORAGE_CONFIG 1
27 #ifndef USE_EEPROM_CONFIG
28 #define USE_EEPROM_CONFIG 0
31 #if USE_STORAGE_CONFIG
33 #include <ao_storage.h>
35 #define ao_config_setup() ao_storage_setup()
36 #define ao_config_erase() ao_storage_erase(ao_storage_config)
37 #define ao_config_write(pos,bytes, len) ao_storage_write(ao_storage_config+(pos), bytes, len)
38 #define ao_config_read(pos,bytes, len) ao_storage_read(ao_storage_config+(pos), bytes, len)
39 #define ao_config_flush() ao_storage_flush()
45 #include <ao_eeprom.h>
47 #define ao_config_setup()
48 #define ao_config_erase()
49 #define ao_config_write(pos,bytes, len) ao_eeprom_write(pos, bytes, len)
50 #define ao_config_read(pos,bytes, len) ao_eeprom_read(pos, bytes, len)
51 #define ao_config_flush()
55 #define AO_CONFIG_MAJOR 1
56 #define AO_CONFIG_MINOR 18
60 extern __xdata uint8_t ao_config_aes_seq;
66 int16_t accel_plus_g; /* changed for minor version 2 */
67 uint8_t _legacy_radio_channel;
68 char callsign[AO_MAX_CALLSIGN + 1];
69 uint8_t apogee_delay; /* minor version 1 */
70 int16_t accel_minus_g; /* minor version 2 */
71 uint32_t radio_cal; /* minor version 3 */
72 uint32_t flight_log_max; /* minor version 4 */
73 uint8_t ignite_mode; /* minor version 5 */
74 uint8_t pad_orientation; /* minor version 6 */
75 uint32_t radio_setting; /* minor version 7 */
76 uint8_t radio_enable; /* minor version 8 */
77 uint8_t aes_key[AO_AES_LEN]; /* minor version 9 */
78 uint32_t frequency; /* minor version 10 */
79 uint16_t apogee_lockout; /* minor version 11 */
81 struct ao_pyro pyro[AO_PYRO_NUM]; /* minor version 12 */
83 uint16_t aprs_interval; /* minor version 13 */
85 uint8_t radio_power; /* minor version 14 */
88 uint8_t radio_amp; /* minor version 14 */
91 int16_t accel_zero_along; /* minor version 15 */
92 int16_t accel_zero_across; /* minor version 15 */
93 int16_t accel_zero_through; /* minor version 15 */
96 uint8_t mid_beep; /* minor version 16 */
99 uint16_t tracker_motion; /* minor version 17 */
100 uint8_t tracker_interval; /* minor version 17 */
103 uint16_t pyro_time; /* minor version 18 */
107 #define AO_IGNITE_MODE_DUAL 0
108 #define AO_IGNITE_MODE_APOGEE 1
109 #define AO_IGNITE_MODE_MAIN 2
111 #define AO_RADIO_ENABLE_CORE 1
112 #define AO_RADIO_DISABLE_TELEMETRY 2
113 #define AO_RADIO_DISABLE_RDF 4
115 #define AO_PAD_ORIENTATION_ANTENNA_UP 0
116 #define AO_PAD_ORIENTATION_ANTENNA_DOWN 1
118 #ifndef AO_CONFIG_MAX_SIZE
119 #define AO_CONFIG_MAX_SIZE 128
122 /* Make sure AO_CONFIG_MAX_SIZE is big enough */
123 typedef uint8_t config_check_space[(int) (AO_CONFIG_MAX_SIZE - sizeof (struct ao_config))];
125 extern __xdata struct ao_config ao_config;
126 extern __pdata uint8_t ao_config_loaded;
129 _ao_config_edit_start(void);
132 _ao_config_edit_finish(void);
141 ao_config_set_radio(void);
144 ao_config_init(void);
146 #endif /* _AO_CONFIG_H_ */