Add force boot loader to ADC readings for testing
authorKeith Packard <keithp@keithp.com>
Tue, 13 Apr 2021 06:24:24 +0000 (23:24 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 13 Apr 2021 06:24:24 +0000 (23:24 -0700)
src/easymotor-v2/ao_pins.h

index 097ecb4551fad8c432d0c9b0b5d34555bf073fd6..787b9326ad069b78730da4196070a5afc570d1c3 100644 (file)
 #define AO_ADC_PIN1_PIN                1
 #define AO_ADC_PIN1_CH         1
 
+#define AO_ADC_PIN2_PORT       (&stm_gpioa)    /* v_batt */
+#define AO_ADC_PIN2_PIN                3
+#define AO_ADC_PIN2_CH         3
+
 #define AO_ADC_RCC_AHBENR       ((1 << STM_RCC_AHBENR_IOPAEN))
 
-#define AO_NUM_ADC             2
+#define AO_NUM_ADC             3
 
 #define AO_DATA_RING           64
 
 struct ao_adc {
        int16_t                 motor_pressure;
        int16_t                 v_batt;
+       int16_t                 force_bootloader;
 };
 
-#define AO_ADC_DUMP(p) \
-       printf("tick: %5u motor_pressure: %5d batt: %5d\n", \
-              (p)->tick, \
-              (p)->adc.motor_pressure, \
-              (p)->adc.v_batt);
+#define AO_ADC_DUMP(p)                                                 \
+       printf("tick: %5u motor_pressure: %5d batt: %5d boot: %5d\n",   \
+              (p)->tick,                                               \
+              (p)->adc.motor_pressure,                                 \
+              (p)->adc.v_batt,                                         \
+              (p)->adc.force_bootloader);
 
 
 /*