altos/stm: Make beeper driver support all possible tim234 configs
[fw/altos] / src / easymega-v1.0 / ao_pins.h
index 0b6c0f0700813d1dfe5eab91ca6469d51afce89e..bfa777c66401466a9348abd6f7a2c1da4687bc84 100644 (file)
@@ -1,9 +1,10 @@
 /*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ * Copyright © 2014 Bdale Garbee <bdale@gag.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -46,7 +47,7 @@
 #define HAS_SERIAL_1           0
 #define USE_SERIAL_1_STDIN     0
 #define SERIAL_1_PB6_PB7       0
-#define SERIAL_1_PA9_PA10      1
+#define SERIAL_1_PA9_PA10      0
 
 #define HAS_SERIAL_2           0
 #define USE_SERIAL_2_STDIN     0
 #define HAS_SERIAL_3           0
 #define USE_SERIAL_3_STDIN     0
 #define SERIAL_3_PB10_PB11     0
-#define SERIAL_3_PC10_PC11     1
+#define SERIAL_3_PC10_PC11     0
 #define SERIAL_3_PD8_PD9       0
 
+#define ao_gps_getchar         ao_serial1_getchar
+#define ao_gps_putchar         ao_serial1_putchar
+#define ao_gps_set_speed       ao_serial1_set_speed
+#define ao_gps_fifo            (ao_stm_usart1.rx_fifo)
+
 #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX       (1024 * 1024)
+#define AO_CONFIG_MAX_SIZE                     1024
+#define LOG_ERASE_MARK                         0x55
+#define LOG_MAX_ERASE                          128
+#define AO_LOG_FORMAT                          AO_LOG_FORMAT_TELEMEGA
+
 #define HAS_EEPROM             1
 #define USE_INTERNAL_FLASH     0
 #define USE_EEPROM_CONFIG      1
 #define USE_STORAGE_CONFIG     0
 #define HAS_USB                        1
 #define HAS_BEEP               1
+#define BEEPER_TIMER           3
+#define BEEPER_CHANNEL         1
+#define BEEPER_PORT            (&stm_gpioc)
+#define BEEPER_PIN             6
+#define HAS_BATTERY_REPORT     1
 #define HAS_RADIO              0
 #define HAS_TELEMETRY          0
 #define HAS_APRS               0
+#define HAS_COMPANION          1
 
 #define HAS_SPI_1              1
 #define SPI_1_PA5_PA6_PA7      1       /* Barometer */
 #define SPI_2_PD1_PD3_PD4      0
 #define SPI_2_OSPEEDR          STM_OSPEEDR_10MHz
 
-#if 0
 #define SPI_2_PORT             (&stm_gpiob)
 #define SPI_2_SCK_PIN          13
 #define SPI_2_MISO_PIN         14
 #define SPI_2_MOSI_PIN         15
-#endif
 
 #define HAS_I2C_1              1
 #define I2C_1_PB8_PB9          1
 
 #define LOW_LEVEL_DEBUG                0
 
-#define LED_PORT_ENABLE                STM_RCC_AHBENR_GPIOCEN
+#define LED_PORT_ENABLE                STM_RCC_AHBENR_GPIOAEN
 #define LED_PORT               (&stm_gpioa)
 #define LED_PIN_RED            9
 #define LED_PIN_GREEN          10
 /* Number of general purpose pyro channels available */
 #define AO_PYRO_NUM    4
 
-#define AO_IGNITER_SET_DROGUE(v)       stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v)
-#define AO_IGNITER_SET_MAIN(v)         stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v)
-
 /*
  * ADC
  */
@@ -199,7 +211,7 @@ struct ao_adc {
 
 #define AO_ADC_SENSE_MAIN      10
 #define AO_ADC_SENSE_MAIN_PORT (&stm_gpioc)
-#define AO_ADC_SENSE_MAIN_PIN          0
+#define AO_ADC_SENSE_MAIN_PIN  0
 
 #define AO_ADC_V_BATT          8
 #define AO_ADC_V_BATT_PORT     (&stm_gpiob)
@@ -211,7 +223,8 @@ struct ao_adc {
 
 #define AO_ADC_TEMP            16
 
-#define AO_ADC_RCC_AHBENR      ((1 << STM_RCC_AHBENR_GPIOEEN) | \
+#define AO_ADC_RCC_AHBENR      ((1 << STM_RCC_AHBENR_GPIOAEN) | \
+                                (1 << STM_RCC_AHBENR_GPIOEEN) | \
                                 (1 << STM_RCC_AHBENR_GPIOBEN))
 
 #define AO_NUM_ADC_PIN         (AO_ADC_NUM_SENSE + 2)
@@ -270,10 +283,10 @@ struct ao_adc {
 #define AO_MS5607_PRIVATE_PINS 1
 #define AO_MS5607_CS_PORT      (&stm_gpioa)
 #define AO_MS5607_CS_PIN       3
-#define AO_MS5607_CS_MASK      (1 << AO_MS5607_CS)
+#define AO_MS5607_CS_MASK      (1 << AO_MS5607_CS_PIN)
 #define AO_MS5607_MISO_PORT    (&stm_gpioa)
 #define AO_MS5607_MISO_PIN     6
-#define AO_MS5607_MISO_MASK    (1 << AO_MS5607_MISO)
+#define AO_MS5607_MISO_MASK    (1 << AO_MS5607_MISO_PIN)
 #define AO_MS5607_SPI_INDEX    AO_SPI_1_PA5_PA6_PA7
 
 /*
@@ -282,7 +295,8 @@ struct ao_adc {
 
 #define M25_MAX_CHIPS          1
 #define AO_M25_SPI_CS_PORT     (&stm_gpiob)
-#define AO_M25_SPI_CS_MASK     (1 << 12)
+#define AO_M25_SPI_CS_PIN      12
+#define AO_M25_SPI_CS_MASK     (1 << AO_M25_SPI_CS_PIN)
 #define AO_M25_SPI_BUS         AO_SPI_2_PB13_PB14_PB15
 
 /*
@@ -311,6 +325,7 @@ struct ao_adc {
  */
 
 #define HAS_MMA655X            1
+#define AO_MMA655X_INVERT      0
 #define AO_MMA655X_SPI_INDEX   AO_SPI_1_PB3_PB4_PB5
 #define AO_MMA655X_CS_PORT     (&stm_gpioc)
 #define AO_MMA655X_CS_PIN      12