telegps-v2.0: Remove fec_tx code and ADC logging.
[fw/altos] / src / telegps-v2.0 / ao_pins.h
1 /*
2  * Copyright © 2017 Bdale Garbee <bdale@gag.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_IOPBEN
23 #define LED_PORT        (&stm_gpiob)
24 #define LED_PIN_RED     5
25 #define AO_LED_RED      (1 << LED_PIN_RED)
26
27 #define LEDS_AVAILABLE  (AO_LED_RED)
28
29 #define IS_FLASH_LOADER         0
30 #define HAS_BEEP               0
31
32 #define AO_HSE                  32000000
33 #define AO_RCC_CFGR_PLLMUL      STM_RCC_CFGR_PLLMUL_3
34 #define AO_PLLMUL               3
35 #define AO_PLLDIV               1
36
37 /* HCLK = 48MHz */
38 #define AO_AHB_PRESCALER        1
39 #define AO_RCC_CFGR_HPRE_DIV    STM_RCC_CFGR_HPRE_DIV_1
40
41 /* APB = 48MHz */
42 #define AO_APB_PRESCALER        1
43 #define AO_RCC_CFGR_PPRE_DIV    STM_RCC_CFGR_PPRE_DIV_1
44
45 #define AO_RCC_CFGR2_PLLDIV     STM_RCC_CFGR2_PREDIV_1
46
47 #define HAS_USB                         1
48 #define AO_USB_DIRECTIO                 0
49 #define AO_PA11_PA12_RMP                1
50
51 #define IS_FLASH_LOADER 0
52
53 /* ADC */
54
55 #define HAS_ADC                 1
56 #define AO_ADC_PIN0_PORT        (&stm_gpioa)
57 #define AO_ADC_PIN0_PIN         0
58 #define AO_ADC_PIN0_CH          0
59
60 #define AO_ADC_RCC_AHBENR       ((1 << STM_RCC_AHBENR_IOPAEN))
61
62 #define AO_NUM_ADC              1
63
64 #define AO_DATA_RING            4
65
66 /*
67  * Voltage divider on ADC battery sampler
68  */
69 #define AO_BATTERY_DIV_PLUS     56      /* 5.6k */
70 #define AO_BATTERY_DIV_MINUS    100     /* 10k */
71
72 /*
73  * ADC reference in decivolts
74  */
75 #define AO_ADC_REFERENCE_DV     33
76
77 struct ao_adc {
78         int16_t                 v_batt;
79 };
80
81 #define AO_ADC_DUMP(p) \
82         printf("tick: %5u batt: %5d\n", \
83                (p)->tick, \
84                (p)->adc.v_batt)
85
86 /* SPI */
87 #define HAS_SPI_1               1
88 #define HAS_SPI_2               0
89 #define SPI_1_PA5_PA6_PA7       1
90 #define SPI_1_PB3_PB4_PB5       0
91 #define SPI_1_OSPEEDR           STM_OSPEEDR_HIGH
92
93 #define HAS_MS5607              0
94
95 /* Flash */
96
97 #define M25_MAX_CHIPS           1
98 #define AO_M25_SPI_CS_PORT      (&stm_gpiob)
99 #define AO_M25_SPI_CS_MASK      (1 << 0)
100 #define AO_M25_SPI_BUS          AO_SPI_1_PA5_PA6_PA7
101
102 #define HAS_SERIAL_1            1
103 #define SERIAL_1_PB6_PB7        1
104 #define USE_SERIAL_1_STDIN      0
105
106 #define ao_gps_getchar          ao_serial1_getchar
107 #define ao_gps_putchar          ao_serial1_putchar
108 #define ao_gps_set_speed        ao_serial1_set_speed
109 #define ao_gps_fifo             (ao_usart_rx_fifo)
110
111 #define HAS_EEPROM              1
112 #define USE_INTERNAL_FLASH      0
113 #define HAS_RADIO               1
114 #define HAS_TELEMETRY           1
115 #define HAS_RDF                 1
116 #define HAS_APRS                1
117 #define HAS_RADIO_RECV          0
118
119 #define HAS_GPS                 1
120 #define HAS_FLIGHT              0
121 #define HAS_LOG                 1
122 #define FLIGHT_LOG_APPEND       1
123 #define HAS_TRACKER             1
124 #define LOG_ADC                 0
125
126 #define AO_CONFIG_DEFAULT_APRS_INTERVAL         0
127 #define AO_CONFIG_DEFAULT_RADIO_POWER           0xc0
128
129 /*
130  * GPS
131  */
132
133 #define AO_SERIAL_SPEED_UBLOX   AO_SERIAL_SPEED_9600
134
135
136 /*
137  * Radio (cc1120)
138  */
139
140 /* gets pretty close to 434.550 */
141
142 #define AO_RADIO_CAL_DEFAULT    5695733
143
144 #define AO_FEC_DEBUG            0
145 #define AO_CC1200_SPI_CS_PORT   (&stm_gpioa)
146 #define AO_CC1200_SPI_CS_PIN    5
147 #define AO_CC1200_SPI_BUS       AO_SPI_1_PA5_PA6_PA7
148 #define AO_CC1200_SPI           stm_spi1
149 #define AO_CC1200_SPI_SPEED     AO_SPI_SPEED_FAST
150
151 #define AO_CC1200_INT_PORT              (&stm_gpioa)
152 #define AO_CC1200_INT_PIN               4
153 #define AO_CC1200_MCU_WAKEUP_PORT       (&stm_gpioa)
154 #define AO_CC1200_MCU_WAKEUP_PIN        (0)
155
156 #define AO_CC1200_INT_GPIO      2
157 #define AO_CC1200_INT_GPIO_IOCFG        CC1200_IOCFG2
158
159 #define AO_CC1200_MARC_GPIO     3
160 #define AO_CC1200_MARC_GPIO_IOCFG       CC1200_IOCFG3
161
162 #define HAS_BOOT_RADIO          0
163
164 #endif /* _AO_PINS_H_ */