altos/test: Adjust CRC error rate after FEC fix
[fw/altos] / src / detherm / ao_pins.h
1 /*
2  * Copyright © 2015 Keith Packard <keithp@keithp.com>
3  *
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.
8  *
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.
13  *
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.
17  */
18
19 #ifndef _AO_PINS_H_
20 #define _AO_PINS_H_
21
22 #define LED_PORT_ENABLE STM_RCC_AHBENR_IOPAEN
23 #define LED_PORT        (&stm_gpioa)
24 #define LED_PIN_RED     3
25 #define AO_LED_RED      (1 << LED_PIN_RED)
26
27 #define LEDS_AVAILABLE  (AO_LED_RED)
28
29 #define HAS_BEEP        0
30
31 /* 48MHz clock based on USB */
32 //#define AO_HSI48      1
33 #define AO_HSE                  16000000
34 #define AO_RCC_CFGR_PLLMUL      STM_RCC_CFGR_PLLMUL_3
35 #define AO_PLLMUL               3
36 #define AO_PLLDIV               1
37
38 /* HCLK = 48MHz */
39 #define AO_AHB_PRESCALER        1
40 #define AO_RCC_CFGR_HPRE_DIV    STM_RCC_CFGR_HPRE_DIV_1
41
42 /* APB = 48MHz */
43 #define AO_APB_PRESCALER        1
44 #define AO_RCC_CFGR_PPRE_DIV    STM_RCC_CFGR_PPRE_DIV_1
45
46 #define HAS_USB                         1
47 #define AO_USB_DIRECTIO                 0
48 #define AO_PA11_PA12_RMP                1
49
50 #define IS_FLASH_LOADER 0
51
52 #define AO_DATA_RING    16
53
54 #define HAS_ADC         0
55 #define HAS_ACCEL       0
56 #define HAS_GPS         0
57 #define HAS_RADIO       0
58 #define HAS_FLIGHT      1
59 #define HAS_EEPROM      1
60 #define HAS_LOG         1
61
62 #define AO_LOG_FORMAT           AO_LOG_FORMAT_DETHERM
63
64 #define USE_INTERNAL_FLASH      0
65
66 /* SPI */
67 #define HAS_SPI_1               1
68 #define HAS_SPI_2               0
69 #define SPI_1_PA5_PA6_PA7       1
70 #define SPI_1_PB3_PB4_PB5       1
71 #define SPI_1_OSPEEDR           STM_OSPEEDR_HIGH
72
73 /* MS5607 */
74 #define HAS_MS5607              1
75
76 #define AO_MS5607_CS_PORT       (&stm_gpioa)
77 #define AO_MS5607_CS_PIN        0
78 #define AO_MS5607_SPI_INDEX     AO_SPI_1_PB3_PB4_PB5
79 #define AO_MS5607_MISO_PORT     (&stm_gpiob)
80 #define AO_MS5607_MISO_PIN      4
81 #define AO_MS5607_PRIVATE_PINS  1
82 #define AO_MS5607_SPI_SPEED     AO_SPI_SPEED_6MHz
83
84 /* Flash */
85
86 #define M25_MAX_CHIPS           1
87 #define AO_M25_SPI_CS_PORT      (&stm_gpioa)
88 #define AO_M25_SPI_CS_MASK      (1 << 4)
89 #define AO_M25_SPI_BUS          AO_SPI_1_PA5_PA6_PA7
90
91 /* PWM */
92
93 #define NUM_PWM                 1
94 #define AO_PWM_TIMER            (&stm_tim3)
95 #define AO_PWM_0_GPIO           (&stm_gpiob)
96 #define AO_PWM_0_PIN            1
97 #define AO_PWM_0_CH             4
98 #define PWM_MAX                 20000
99 #define AO_PWM_TIMER_ENABLE     STM_RCC_APB1ENR_TIM3EN
100 #define AO_PWM_TIMER_SCALE      32
101
102 /* Servo */
103
104 #define AO_SERVO_DIR_PORT       (&stm_gpiob)
105 #define AO_SERVO_DIR_BIT        0
106 #define AO_SERVO_SPEED_PWM      0
107
108 /* limit 2 */
109 #define AO_SERVO_LIMIT_FORE_PORT        (&stm_gpiob)
110 #define AO_SERVO_LIMIT_FORE_BIT         6
111
112 /* limit 1 */
113 #define AO_SERVO_LIMIT_BACK_PORT        (&stm_gpiob)
114 #define AO_SERVO_LIMIT_BACK_BIT         7
115
116 #endif /* _AO_PINS_H_ */