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; 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.
21 /* 8MHz High speed external crystal */
22 #define AO_HSE 8000000
24 /* PLLVCO = 96MHz (so that USB will work) */
26 #define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12)
28 /* SYSCLK = 32MHz (no need to go faster than CPU) */
30 #define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3)
32 /* HCLK = 32MHz (CPU clock) */
33 #define AO_AHB_PRESCALER 1
34 #define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1
36 /* Run APB1 at 16MHz (HCLK/2) */
37 #define AO_APB1_PRESCALER 2
38 #define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2
40 /* Run APB2 at 16MHz (HCLK/2) */
41 #define AO_APB2_PRESCALER 2
42 #define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2
45 #define USE_INTERNAL_FLASH 1
49 #define HAS_TELEMETRY 0
53 #define SPI_1_PA5_PA6_PA7 1
54 #define SPI_1_PB3_PB4_PB5 0
55 #define SPI_1_PE13_PE14_PE15 0
58 #define SPI_2_PB13_PB14_PB15 1
59 #define SPI_2_PD1_PD3_PD4 0
60 #define SPI_2_GPIO (&stm_gpiob)
69 #define PACKET_HAS_SLAVE 0
70 #define PACKET_HAS_MASTER 0
73 * Radio is a cc1111 connected via SPI
75 #define AO_RADIO_CAL_DEFAULT 1186611
77 #define AO_RADIO_SPI_BUS AO_SPI_2_PB13_PB14_PB15
78 #define AO_RADIO_CS_PORT (&stm_gpiob)
79 #define AO_RADIO_CS_PIN 12
81 #define AO_RADIO_INT_PORT (&stm_gpioc)
82 #define AO_RADIO_INT_PIN 14
84 #define LOW_LEVEL_DEBUG 0
86 #define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOCEN
87 #define LED_PORT (&stm_gpioc)
89 #define LED_PIN_GREEN 8
90 #define LED_PIN_CONTINUITY_3 9
91 #define LED_PIN_CONTINUITY_2 10
92 #define LED_PIN_CONTINUITY_1 11
93 #define LED_PIN_CONTINUITY_0 12
94 #define LED_PIN_REMOTE_ARM 13
95 #define AO_LED_RED (1 << LED_PIN_RED)
96 #define AO_LED_GREEN (1 << LED_PIN_GREEN)
97 #define AO_LED_CONTINUITY_3 (1 << LED_PIN_CONTINUITY_3)
98 #define AO_LED_CONTINUITY_2 (1 << LED_PIN_CONTINUITY_2)
99 #define AO_LED_CONTINUITY_1 (1 << LED_PIN_CONTINUITY_1)
100 #define AO_LED_CONTINUITY_0 (1 << LED_PIN_CONTINUITY_0)
102 #define AO_LED_CONTINUITY_NUM 4
104 #define AO_LED_REMOTE_ARM (1 << LED_PIN_REMOTE_ARM)
106 #define LEDS_AVAILABLE (AO_LED_RED | \
108 AO_LED_CONTINUITY_3 | \
109 AO_LED_CONTINUITY_2 | \
110 AO_LED_CONTINUITY_1 | \
111 AO_LED_CONTINUITY_0 | \
116 #define AO_LCD_STM_SEG_ENABLED_0 ( \
117 (1 << 0) | /* PA1 */ \
118 (1 << 1) | /* PA2 */ \
119 (1 << 2) | /* PA3 */ \
120 (1 << 3) | /* PA6 */ \
121 (1 << 4) | /* PA7 */ \
122 (1 << 5) | /* PB0 */ \
123 (1 << 6) | /* PB1 */ \
124 (1 << 7) | /* PB3 */ \
125 (0 << 8) | /* PB4 */ \
126 (0 << 9) | /* PB5 */ \
127 (0 << 10) | /* PB10 */ \
128 (0 << 11) | /* PB11 */ \
129 (0 << 12) | /* PB12 */ \
130 (0 << 13) | /* PB13 */ \
131 (0 << 14) | /* PB14 */ \
132 (0 << 15) | /* PB15 */ \
133 (0 << 16) | /* PB8 */ \
134 (0 << 17) | /* PA15 */ \
135 (0 << 18) | /* PC0 */ \
136 (0 << 19) | /* PC1 */ \
137 (0 << 20) | /* PC2 */ \
138 (0 << 21) | /* PC3 */ \
139 (0 << 22) | /* PC4 */ \
140 (0 << 23) | /* PC5 */ \
141 (0 << 24) | /* PC6 */ \
142 (0 << 25) | /* PC7 */ \
143 (0 << 26) | /* PC8 */ \
144 (0 << 27) | /* PC9 */ \
145 (0 << 28) | /* PC10 or PD8 */ \
146 (0 << 29) | /* PC11 or PD9 */ \
147 (0 << 30) | /* PC12 or PD10 */ \
148 (0 << 31)) /* PD2 or PD11 */
150 #define AO_LCD_STM_SEG_ENABLED_1 ( \
151 (0 << 0) | /* PD12 */ \
152 (0 << 1) | /* PD13 */ \
153 (0 << 2) | /* PD14 */ \
154 (0 << 3) | /* PD15 */ \
155 (0 << 4) | /* PE0 */ \
156 (0 << 5) | /* PE1 */ \
157 (0 << 6) | /* PE2 */ \
160 #define AO_LCD_STM_COM_ENABLED ( \
161 (1 << 0) | /* PA8 */ \
162 (1 << 1) | /* PA9 */ \
163 (1 << 2) | /* PA10 */ \
164 (0 << 3) | /* PB9 */ \
165 (0 << 4) | /* PC10 */ \
166 (0 << 5) | /* PC11 */ \
169 #define AO_LCD_28_ON_C 0
171 #define AO_LCD_DUTY STM_LCD_CR_DUTY_1_4
173 #define AO_SEGMENT_0 0
174 #define AO_SEGMENT_1 5
175 #define AO_SEGMENT_2 1
176 #define AO_SEGMENT_3 6
177 #define AO_SEGMENT_4 4
178 #define AO_SEGMENT_5 2
179 #define AO_SEGMENT_6 3
180 #define AO_SEGMENT_7 7
183 * Use event queue for input devices
192 #define AO_QUADRATURE_COUNT 2
193 #define AO_QUADRATURE_MODE 0
195 #define AO_QUADRATURE_0_PORT &stm_gpioc
196 #define AO_QUADRATURE_0_A 3
197 #define AO_QUADRATURE_0_B 2
199 #define AO_QUADRATURE_PAD 0
201 #define AO_QUADRATURE_1_PORT &stm_gpioc
202 #define AO_QUADRATURE_1_A 1
203 #define AO_QUADRATURE_1_B 0
205 #define AO_QUADRATURE_BOX 1
211 #define AO_BUTTON_COUNT 2
212 #define AO_BUTTON_MODE AO_EXTI_MODE_PULL_UP
214 #define AO_BUTTON_0_PORT &stm_gpioc
215 #define AO_BUTTON_0 4
217 #define AO_BUTTON_ARM 0
219 #define AO_BUTTON_1_PORT &stm_gpioc
220 #define AO_BUTTON_1 5
222 #define AO_BUTTON_FIRE 1
224 #endif /* _AO_PINS_H_ */