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