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.
22 /* 8MHz High speed external crystal */
23 #define AO_HSE 8000000
25 /* PLLVCO = 96MHz (so that USB will work) */
27 #define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12)
29 /* SYSCLK = 32MHz (no need to go faster than CPU) */
31 #define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3)
33 /* HCLK = 32MHz (CPU clock) */
34 #define AO_AHB_PRESCALER 1
35 #define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1
37 /* Run APB1 at 16MHz (HCLK/2) */
38 #define AO_APB1_PRESCALER 2
39 #define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2
41 /* Run APB2 at 16MHz (HCLK/2) */
42 #define AO_APB2_PRESCALER 2
43 #define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2
46 #define USE_INTERNAL_FLASH 1
47 #define USE_EEPROM_CONFIG 1
48 #define USE_STORAGE_CONFIG 0
51 #define BEEPER_TIMER 3
52 #define BEEPER_CHANNEL 1
53 #define BEEPER_PORT (&stm_gpioc)
56 #define HAS_RADIO_RATE 1
57 #define HAS_TELEMETRY 0
61 #define SPI_1_PA5_PA6_PA7 0
62 #define SPI_1_PB3_PB4_PB5 0
63 #define SPI_1_PE13_PE14_PE15 0
65 #define HAS_SPI_2 1 /* CC1120 */
66 #define SPI_2_PB13_PB14_PB15 0
67 #define SPI_2_PD1_PD3_PD4 1
68 #define SPI_2_GPIO (&stm_gpiod)
72 #define SPI_2_OSPEEDR STM_OSPEEDR_10MHz
78 #define PACKET_HAS_SLAVE 0
79 #define PACKET_HAS_MASTER 0
81 #define FAST_TIMER_FREQ 10000 /* .1ms for debouncing */
84 * Radio is a cc1120 connected via SPI
87 #define AO_RADIO_CAL_DEFAULT 0x6ca333
89 #define AO_FEC_DEBUG 0
90 #define AO_CC1120_SPI_CS_PORT (&stm_gpiod)
91 #define AO_CC1120_SPI_CS_PIN 0
92 #define AO_CC1120_SPI_BUS AO_SPI_2_PD1_PD3_PD4
93 #define AO_CC1120_SPI stm_spi2
95 #define AO_CC1120_INT_PORT (&stm_gpioc)
96 #define AO_CC1120_INT_PIN (15)
97 #define AO_CC1120_MCU_WAKEUP_PORT (&stm_gpiod)
98 #define AO_CC1120_MCU_WAKEUP_PIN (2)
100 #define AO_CC1120_INT_GPIO 2
101 #define AO_CC1120_INT_GPIO_IOCFG CC1120_IOCFG2
103 #define AO_CC1120_MARC_GPIO 3
104 #define AO_CC1120_MARC_GPIO_IOCFG CC1120_IOCFG3
107 #define LOW_LEVEL_DEBUG 0
109 #define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOCEN
110 #define LED_PORT (&stm_gpioc)
111 #define LED_PIN_RED 7
112 #define LED_PIN_AMBER 8
113 #define LED_PIN_GREEN 9
114 #define LED_PIN_CONTINUITY_3 10
115 #define LED_PIN_CONTINUITY_2 11
116 #define LED_PIN_CONTINUITY_1 12
117 #define LED_PIN_CONTINUITY_0 13
118 #define LED_PIN_REMOTE_ARM 14
119 #define AO_LED_RED (1 << LED_PIN_RED)
120 #define AO_LED_AMBER (1 << LED_PIN_AMBER)
121 #define AO_LED_GREEN (1 << LED_PIN_GREEN)
122 #define AO_LED_CONTINUITY_3 (1 << LED_PIN_CONTINUITY_3)
123 #define AO_LED_CONTINUITY_2 (1 << LED_PIN_CONTINUITY_2)
124 #define AO_LED_CONTINUITY_1 (1 << LED_PIN_CONTINUITY_1)
125 #define AO_LED_CONTINUITY_0 (1 << LED_PIN_CONTINUITY_0)
127 #define AO_LED_CONTINUITY_NUM 4
129 #define AO_LED_REMOTE_ARM (1 << LED_PIN_REMOTE_ARM)
131 #define LEDS_AVAILABLE (AO_LED_RED | \
134 AO_LED_CONTINUITY_3 | \
135 AO_LED_CONTINUITY_2 | \
136 AO_LED_CONTINUITY_1 | \
137 AO_LED_CONTINUITY_0 | \
143 #define SEVEN_SEGMENT_DEBUG 0
145 #define AO_LCD_STM_SEG_ENABLED_0 ( \
146 (1 << 0) | /* PA1 */ \
147 (1 << 1) | /* PA2 */ \
148 (1 << 2) | /* PA3 */ \
149 (1 << 3) | /* PA6 */ \
150 (1 << 4) | /* PA7 */ \
151 (1 << 5) | /* PB0 */ \
152 (1 << 6) | /* PB1 */ \
153 (1 << 7) | /* PB3 */ \
154 (1 << 8) | /* PB4 */ \
155 (1 << 9) | /* PB5 */ \
156 (1 << 10) | /* PB10 */ \
157 (1 << 11) | /* PB11 */ \
158 (1 << 12) | /* PB12 */ \
159 (1 << 13) | /* PB13 */ \
160 (1 << 14) | /* PB14 */ \
161 (1 << 15) | /* PB15 */ \
162 (1 << 16) | /* PB8 */ \
163 (1 << 17) | /* PA15 */ \
164 (1 << 18) | /* PC0 */ \
165 (1 << 19) | /* PC1 */ \
166 (1 << 20) | /* PC2 */ \
167 (1 << 21) | /* PC3 */ \
168 (1 << 22) | /* PC4 */ \
169 (1 << 23) | /* PC5 */ \
170 (0 << 24) | /* PC6 */ \
171 (0 << 25) | /* PC7 */ \
172 (0 << 26) | /* PC8 */ \
173 (0 << 27) | /* PC9 */ \
174 (0 << 28) | /* PC10 or PD8 */ \
175 (0 << 29) | /* PC11 or PD9 */ \
176 (0 << 30) | /* PC12 or PD10 */ \
177 (0 << 31)) /* PD2 or PD11 */
179 #define AO_LCD_STM_SEG_ENABLED_1 ( \
180 (0 << 0) | /* PD12 */ \
181 (0 << 1) | /* PD13 */ \
182 (0 << 2) | /* PD14 */ \
183 (0 << 3) | /* PD15 */ \
184 (0 << 4) | /* PE0 */ \
185 (0 << 5) | /* PE1 */ \
186 (0 << 6) | /* PE2 */ \
189 #define AO_LCD_STM_COM_ENABLED ( \
190 (1 << 0) | /* PA8 */ \
191 (0 << 1) | /* PA9 */ \
192 (0 << 2) | /* PA10 */ \
193 (0 << 3) | /* PB9 */ \
194 (0 << 4) | /* PC10 */ \
195 (0 << 5) | /* PC11 */ \
198 #define AO_LCD_28_ON_C 0
200 #define AO_LCD_DUTY STM_LCD_CR_DUTY_STATIC
202 #define AO_LCD_PER_DIGIT 1
204 #define AO_LCD_DIGITS 3
205 #define AO_LCD_SEGMENTS 8
207 #define AO_SEGMENT_MAP { \
217 /* box1 segments */ \
226 /* box0 segments */ \
238 * Use event queue for input devices
247 #define AO_QUADRATURE_COUNT 2
249 #define AO_QUADRATURE_0_PORT &stm_gpioe
250 #define AO_QUADRATURE_0_A 3
251 #define AO_QUADRATURE_0_B 2
253 #define AO_QUADRATURE_PAD 0
255 #define AO_QUADRATURE_1_PORT &stm_gpioe
256 #define AO_QUADRATURE_1_A 1
257 #define AO_QUADRATURE_1_B 0
259 #define AO_QUADRATURE_BOX 1
260 #define AO_QUADRATURE_DEBOUNCE 10
266 #define AO_BUTTON_COUNT 2
267 #define AO_BUTTON_MODE AO_EXTI_MODE_PULL_UP
269 #define AO_BUTTON_0_PORT &stm_gpioe
270 #define AO_BUTTON_0 4
272 #define AO_BUTTON_ARM 0
274 #define AO_BUTTON_1_PORT &stm_gpioe
275 #define AO_BUTTON_1 5
277 #define AO_BUTTON_FIRE 1
279 #define AO_LCO_DRAG_RACE_BOX 1
281 #endif /* _AO_PINS_H_ */