/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.h * @brief : Header for main.c file. * This file contains the common defines of the application. ****************************************************************************** * @attention * * Copyright (c) 2023 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MAIN_H #define __MAIN_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f0xx_hal.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include #include #include /* USER CODE END Includes */ /* Exported types ------------------------------------------------------------*/ /* USER CODE BEGIN ET */ struct HardFlags { volatile bool A_DMAComplete : 1; //T- ADC conversion completed volatile bool UART_TxComplete : 1; //T - one data point transmitted volatile bool sampleRateElapsed : 1; //T - when sampling should occur }; /* USER CODE END ET */ /* Exported constants --------------------------------------------------------*/ /* USER CODE BEGIN EC */ /* USER CODE END EC */ /* Exported macro ------------------------------------------------------------*/ /* USER CODE BEGIN EM */ /* USER CODE END EM */ /* Exported functions prototypes ---------------------------------------------*/ void Error_Handler(void); /* USER CODE BEGIN EFP */ void average(uint16_t *values, uint16_t *stream); /* USER CODE END EFP */ /* Private defines -----------------------------------------------------------*/ #define YELLOW_Pin GPIO_PIN_14 #define YELLOW_GPIO_Port GPIOB #define PINK_Pin GPIO_PIN_6 #define PINK_GPIO_Port GPIOC #define GREEN_Pin GPIO_PIN_8 #define GREEN_GPIO_Port GPIOC /* USER CODE BEGIN Private defines */ /* * The following are parameters for TIM1 * which is the sample counter..it * triggers TIM15 * Clock is 20MHz */ #define PRESCALE (20000 - 1) #define COUNT (1000 - 1) #define REP_CNTR (4 - 1) /* * The following are parameters for TIM15 * which is the a/d trigger * Clock is 20MHz */ #define DMA_TRIG_us (30 - 1) #define PULSE DMA_TRIG_us - 20 #define T 1 #define F 0 #define NO_ADC_CH 6 #define AVG 1 //must be power of 2; 1 minimum #define SHIFT (log2((double)AVG)) /* USER CODE END Private defines */ #ifdef __cplusplus } #endif #endif /* __MAIN_H */