Renamed clock-enable manager to rcc manager and improve some header files with doxygen comments

This commit is contained in:
2020-12-01 21:00:23 +01:00
parent ef8e6231ff
commit daaf848e0c
21 changed files with 168 additions and 23 deletions

View File

@@ -18,16 +18,44 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file oven-driver-hwcfg.h
* @brief hardware configuration for oven PWM driver
*/
#ifndef __OVEN_DRIVER_HWCFG_H__
#define __OVEN_DRIVER_HWCFG_H__
#include <stm32/stm32f4xx.h>
/**
* @brief Timer to use to generate PWM for oven
*/
#define OVEN_CONTROLLER_PWM_TIMER TIM3
/**
* @brief Port the oven control output is connected to
*/
#define OVEN_CONTROLLER_PORT GPIOB
/**
* @brief The Pin number the oven control output is located at
*/
#define OVEN_CONTROLLER_PIN (0)
/**
* @brief The AHB1ENR Bitmask to enable the clock to the output port #OVEN_CONTROLLER_PORT
*/
#define OVEN_CONTROLLER_PORT_RCC_MASK RCC_AHB1ENR_GPIOBEN
/**
* @brief The APB1ENR bitmask to enable the #OVEN_CONTROLLER_PWM_TIMER
*/
#define OVEN_CONTROLLER_TIM_RCC_MASK RCC_APB1ENR_TIM3EN
/**
* @brief The alternate function #OVEN_CONTROLLER_PWM_TIMER's pwm output is located on #OVEN_CONTROLLER_PORT
*/
#define OVEN_CONTROLLER_PIN_ALTFUNC (2)
#endif /* __OVEN_DRIVER_HWCFG_H__ */

View File

@@ -21,22 +21,82 @@
#ifndef __SAFETY_ADC_HWCFG_H__
#define __SAFETY_ADC_HWCFG_H__
/**
* @file safety-adc-hwcfg.h
* @brief Safety ADC configuration settings
*/
#include <stm32/stm32f4xx.h>
/**
* @brief Peripheral to use as safety ADC.
* @note This must be ADC1, because it is the only ADC with access to the internal temperature sensor
*/
#define SAFETY_ADC_ADC_PERIPHERAL ADC1
/**
* @brief Clock enable mask in RCC->APB2ENR to enable the #SAFETY_ADC_ADC_PERIPHERAL
*/
#define SAFETY_ADC_ADC_RCC_MASK RCC_APB2ENR_ADC1EN
/**
* @brief ADC channel number of the internal temperature sensor
*/
#define TEMP_CHANNEL_NUM (16)
/**
* @brief ADC channel number of the internal reference voltage
*/
#define INT_REF_CHANNEL_NUM (17)
/**
* @brief Nominal value of the internal reference voltage.
*
* This is used to compare to the external reference voltage.
*/
#define SAFETY_ADC_INT_REF_MV 1210.0f
/**
* @brief Nominal temperature in degrees celsius of the internal temperature sensor at which it reads
* #SAFETY_ADC_TEMP_NOM_MV millivolts.
*
*/
#define SAFETY_ADC_TEMP_NOM 25.0f
/**
* @brief Nominal internal temperature sensor voltage at temperature #SAFETY_ADC_TEMP_NOM
*/
#define SAFETY_ADC_TEMP_NOM_MV 760.0f
/**
* @brief Sensitivity of the internal temperature sensor in millivolts per Kelvin
*/
#define SAFETY_ADC_TEMP_MV_SLOPE 2.5f
/**
* @brief Number of channels to handle for the SAFETY ADC.
* @note The maximum amount of channels is limited to 16
*/
#define SAFETY_ADC_NUM_OF_CHANNELS 8
/**
* @brief Channel numbers to sample with the SAFETY ADC
*
* - The first 4 values are the internal temperature sensor
* - The next 4 values are the internal reference voltage
*
* The values are samples 4 times each to allow averaging them to get
* more precise readings. Check the maximum value of #SAFETY_ADC_NUM_OF_CHANNELS
* when adding more channels.
* @warning Safety controller expects the current measurment list. If you change it, check @ref safety_controller_handle_safety_adc
*/
#define SAFETY_ADC_CHANNELS TEMP_CHANNEL_NUM, TEMP_CHANNEL_NUM, TEMP_CHANNEL_NUM, TEMP_CHANNEL_NUM, \
INT_REF_CHANNEL_NUM, INT_REF_CHANNEL_NUM, INT_REF_CHANNEL_NUM, INT_REF_CHANNEL_NUM
/* Check the channel count of the safety ADC */
#if SAFETY_ADC_NUM_OF_CHANNELS > 16 || SAFETY_ADC_NUM_OF_CHANNELS < 0
#error "Invlaid count of channels for safety ADC"
#endif
#endif /* __SAFETY_ADC_HWCFG_H__ */