altos/telelco: Add RSSI display to older devices
[fw/altos] / src / metro-m0 / ao_pins.h
index 285d991abc739ad28d703b989339048f8d55f293..0f276c1f2f343bbf9933a88cfd3495676305e460 100644 (file)
@@ -26,8 +26,6 @@
 
 #define AO_LED_PANIC   LED_BLUE
 
-#define HAS_BEEP       0
-
 #define HAS_USB                1
 #define USE_USB_STDIO  1
 
 #define AO_APBA_PRESCALER      1
 
 #define HAS_SPI_0              1
-#define SPI_0_PA08_PA09_PA10   1
+#define HAS_SPI_5              1
+
+/*
+ * SPI Flash memory
+ */
+
+#define M25_MAX_CHIPS          1
+
+#if 1
+#define AO_M25_SPI_CS_PORT     (&samd21_port_a)
+#define AO_M25_SPI_CS_MASK     (1 << 13)
+#define AO_M25_SPI_BUS         AO_SPI_5_PB22_PB23_PB03
+#else
+
+#define AO_M25_SPI_CS_PORT     (&samd21_port_a)
+#define AO_M25_SPI_CS_MASK     (1 << 14) /* D2 */
+#define AO_M25_SPI_BUS         AO_SPI_4_PB10_PB11_PA12
+
+#endif
+
+/*
+ * Beeper
+ */
+
+#define HAS_BEEP               1
+
+/* Beep on PA11 function F TCC0.3 */
+
+#define AO_BEEP_TCC    (&samd21_tcc0)
+#define AO_BEEP_TCC_APBC_MASK  SAMD21_PM_APBCMASK_TCC0
+#define AO_BEEP_PORT   (&samd21_port_a)
+#define AO_BEEP_PIN    (11)
+#define AO_BEEP_FUNC   SAMD21_PORT_PMUX_FUNC_F
+
+/* ADC */
+#define AO_DATA_RING           32
+
+#define HAS_ADC                        1
+
+struct ao_adc {
+       int16_t                 a[6];
+       int16_t                 temp;
+};
+
+#define AO_NUM_ADC_PIN 6
+#define AO_NUM_ADC     (AO_NUM_ADC_PIN + 1)
+
+#define AO_ADC_DUMP(p)                                                 \
+       printf("tick: %5lu a0: %5d a1: %5d a2: %5d a3: %5d a4: %5d a5: %5d temp: %5d\n", \
+              (p)->tick,                                               \
+              (p)->adc.a[0], (p)->adc.a[1], (p)->adc.a[2],             \
+              (p)->adc.a[3], (p)->adc.a[4], (p)->adc.a[5],             \
+              (p)->adc.temp);
+
+#define AO_ADC_PIN0_PORT       (&samd21_port_a)
+#define AO_ADC_PIN0_PIN                2
+#define AO_ADC_SQ0             0
+
+#define AO_ADC_PIN1_PORT       (&samd21_port_b)
+#define AO_ADC_PIN1_PIN                8
+#define AO_ADC_SQ1             2
+
+#define AO_ADC_PIN2_PORT       (&samd21_port_b)
+#define AO_ADC_PIN2_PIN                9
+#define AO_ADC_SQ2             3
+
+#define AO_ADC_PIN3_PORT       (&samd21_port_a)
+#define AO_ADC_PIN3_PIN                4
+#define AO_ADC_SQ3             4
+
+#define AO_ADC_PIN4_PORT       (&samd21_port_a)
+#define AO_ADC_PIN4_PIN                5
+#define AO_ADC_SQ4             5
+
+#define AO_ADC_PIN5_PORT       (&samd21_port_b)
+#define AO_ADC_PIN5_PIN                2
+#define AO_ADC_SQ5             10
+
+#define AO_ADC_SQ6             SAMD21_ADC_INPUTCTRL_MUXPOS_TEMP
+
+/* GPS */
+#define HAS_GPS                        1
+
+#define AO_SERIAL_SPEED_UBLOX  AO_SERIAL_SPEED_9600
+
+#define HAS_SERIAL_0           1
+#define USE_SERIAL_0_STDIN     0
+#define SERIAL_0_PA08_PA09     1
+
+#define ao_gps_getchar         ao_serial0_getchar
+#define ao_gps_putchar         ao_serial0_putchar
+#define ao_gps_set_speed       ao_serial0_set_speed
+#define ao_gps_fifo            (ao_samd21_usart0.rx_fifo)
 
 #endif /* _AO_PINS_H_ */