#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; }
}
}
-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
ao_delay(100);
}
}
-
+#endif
static void
ao_temp (void)
}
#endif
+#if 0
static uint8_t ao_blinking = 0;
static 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 }
};
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();
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();
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