From cdd0a0c2e4d3171b008c30728ccab511db040d62 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Sun, 11 Sep 2016 23:38:55 +0000 Subject: adc-power: include f1 tests --- tests/adc-power/main-stm32f103-generic.c | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/adc-power/main-stm32f103-generic.c (limited to 'tests/adc-power/main-stm32f103-generic.c') diff --git a/tests/adc-power/main-stm32f103-generic.c b/tests/adc-power/main-stm32f103-generic.c new file mode 100644 index 0000000..815ab16 --- /dev/null +++ b/tests/adc-power/main-stm32f103-generic.c @@ -0,0 +1,52 @@ +/* + * Oct 2015 Karl Palsson + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "trace.h" +#include "adc-power.h" + +#define LED_PORT GPIOC +#define LED_PIN GPIO13 + +int main(void) +{ + int i; + int j = 0; + rcc_clock_setup_in_hse_8mhz_out_72mhz(); + rcc_periph_clock_enable(RCC_GPIOC); + printf("hi guys!\n"); + /* green led for ticking */ + gpio_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, LED_PIN); + + rcc_periph_clock_enable(RCC_GPIOA); + gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO0); + gpio_set_mode(GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO5); + + + adc_power_init(); + while (1) { + adc_power_task_up(); + gpio_toggle(LED_PORT, LED_PIN); + + for (i = 0; i < 0x80000; i++) { /* Wait a bit. */ + __asm__("NOP"); + } + adc_power_task_down(); + gpio_toggle(LED_PORT, LED_PIN); + for (i = 0; i < 0x80000; i++) { /* Wait a bit. */ + __asm__("NOP"); + } + } + + return 0; +} -- cgit