2 * Copyright © 2012 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; either version 2 of the License, or
7 * (at your option) any later version.
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.
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.
23 #define AO_XOSC_FREQ 16000000
24 #define AO_XOSC_DIV 256
25 #define AO_XOSC_MUL 768
27 #define AO_AHB_PRESCALER 1
28 #define AO_APBA_PRESCALER 1
30 #define AO_CONFIG_MAX_SIZE 1024
33 #define USE_INTERNAL_FLASH 0
34 #define USE_EEPROM_CONFIG 0
35 #define USE_STORAGE_CONFIG 1
38 #define HAS_BATTERY_REPORT 1
39 #define AO_BEEP_TCC (&samd21_tcc2)
40 #define AO_BEEP_TCC_APBC_MASK SAMD21_PM_APBCMASK_TCC2
41 #define AO_BEEP_PORT (&samd21_port_a)
42 #define AO_BEEP_PIN 16
43 #define AO_BEEP_FUNC SAMD21_PORT_PMUX_FUNC_E
45 #define HAS_TELEMETRY 0
47 #define HAS_COMPANION 0
53 #define LEDS_AVAILABLE 0
58 #define HAS_ADC_TEMP 1
66 #define HAS_IGNITE_REPORT 1
69 #define AO_SENSE_PYRO(p,n) ((p)->adc.sense[n])
70 #define AO_IGNITER_CLOSED 400
71 #define AO_IGNITER_OPEN 60
74 #define AO_PYRO_PORT_0 (&samd21_port_a)
75 #define AO_PYRO_PIN_0 1
77 #define AO_ADC_SENSE_A 0
78 #define AO_ADC_SENSE_A_PORT (&samd21_port_a)
79 #define AO_ADC_SENSE_A_PIN 2
82 #define AO_PYRO_PORT_1 (&samd21_port_b)
83 #define AO_PYRO_PIN_1 9
85 #define AO_ADC_SENSE_B 2
86 #define AO_ADC_SENSE_B_PORT (&samd21_port_b)
87 #define AO_ADC_SENSE_B_PIN 8
93 #define AO_DATA_RING 32
94 #define AO_ADC_NUM_SENSE 2
97 int16_t sense[AO_ADC_NUM_SENSE];
102 #define AO_ADC_DUMP(p) \
103 printf("tick: %5lu A: %5d B: %5d batt: %5d\n", \
105 (p)->adc.sense[0], (p)->adc.sense[1], \
108 #define AO_ADC_V_BATT 10
109 #define AO_ADC_V_BATT_PORT (&samd21_port_b)
110 #define AO_ADC_V_BATT_PIN 2
112 #define AO_ADC_TEMP SAMD21_ADC_INPUTCTRL_MUXPOS_TEMP
114 #define AO_NUM_ADC_PIN (AO_ADC_NUM_SENSE + 1)
116 #define AO_ADC_PIN0_PORT AO_ADC_SENSE_A_PORT
117 #define AO_ADC_PIN0_PIN AO_ADC_SENSE_A_PIN
118 #define AO_ADC_PIN1_PORT AO_ADC_SENSE_B_PORT
119 #define AO_ADC_PIN1_PIN AO_ADC_SENSE_B_PIN
120 #define AO_ADC_PIN2_PORT AO_ADC_V_BATT_PORT
121 #define AO_ADC_PIN2_PIN AO_ADC_V_BATT_PIN
123 #define AO_NUM_ADC (AO_NUM_ADC_PIN + 1)
125 #define AO_ADC_SQ0 AO_ADC_SENSE_A
126 #define AO_ADC_SQ1 AO_ADC_SENSE_B
127 #define AO_ADC_SQ2 AO_ADC_V_BATT
128 #define AO_ADC_SQ3 AO_ADC_TEMP
131 * Voltage divider on ADC battery sampler
133 #define AO_BATTERY_DIV_PLUS 100 /* 100k */
134 #define AO_BATTERY_DIV_MINUS 27 /* 27k */
137 * Voltage divider on ADC igniter samplers
139 #define AO_IGNITE_DIV_PLUS 100 /* 100k */
140 #define AO_IGNITE_DIV_MINUS 27 /* 27k */
143 * ADC reference in decivolts
145 #define AO_ADC_REFERENCE_DV 33
151 #define M25_MAX_CHIPS 1
152 #define AO_M25_SPI_CS_PORT (&samd21_port_a)
153 #define AO_M25_SPI_CS_MASK (1 << 27)
154 #define AO_M25_SPI_BUS AO_SPI_0_PA04_PA05_PA06
157 * On EasyTimer v2, bmi088 pin 1 (NE corner of chip) is placed towards the
158 * USB and antenna edges of the board. Relative to bmi088 specs, to
159 * get the above values, we need to flip the Y axis, assigning values
163 * +across -Y +pitch -Y
164 * +through +Z +yaw +Z
168 #define AO_BMI088_SPI_BUS AO_SPI_5_PB22_PB23_PB03
169 #define AO_BMI088_ACC_CS_PORT (&samd21_port_a)
170 #define AO_BMI088_ACC_CS_PIN 10
171 #define AO_BMI088_GYR_CS_PORT (&samd21_port_a)
172 #define AO_BMI088_GYR_CS_PIN 11
175 #define ao_bmi088_along(m) ((m)->acc.x)
176 #define ao_bmi088_across(m) (-(m)->acc.y)
177 #define ao_bmi088_through(m) ((m)->acc.z)
179 #define ao_bmi088_roll(m) ((m)->gyr.x)
180 #define ao_bmi088_pitch(m) (-(m)->gyr.y)
181 #define ao_bmi088_yaw(m) ((m)->gyr.z)
183 #define ao_data_along(packet) ao_bmi088_along(&(packet)->bmi088)
184 #define ao_data_across(packet) ao_bmi088_across(&(packet)->bmi088)
185 #define ao_data_through(packet) ao_bmi088_through(&(packet)->bmi088)
187 #define ao_data_roll(packet) ao_bmi088_roll(&(packet)->bmi088)
188 #define ao_data_pitch(packet) ao_bmi088_pitch(&(packet)->bmi088)
189 #define ao_data_yaw(packet) ao_bmi088_yaw(&(packet)->bmi088)
194 * pin 1 NE corner of chip
201 #define HAS_MMC5983 1
202 #define AO_MMC5983_INT_PORT (&samd21_port_a)
203 #define AO_MMC5983_INT_PIN 9
204 #define AO_MMC5983_SPI_CLK_PORT (&samd21_port_a)
205 #define AO_MMC5983_SPI_CLK_PIN 23
206 #define AO_MMC5983_SPI_MISO_PORT (&samd21_port_a)
207 #define AO_MMC5983_SPI_MISO_PIN 20
208 #define AO_MMC5983_SPI_MOSI_PORT (&samd21_port_a)
209 #define AO_MMC5983_SPI_MOSI_PIN 22
210 #define AO_MMC5983_SPI_INDEX (AO_SPI_3_PA22_PA23_PA20 | AO_SPI_MODE_3)
211 #define AO_MMC5983_SPI_CS_PORT (&samd21_port_a)
212 #define AO_MMC5983_SPI_CS_PIN 8
214 #define ao_mmc5983_along(m) (-(m)->y)
215 #define ao_mmc5983_across(m) ((m)->x)
216 #define ao_mmc5983_through(m) (-(m)->z)
218 #define ao_data_mag_along(packet) ao_mmc5983_along(&(packet)->mmc5983)
219 #define ao_data_mag_across(packet) ao_mmc5983_across(&(packet)->mmc5983)
220 #define ao_data_mag_through(packet) ao_mmc5983_through(&(packet)->mmc5983)
226 #define HAS_MONITOR 0
227 #define LEGACY_MONITOR 0
228 #define HAS_MONITOR_PUT 1
229 #define AO_MONITOR_LED 0
236 #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX (1024 * 1024)
237 #define AO_CONFIG_MAX_SIZE 1024
238 #define LOG_ERASE_MARK 0x55
239 #define LOG_MAX_ERASE 128
240 #define AO_LOG_FORMAT AO_LOG_FORMAT_EASYTIMER_2
241 #define AO_LOG_NORMALIZED 1
243 #endif /* _AO_PINS_H_ */