altos/test: Adjust CRC error rate after FEC fix
[fw/altos] / src / micropeak-v2.0 / ao_pins.h
1 /*
2  * Copyright © 2011 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; version 2 of the License.
7  *
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.
12  *
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.
16  */
17
18 #ifndef _AO_PINS_H_
19 #define _AO_PINS_H_
20
21 extern uint8_t ao_on_battery;
22
23 #define HAS_TASK        0
24
25 #define AO_SYSCLK       STM_MSI_FREQ_524288
26 #define AO_MSI_RANGE    STM_RCC_ICSCR_MSIRANGE_524288
27
28 #define LED_0_PORT      (&stm_gpioa)
29 #define LED_0_PIN       1
30 #define AO_LED_ORANGE   (1 << 0)
31 #define AO_LED_REPORT   AO_LED_ORANGE
32 #define AO_LED_PANIC    AO_LED_ORANGE
33
34 #define LEDS_AVAILABLE  (AO_LED_ORANGE)
35
36 #define AO_POWER_MANAGEMENT     0
37
38 /* HCLK = MSI (2.097MHz) */
39 #define AO_AHB_PRESCALER        (1)
40 #define AO_RCC_CFGR_HPRE_DIV    (STM_RCC_CFGR_HPRE_DIV_1)
41
42 /* APB = MSI */
43 #define AO_APB1_PRESCALER       (1)
44 #define AO_APB2_PRESCALER       (1)
45 #define AO_RCC_CFGR_PPRE_DIV    (STM_RCC_CFGR_PPRE_DIV_1)
46
47 #define PACKET_HAS_SLAVE        0
48 #define HAS_SERIAL_1            0
49 #define HAS_SERIAL_2            1
50 #define USE_SERIAL_2_STDIN      1
51 #define USE_SERIAL_2_FLOW       0
52 #define USE_SERIAL_2_SW_FLOW    0
53 #define SERIAL_2_PA9_PA10       1
54
55 #define HAS_LPUART_1            1
56 #define LPUART_1_PA0_PA1        1
57 #define USE_LPUART_1_STDIN      0
58 #define USE_LPUART_1_FLOW       0
59 #define USE_LPUART_1_SW_FLOW    0
60
61 #define IS_FLASH_LOADER         0
62
63 #define HAS_MS5607              1
64 #define HAS_SENSOR_ERRORS       0
65 #define HAS_MS5611              0
66 #define HAS_MS5607_TASK         0
67 #define HAS_EEPROM              1
68 #define HAS_CONFIG_SAVE         0
69 #define HAS_BEEP                0
70
71 /* Logging */
72 #define LOG_INTERVAL            1
73 #define SAMPLE_SLEEP            AO_MS_TO_TICKS(100)
74 #define BOOST_DELAY             AO_SEC_TO_TICKS(60)
75 #define AO_LOG_ID               AO_LOG_ID_MICROPEAK2
76 #define HAS_LOG                 1
77 #define AO_LOG_FORMAT           AO_LOG_FORMAT_MICROPEAK2
78 #define FLIGHT_LOG_APPEND       1
79
80 /* Kalman filter */
81
82 #define AO_MK_STEP_100MS        1
83 #define AO_MK_STEP_96MS         0
84
85 /* SPI */
86 #define HAS_SPI_1               1
87 #define SPI_1_POWER_MANAGE      1
88 #define SPI_1_PA5_PA6_PA7       1
89 #define SPI_1_PB3_PB4_PB5       0
90 #define SPI_1_OSPEEDR           STM_OSPEEDR_MEDIUM
91
92 #define HAS_SPI_2               0
93
94 /* MS5607 */
95 #define HAS_MS5607              1
96 #define HAS_MS5611              0
97 #define AO_MS5607_PRIVATE_PINS  0
98 #define AO_MS5607_CS_PORT       (&stm_gpioa)
99 #define AO_MS5607_CS_PIN        4
100 #define AO_MS5607_CS_MASK       (1 << AO_MS5607_CS_PIN)
101 #define AO_MS5607_MISO_PORT     (&stm_gpioa)
102 #define AO_MS5607_MISO_PIN      6
103 #define AO_MS5607_MISO_MASK     (1 << AO_MS5607_MISO_PIN)
104 #define AO_MS5607_SPI_INDEX     AO_SPI_1_PA5_PA6_PA7
105
106 typedef int32_t alt_t;
107
108 #define AO_ALT_VALUE(x)         ((x) * (alt_t) 10)
109
110 #define HAS_ADC                 0
111 #define HAS_AO_DELAY            1
112
113 static inline void
114 ao_power_off(void) __attribute((noreturn));
115
116 static inline void
117 ao_power_off(void) {
118         for (;;) {
119         }
120 }
121
122 extern alt_t ao_max_height;
123
124 #define ao_async_stop()
125 #define ao_async_start()
126
127 #define LOG_MICRO_ASYNC 0
128
129 void ao_async_byte(char c);
130
131 #define ao_eeprom_read(pos, ptr, size) ao_storage_device_read(pos, ptr, size)
132 #define ao_eeprom_write(pos, ptr, size) ao_storage_device_write(pos, ptr, size)
133 #define N_SAMPLES_TYPE uint32_t
134 #define MAX_LOG_OFFSET  ao_storage_total
135 #define ao_storage_log_max ao_storage_total
136
137 extern uint32_t __flash__[];
138 extern uint32_t __flash_end__[];
139
140 #define AO_BOOT_APPLICATION_BOUND       ((uint32_t *) __flash__)
141 #define USE_STORAGE_CONFIG      0
142
143 #define HAS_STORAGE_DEBUG 1
144
145 #endif /* _AO_PINS_H_ */