altos/easytimer-v2: Fix up ao_pins.h
[fw/altos] / src / easytimer-v2 / ao_pins.h
index e00d90931a5145d8656e848c7107f328fb262fce..3acafb612de3a1247c19a3ebaaebd588f0eb892e 100644 (file)
@@ -29,7 +29,7 @@
 
 #define AO_CONFIG_MAX_SIZE     1024
 
-#define HAS_EEPROM             0
+#define HAS_EEPROM             1
 #define USE_INTERNAL_FLASH     0
 #define USE_EEPROM_CONFIG      0
 #define USE_STORAGE_CONFIG     1
@@ -56,7 +56,7 @@
 #define HAS_FLIGHT             1
 #define HAS_ADC                        1
 #define HAS_ADC_TEMP           1
-#define HAS_LOG                        0
+#define HAS_LOG                        1
 
 /*
  * Igniter
@@ -149,18 +149,35 @@ struct ao_adc {
  */
 
 #define M25_MAX_CHIPS          1
-#define AO_M25_SPI_CS_PORT     (&samd21_port_a)
-#define AO_M25_SPI_CS_MASK     (1 << 27)
+#define AO_M25_SPI_CS_PORT     (&samd21_port_b)
+#define AO_M25_SPI_CS_MASK     (1 << 10)
 #define AO_M25_SPI_BUS         AO_SPI_0_PA04_PA05_PA06
 
 /*
- * On EasyTimer v2, bmi088 pin 1 (NE corner of chip) is placed towards the
- * USB and antenna edges of the board. Relative to bmi088 specs, to
- * get the above values, we need to flip the Y axis, assigning values
- * as follows:
  *
- *     +along          +X      +roll   +X
- *     +across         -Y      +pitch  -Y
+ * Here are the required sensor signs:
+ *
+ * +along      nose up
+ * +across     switch screws down
+ * +through    TH down
+ *
+ * With the board aligned to have positive accel for the relevant
+ * axis, looking down from above we have:
+ *
+ * +roll       counter clockwise (nose up)
+ * +pitch      counter clockwise (switch screws down)
+ * +yaw                counter clockwise (TH down)
+ */
+
+
+/*
+ * On EasyTimer v2, bmi088 pin 1 (NE corner of chip) is placed away
+ * from the USB edge of the board. Relative to bmi088 specs, to get
+ * the above values, we need to flip the X and Y axes, assigning
+ * values as follows:
+ *
+ *     +along          -Y      +roll   -Y
+ *     +across         -X      +pitch  -X
  *     +through        +Z      +yaw    +Z
  */
 
@@ -172,12 +189,12 @@ struct ao_adc {
 #define AO_BMI088_GYR_CS_PIN   11
 #define HAS_IMU                        1
 
-#define ao_bmi088_along(m)     ((m)->acc.x)
-#define ao_bmi088_across(m)    (-(m)->acc.y)
+#define ao_bmi088_along(m)     (-(m)->acc.y)
+#define ao_bmi088_across(m)    (-(m)->acc.x)
 #define ao_bmi088_through(m)   ((m)->acc.z)
 
-#define ao_bmi088_roll(m)      ((m)->gyr.x)
-#define ao_bmi088_pitch(m)     (-(m)->gyr.y)
+#define ao_bmi088_roll(m)      (-(m)->gyr.y)
+#define ao_bmi088_pitch(m)     (-(m)->gyr.x)
 #define ao_bmi088_yaw(m)       ((m)->gyr.z)
 
 #define ao_data_along(packet)  ao_bmi088_along(&(packet)->bmi088)
@@ -193,7 +210,7 @@ struct ao_adc {
  *
  *     pin 1 NE corner of chip
  *
- *     +along          -Y
+ *     +along          +Y
  *     +across         +X
  *     +through        -Z
  */
@@ -211,7 +228,7 @@ struct ao_adc {
 #define AO_MMC5983_SPI_CS_PORT         (&samd21_port_a)
 #define AO_MMC5983_SPI_CS_PIN          8
 
-#define ao_mmc5983_along(m)            (-(m)->y)
+#define ao_mmc5983_along(m)            ((m)->y)
 #define ao_mmc5983_across(m)           ((m)->x)
 #define ao_mmc5983_through(m)          (-(m)->z)
 
@@ -229,4 +246,15 @@ struct ao_adc {
 #define AO_MONITOR_LED         0
 #define HAS_RSSI               0
 
+/*
+ * Logging
+ */
+
+#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_EASYTIMER_2
+#define AO_LOG_NORMALIZED                      1
+
 #endif /* _AO_PINS_H_ */