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 #ifndef FLIGHT_LOG_APPEND
32 #define FLIGHT_LOG_APPEND 0
35 #if USE_STORAGE_CONFIG
37 #include <ao_storage.h>
39 #define ao_config_setup() ao_storage_setup()
40 #define ao_config_erase() ao_storage_erase(ao_storage_config)
41 #define ao_config_write(pos,bytes, len) ao_storage_write(ao_storage_config+(pos), bytes, len)
42 #define ao_config_read(pos,bytes, len) ao_storage_read(ao_storage_config+(pos), bytes, len)
43 #define ao_config_flush() ao_storage_flush()
49 #include <ao_eeprom.h>
51 #define ao_config_setup()
52 #define ao_config_erase()
53 #define ao_config_write(pos,bytes, len) ao_eeprom_write(pos, bytes, len)
54 #define ao_config_read(pos,bytes, len) ao_eeprom_read(pos, bytes, len)
55 #define ao_config_flush()
59 #define AO_CONFIG_MAJOR 1
60 #define AO_CONFIG_MINOR 21
64 extern __xdata uint8_t ao_config_aes_seq;
70 int16_t accel_plus_g; /* changed for minor version 2 */
71 uint8_t _legacy_radio_channel;
72 char callsign[AO_MAX_CALLSIGN + 1];
73 uint8_t apogee_delay; /* minor version 1 */
74 int16_t accel_minus_g; /* minor version 2 */
75 uint32_t radio_cal; /* minor version 3 */
76 uint32_t flight_log_max; /* minor version 4 */
77 uint8_t ignite_mode; /* minor version 5 */
78 uint8_t pad_orientation; /* minor version 6 */
79 uint32_t radio_setting; /* minor version 7 */
80 uint8_t radio_enable; /* minor version 8 */
81 uint8_t aes_key[AO_AES_LEN]; /* minor version 9 */
82 uint32_t frequency; /* minor version 10 */
83 uint16_t apogee_lockout; /* minor version 11 */
85 struct ao_pyro pyro[AO_PYRO_NUM]; /* minor version 12 */
87 uint16_t aprs_interval; /* minor version 13 */
89 uint8_t radio_power; /* minor version 14 */
92 uint8_t radio_amp; /* minor version 14 */
95 int16_t accel_zero_along; /* minor version 15 */
96 int16_t accel_zero_across; /* minor version 15 */
97 int16_t accel_zero_through; /* minor version 15 */
100 uint8_t mid_beep; /* minor version 16 */
103 uint16_t tracker_motion; /* minor version 17 */
104 uint8_t tracker_interval; /* minor version 17 */
107 uint16_t pyro_time; /* minor version 18 */
110 uint8_t aprs_ssid; /* minor version 19 */
113 uint8_t radio_rate; /* minor version 20 */
115 #if HAS_RADIO_FORWARD
116 uint32_t send_frequency; /* minor version 21 */
120 #if HAS_RADIO_FORWARD
121 extern __xdata uint32_t ao_send_radio_setting;
124 #define AO_IGNITE_MODE_DUAL 0
125 #define AO_IGNITE_MODE_APOGEE 1
126 #define AO_IGNITE_MODE_MAIN 2
128 #define AO_RADIO_ENABLE_CORE 1
129 #define AO_RADIO_DISABLE_TELEMETRY 2
130 #define AO_RADIO_DISABLE_RDF 4
132 #define AO_PAD_ORIENTATION_ANTENNA_UP 0
133 #define AO_PAD_ORIENTATION_ANTENNA_DOWN 1
135 #ifndef AO_CONFIG_MAX_SIZE
136 #define AO_CONFIG_MAX_SIZE 128
139 /* Make sure AO_CONFIG_MAX_SIZE is big enough */
140 typedef uint8_t config_check_space[(int) (AO_CONFIG_MAX_SIZE - sizeof (struct ao_config))];
142 extern __xdata struct ao_config ao_config;
143 extern __pdata uint8_t ao_config_loaded;
146 _ao_config_edit_start(void);
149 _ao_config_edit_finish(void);
158 ao_config_set_radio(void);
161 ao_config_log_fix_append(void);
164 ao_config_init(void);
166 #endif /* _AO_CONFIG_H_ */