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_b)
153 #define AO_M25_SPI_CS_MASK (1 << 10)
154 #define AO_M25_SPI_BUS AO_SPI_0_PA04_PA05_PA06
158 * Here are the required sensor signs:
161 * +across switch screws down
164 * With the board aligned to have positive accel for the relevant
165 * axis, looking down from above we have:
167 * +roll counter clockwise (nose up)
168 * +pitch counter clockwise (switch screws down)
169 * +yaw counter clockwise (TH down)
174 * On EasyTimer v2, bmi088 pin 1 (NE corner of chip) is placed away
175 * from the USB edge of the board. Relative to bmi088 specs, to get
176 * the above values, we need to flip the X and Y axes, assigning
180 * +across -X +pitch -X
181 * +through +Z +yaw +Z
185 #define AO_BMI088_SPI_BUS AO_SPI_5_PB22_PB23_PB03
186 #define AO_BMI088_ACC_CS_PORT (&samd21_port_a)
187 #define AO_BMI088_ACC_CS_PIN 10
188 #define AO_BMI088_GYR_CS_PORT (&samd21_port_a)
189 #define AO_BMI088_GYR_CS_PIN 11
192 #define ao_bmi088_along(m) (-(m)->acc.y)
193 #define ao_bmi088_across(m) (-(m)->acc.x)
194 #define ao_bmi088_through(m) ((m)->acc.z)
196 #define ao_bmi088_roll(m) (-(m)->gyr.y)
197 #define ao_bmi088_pitch(m) (-(m)->gyr.x)
198 #define ao_bmi088_yaw(m) ((m)->gyr.z)
200 #define ao_data_along(packet) ao_bmi088_along(&(packet)->bmi088)
201 #define ao_data_across(packet) ao_bmi088_across(&(packet)->bmi088)
202 #define ao_data_through(packet) ao_bmi088_through(&(packet)->bmi088)
204 #define ao_data_roll(packet) ao_bmi088_roll(&(packet)->bmi088)
205 #define ao_data_pitch(packet) ao_bmi088_pitch(&(packet)->bmi088)
206 #define ao_data_yaw(packet) ao_bmi088_yaw(&(packet)->bmi088)
211 * pin 1 NE corner of chip
218 #define HAS_MMC5983 1
219 #define AO_MMC5983_INT_PORT (&samd21_port_a)
220 #define AO_MMC5983_INT_PIN 9
221 #define AO_MMC5983_SPI_CLK_PORT (&samd21_port_a)
222 #define AO_MMC5983_SPI_CLK_PIN 23
223 #define AO_MMC5983_SPI_MISO_PORT (&samd21_port_a)
224 #define AO_MMC5983_SPI_MISO_PIN 20
225 #define AO_MMC5983_SPI_MOSI_PORT (&samd21_port_a)
226 #define AO_MMC5983_SPI_MOSI_PIN 22
227 #define AO_MMC5983_SPI_INDEX (AO_SPI_3_PA22_PA23_PA20 | AO_SPI_MODE_3)
228 #define AO_MMC5983_SPI_CS_PORT (&samd21_port_a)
229 #define AO_MMC5983_SPI_CS_PIN 8
231 #define ao_mmc5983_along(m) ((m)->y)
232 #define ao_mmc5983_across(m) ((m)->x)
233 #define ao_mmc5983_through(m) (-(m)->z)
235 #define ao_data_mag_along(packet) ao_mmc5983_along(&(packet)->mmc5983)
236 #define ao_data_mag_across(packet) ao_mmc5983_across(&(packet)->mmc5983)
237 #define ao_data_mag_through(packet) ao_mmc5983_through(&(packet)->mmc5983)
243 #define HAS_MONITOR 0
244 #define LEGACY_MONITOR 0
245 #define HAS_MONITOR_PUT 1
246 #define AO_MONITOR_LED 0
253 #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX (192 * 1024)
254 #define AO_CONFIG_MAX_SIZE 1024
255 #define LOG_ERASE_MARK 0x55
256 #define LOG_MAX_ERASE 128
257 #define AO_LOG_FORMAT AO_LOG_FORMAT_EASYTIMER_2
258 #define AO_LOG_NORMALIZED 1
260 #endif /* _AO_PINS_H_ */