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.
19 #define HAS_BATTERY_REPORT 1
21 #define AO_STACK_SIZE 384
23 #define RELOCATE_INTERRUPT 0
25 #define IS_FLASH_LOADER 0
27 /* 48MHz clock based on 16MHz reference */
29 #define AO_HSE 16000000
30 #define AO_RCC_CFGR_PLLMUL STM_RCC_CFGR_PLLMUL_3
31 #define AO_RCC_CFGR2_PLLDIV STM_RCC_CFGR2_PREDIV_1
36 #define AO_AHB_PRESCALER 1
37 #define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1
40 #define AO_APB_PRESCALER 1
41 #define AO_RCC_CFGR_PPRE_DIV STM_RCC_CFGR_PPRE_DIV_1
44 #define AO_USB_DIRECTIO 0
45 #define AO_PA11_PA12_RMP 0
47 #define PACKET_HAS_SLAVE 1
49 #define AO_LOG_FORMAT AO_LOG_FORMAT_EASYMINI
51 #define HAS_BOOT_RADIO 0
56 #define HAS_RADIO_RATE 1
59 #define HAS_TELEMETRY 1
62 #define USE_INTERNAL_FLASH 0
64 #define HAS_IGNITE_REPORT 1
66 /* Beeper is on Tim1 CH3 */
67 #define BEEPER_CHANNEL 3
70 #define LED_PORT_ENABLE STM_RCC_AHBENR_IOPAEN
71 #define LED_PORT (&stm_gpioa)
72 #define LED_PIN_GREEN 15
73 #define AO_LED_GREEN (1 << 15)
74 #define AO_LED_PANIC AO_LED_GREEN
76 #define LEDS_AVAILABLE AO_LED_GREEN
81 #define USE_SERIAL_0_STDIN 1
82 #define SERIAL_0_18_19 1
83 #define SERIAL_0_14_15 0
84 #define SERIAL_0_17_18 0
85 #define SERIAL_0_26_27 0
90 #define SPI_SCK1_P1_15 1
91 #define SPI_MISO1_P0_22 1
92 #define SPI_MOSI1_P0_21 1
96 #define M25_MAX_CHIPS 1
97 #define AO_M25_SPI_CS_PORT (&stm_gpioa)
98 #define AO_M25_SPI_CS_MASK (1 << 3)
99 #define AO_M25_SPI_BUS AO_SPI_1_PA5_PA6_PA7
105 #define AO_MS5607_PRIVATE_PINS 0
106 #define AO_MS5607_CS_PORT (&stm_gpioa)
107 #define AO_MS5607_CS_PIN 4
108 #define AO_MS5607_CS_MASK (1 << AO_MS5607_CS_PIN)
109 #define AO_MS5607_MISO_PORT (&stm_gpiob)
110 #define AO_MS5607_MISO_PIN 4
111 #define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO_PIN)
112 #define AO_MS5607_SPI_INDEX AO_SPI_1_PB3_PB4_PB5
116 // #define AO_RADIO_CAL_DEFAULT 5695733
117 #define AO_RADIO_CAL_DEFAULT 5695717
119 #define AO_FEC_DEBUG 0
120 #define AO_CC1200_SPI_CS_PORT (&stm_gpiob)
121 #define AO_CC1200_SPI_CS_PIN 0
122 #define AO_CC1200_SPI_BUS AO_SPI_1_PA5_PA6_PA7
123 #define AO_CC1200_SPI stm_spi1
125 #define AO_CC1200_INT_PORT (&stm_gpiob)
126 #define AO_CC1200_INT_PIN 1
128 #define AO_CC1200_INT_GPIO 2
129 #define AO_CC1200_INT_GPIO_IOCFG CC1200_IOCFG2
132 #define AO_DATA_RING 16
140 #define AO_ADC_PIN0_PORT (&stm_gpioa)
141 #define AO_ADC_PIN0_PIN 0
142 #define AO_ADC_PIN0_CH 0
143 #define AO_ADC_PIN1_PORT (&stm_gpioa)
144 #define AO_ADC_PIN1_PIN 1
145 #define AO_ADC_PIN1_CH 1
146 #define AO_ADC_PIN2_PORT (&stm_gpioa)
147 #define AO_ADC_PIN2_PIN 2
148 #define AO_ADC_PIN2_CH 2
150 #define AO_ADC_RCC_AHBENR ((1 << STM_RCC_AHBENR_IOPAEN))
164 #define AO_IGNITER_CLOSED 400
165 #define AO_IGNITER_OPEN 60
167 #define AO_IGNITER_DROGUE_PORT (&stm_gpiob)
168 #define AO_IGNITER_DROGUE_PIN 7
169 #define AO_IGNITER_SET_DROGUE(v) ao_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, v)
171 #define AO_IGNITER_MAIN_PORT (&stm_gpiob)
172 #define AO_IGNITER_MAIN_PIN 6
173 #define AO_IGNITER_SET_MAIN(v) ao_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, v)
175 #define AO_SENSE_DROGUE(p) ((p)->adc.sense_a)
176 #define AO_SENSE_MAIN(p) ((p)->adc.sense_m)
178 #define AO_ADC_DUMP(p) \
179 printf("tick: %5u apogee: %5d main: %5d batt: %5d\n", \
180 (p)->tick, (p)->adc.sense_a, (p)->adc.sense_m, (p)->adc.v_batt)
183 * Voltage divider on ADC battery sampler
185 #define AO_BATTERY_DIV_PLUS 56 /* 5.6k */
186 #define AO_BATTERY_DIV_MINUS 100 /* 10k */
189 * Voltage divider on ADC igniter samplers
191 #define AO_IGNITE_DIV_PLUS 100 /* 100k */
192 #define AO_IGNITE_DIV_MINUS 27 /* 27k */
195 * ADC reference in decivolts
197 #define AO_ADC_REFERENCE_DV 33