altos: Add easymini-v0.1 product
[fw/altos] / src / easymini-v0.1 / ao_pins.h
1 /*
2  * Copyright © 2013 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 #define HAS_BEEP        1
19 #define HAS_LED         1
20
21 /* Crystal on the board */
22 #define AO_LPC_CLKIN    12000000
23
24 /* Main clock frequency. 48MHz for USB so we don't use the USB PLL */
25 #define AO_LPC_CLKOUT   48000000
26
27 /* System clock frequency */
28 #define AO_LPC_SYSCLK   24000000
29
30 #define LED_PORT        0
31 #define LED_PIN_RED     7
32
33 #define AO_LED_RED      (1 << LED_PIN_RED)
34
35 #define LEDS_AVAILABLE  AO_LED_RED
36
37 #define HAS_USB         1
38
39 #define HAS_USB_CONNECT 1
40 #define HAS_USB_VBUS    1
41
42 #define PACKET_HAS_SLAVE        0
43
44 /* USART */
45
46 #define HAS_SERIAL              1
47 #define USE_SERIAL_0_STDIN      1
48 #define SERIAL_0_18_19          1
49 #define SERIAL_0_14_15          0
50 #define SERIAL_0_17_18          0
51 #define SERIAL_0_26_27          0
52
53 /* SPI */
54
55 #define HAS_SPI_0               1
56 #define HAS_SPI_1               1
57 #define SPI_SCK1_P1_15          1
58 #define SPI_MISO1_P0_22         1
59 #define SPI_MOSI1_P0_21         1
60
61 /* M25 */
62
63 #define M25_MAX_CHIPS           1
64 #define AO_M25_SPI_CS_PORT      0
65 #define AO_M25_SPI_CS_MASK      (1 << 23)
66 #define AO_M25_SPI_BUS          1
67
68 /* MS5607 */
69
70 #define HAS_MS5607              1
71 #define HAS_MS5611              0
72 #define AO_MS5607_PRIVATE_PINS  0
73 #define AO_MS5607_CS_PORT       0
74 #define AO_MS5607_CS_PIN        7
75 #define AO_MS5607_CS_MASK       (1 << AO_MS5607_CS)
76 #define AO_MS5607_MISO_PORT     0
77 #define AO_MS5607_MISO_PIN      8
78 #define AO_MS5607_MISO_MASK     (1 << AO_MS5607_MISO)
79 #define AO_MS5607_SPI_INDEX     0
80
81 #define HAS_ACCEL               0
82 #define HAS_GPS                 0
83 #define HAS_RADIO               0
84 #define HAS_FLIGHT              1
85 #define HAS_EEPROM              1
86 #define HAS_TELEMETRY           0
87 #define HAS_APRS                0
88 #define HAS_LOG                 1
89 #define USE_INTERNAL_FLASH      0
90
91 #define AO_DATA_RING            16
92
93 /*
94  * ADC
95  */
96
97 #define HAS_ADC                 1
98
99 #define AO_NUM_ADC              3
100
101 #define AO_ADC_0                1
102 #define AO_ADC_1                1
103 #define AO_ADC_2                1
104
105 struct ao_adc {
106         int16_t         sense_d;
107         int16_t         sense_m;
108         int16_t         v_batt;
109 };
110
111 /*
112  * Igniter
113  */
114
115 #define AO_IGNITER_CLOSED       400
116 #define AO_IGNITER_OPEN         60
117
118 #define AO_IGNITER_DROGUE_PORT  0
119 #define AO_IGNITER_DROGUE_PIN   4
120 #define AO_IGNITER_SET_DROGUE(v)        ao_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, v)
121
122 #define AO_IGNITER_MAIN_PORT    0
123 #define AO_IGNITER_MAIN_PIN     5
124 #define AO_IGNITER_SET_MAIN(v)          ao_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, v)
125
126 #define AO_ADC_DUMP(p) \
127         printf("tick: %5u drogue: %5d main: %5d batt: %5d\n", \
128                (p)->tick, (p)->adc.sense_d, (p)->adc.sense_m, (p)->adc.v_batt)