DMA-based averager works! Also it dumps avg values to USB CDC
This commit is contained in:
@ -30,41 +30,59 @@ extern "C" {
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
#define LED_RED_Pin GPIO_PIN_14
|
||||
#define LED_RED_GPIO_Port GPIOB
|
||||
#define LED_BLUE_Pin GPIO_PIN_7
|
||||
#define LED_BLUE_GPIO_Port GPIOB
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
#define LED_RED_Pin GPIO_PIN_14
|
||||
#define LED_RED_GPIO_Port GPIOB
|
||||
#define LED_BLUE_Pin GPIO_PIN_7
|
||||
#define LED_BLUE_GPIO_Port GPIOB
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
/* Shared ADC app types and declarations */
|
||||
|
||||
/* Size of circular DMA buffer for ADC1 */
|
||||
#ifndef ADC_BUFF_SIZE
|
||||
#define ADC_BUFF_SIZE 100
|
||||
#endif
|
||||
|
||||
/* Structure describing simple accumulation state for ADC processing */
|
||||
struct ADC_proc {
|
||||
uint8_t status; /* 0 - stopped, 1 - collecting, 2 - filled */
|
||||
uint32_t sum;
|
||||
uint32_t avg;
|
||||
uint32_t N;
|
||||
};
|
||||
|
||||
/* Externs provided by main.c */
|
||||
extern struct ADC_proc adc_process;
|
||||
extern uint16_t ADC1_buff_circular[ADC_BUFF_SIZE];
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user