demo hacking -- disable everything but ADC
authorKeith Packard <keithp@keithp.com>
Sun, 17 Jun 2018 07:15:14 +0000 (00:15 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 17 Jun 2018 07:15:14 +0000 (00:15 -0700)
Make sure it still works without any other configuration

Signed-off-by: Keith Packard <keithp@keithp.com>
src/stm-demo-adc/Makefile
src/stm-demo-adc/ao_demo.c
src/stm-demo-adc/ao_pins.h

index 7870792e230bab4a1c955443bfd318154a288a7a..e59a0c43832874ff5b35129c828ec2825c53bc89 100644 (file)
@@ -33,7 +33,6 @@ ALTOS_SRC = \
        ao_dma_stm.c \
        ao_spi_stm.c \
        ao_adc_single_stm.c \
-       ao_data.c \
        ao_i2c_stm.c \
        ao_usb_stm.c \
        ao_exti_stm.c
index 75716c1c2f6f8d19eac55bb4db95ab1ca5569f47..5ba4336f03a4d4d2ab5f6fbb94908fc8668aa4a2 100644 (file)
@@ -24,6 +24,7 @@
 #include <ao_boot.h>
 #include <ao_adc_single.h>
 
+#if 0
 struct ao_task demo_task;
 
 static inline int min(int a, int b) { return a < b ? a : b; }
@@ -50,14 +51,6 @@ ao_demo(void)
        }
 }
 
-void _close() { }
-void _sbrk() { }
-void _isatty() { }
-void _lseek() { }
-void _exit () { }
-void _read () { }
-void _fstat() { }
-
 #define AO_DMA_TEST_INDEX      STM_DMA_INDEX(4)
 
 static void
@@ -138,7 +131,7 @@ ao_i2c_write(void) {
                ao_delay(100);
        }
 }
-
+#endif
 
 static void
 ao_temp (void)
@@ -181,6 +174,7 @@ ao_event(void)
 }
 #endif
 
+#if 0
 static uint8_t ao_blinking = 0;
 
 static void
@@ -204,16 +198,21 @@ ao_blink_toggle(void)
        ao_blinking = !ao_blinking;
        ao_wakeup(&ao_blinking);
 }
+#endif
 
 
 __code struct ao_cmds ao_demo_cmds[] = {
+#if 0
        { ao_dma_test,  "D\0DMA test" },
        { ao_spi_write, "W\0SPI write" },
        { ao_spi_read, "R\0SPI read" },
        { ao_i2c_write, "i\0I2C write" },
+#endif
        { ao_temp, "t\0Show temp" },
+#if 0
        { ao_blink_toggle, "b\0Toggle LED blinking" },
 /*     { ao_event, "e\0Monitor event queue" }, */
+#endif
        { 0, NULL }
 };
 
@@ -221,14 +220,13 @@ int
 main(void)
 {
        ao_clock_init();
-       
        ao_task_init();
-
-       ao_led_init(LEDS_AVAILABLE);
-       ao_led_on(AO_LED_GREEN);
-       ao_led_off(AO_LED_BLUE);
        ao_timer_init();
        ao_dma_init();
+
+//     ao_led_init(LEDS_AVAILABLE);
+//     ao_led_on(AO_LED_GREEN);
+//     ao_led_off(AO_LED_BLUE);
        ao_cmd_init();
 //     ao_lcd_stm_init();
 //     ao_lcd_font_init();
@@ -243,7 +241,7 @@ main(void)
        ao_adc_single_init();
        ao_usb_init();
 
-       ao_add_task(&ao_blink_task, ao_blink, "blink");
+//     ao_add_task(&ao_blink_task, ao_blink, "blink");
        ao_cmd_register(&ao_demo_cmds[0]);
        
        ao_start_scheduler();
index 428fcde99aab90d1aee3001da0de491bfed5841b..1ca7d8a6aceb7211a2c6f50a8382296991535fb3 100644 (file)
@@ -146,27 +146,32 @@ struct ao_adc {
        int16_t                 idd;
        int16_t                 temp;
        int16_t                 vref;
+       int16_t                 pot;
 };
 
-#define AO_ADC_DUMP(p) printf("idd %5d temp %5d vref %5d\n", \
-                              (p)->idd, (p)->temp, (p)->vref)
+#define AO_ADC_DUMP(p) printf("idd %5d temp %5d vref %5d pot %5d\n", \
+                              (p)->idd, (p)->temp, (p)->vref, (p)->pot)
 
 #define AO_ADC_IDD             4
 #define AO_ADC_PIN0_PORT       (&stm_gpioa)
 #define AO_ADC_PIN0_PIN                4
 
+#define AO_ADC_POT             5
+#define AO_ADC_PIN1_PORT       (&stm_gpioa)
+#define AO_ADC_PIN1_PIN                5
+
 #define AO_ADC_RCC_AHBENR      ((1 << STM_RCC_AHBENR_GPIOAEN))
 #define AO_ADC_TEMP            16
 #define AO_ADC_VREF            17
 
 #define HAS_ADC_TEMP           1
 
-#define AO_DATA_RING           32
-#define AO_NUM_ADC             3
+#define AO_NUM_ADC             4
 
 #define AO_ADC_SQ1             AO_ADC_IDD
 #define AO_ADC_SQ2             AO_ADC_TEMP
 #define AO_ADC_SQ3             AO_ADC_VREF
+#define AO_ADC_SQ4             AO_ADC_POT
        
 #define HAS_I2C_1              1
 #define I2C_1_PB6_PB7          0