diff --git a/Makefile b/Makefile index c731f95d..b340647b 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ C_SOURCES = \ Src/stm32f4xx_hal_msp.c \ Src/gpio.c \ Src/freertos.c \ + Src/test.c \ Src/stm32f4xx_it.c \ Src/adc.c \ Src/usbd_conf.c @@ -96,7 +97,8 @@ AS_DEFS = C_DEFS = -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -DUSE_HAL_DRIVER -DSTM32F405xx # includes for gcc AS_INCLUDES = -C_INCLUDES = -IInc +C_INCLUDES = -I. +C_INCLUDES += -IInc C_INCLUDES += -IDrivers/CMSIS/Device/ST/STM32F4xx/Include C_INCLUDES += -IDrivers/CMSIS/Include C_INCLUDES += -IDrivers/STM32F4xx_HAL_Driver/Inc diff --git a/Src/freertos.c b/Src/freertos.c index e90d66d0..4eddf08c 100644 --- a/Src/freertos.c +++ b/Src/freertos.c @@ -36,7 +36,7 @@ #include "task.h" #include "cmsis_os.h" -/* USER CODE BEGIN Includes */ +/* USER CODE BEGIN Includes */ #include "test.h" /* USER CODE END Includes */ diff --git a/Src/test.c b/Src/test.c index d9b38460..66dc4880 100644 --- a/Src/test.c +++ b/Src/test.c @@ -1,6 +1,8 @@ #include "test.h" +#include "cmsis_os.h" +#include "stm32f4xx.h" #include "stm32f4xx_hal_adc.h" #include "adc.h" @@ -12,6 +14,14 @@ void test_main(void) { // Simple loop to read ADC1 static void test_read_ADC(void){ - HAL_ADC_Start(&hadc1); - + int measnum = 0; + for (;;) { + HAL_ADC_Start(&hadc1); + osDelay(2); + if (HAL_ADC_PollForConversion(&hadc1, 1000) == HAL_OK) { + uint32_t ADCValue = HAL_ADC_GetValue(&hadc1); + ++measnum; + } + osDelay(1000); + } }