HardFOC Vortex V1 HAL
Unified HAL API for the HardFOC Vortex motor-control platform (ESP32-C6, TMC9660)
Loading...
Searching...
No Matches
VortexNtcConfig.h
Go to the documentation of this file.
1
13#ifndef VORTEX_NTC_CONFIG_H_
14#define VORTEX_NTC_CONFIG_H_
15
16#include <cstddef>
17#include <cstdint>
18
19#include "core/hf-core-drivers/internal/hf-pincfg/src/hf_functional_pin_config_vortex_v1.hpp"
20#include "handlers/ntc/NtcTemperatureHandler.h"
21
22namespace vortex::config {
23
25inline constexpr HfFunctionalAdcChannel kBoardNtcAdcChannel = HfFunctionalAdcChannel::TMC9660_AIN3;
26
28[[nodiscard]] constexpr uint8_t BoardNtcHwChannel() noexcept {
29 return HF_ADC_MAPPING[static_cast<size_t>(kBoardNtcAdcChannel)].physical_channel;
30}
31
32static_assert(HF_ADC_MAPPING[static_cast<size_t>(kBoardNtcAdcChannel)].chip_type ==
33 static_cast<uint8_t>(HfAdcChipType::TMC9660_CONTROLLER),
34 "Board NTC must be on a TMC9660 ADC input");
35static_assert(BoardNtcHwChannel() == 3, "Board NTC is on TMC9660 AIN3");
36
38inline constexpr float kBoardNtcLowThresholdC = 0.0f;
39inline constexpr float kBoardNtcHighThresholdC = 85.0f;
40
47[[nodiscard]] inline ntc_temp_handler_config_t MakeBoardNtcConfig() noexcept {
48 ntc_temp_handler_config_t cfg = NTC_TEMP_HANDLER_CONFIG_DEFAULT();
49 cfg.adc_channel = BoardNtcHwChannel();
50 cfg.enable_threshold_monitoring = true;
51 cfg.low_threshold_celsius = kBoardNtcLowThresholdC;
52 cfg.high_threshold_celsius = kBoardNtcHighThresholdC;
53 return cfg;
54}
55
56static_assert(kBoardNtcLowThresholdC < kBoardNtcHighThresholdC, "NTC threshold window must not be inverted");
57
58} // namespace vortex::config
59
60#endif // VORTEX_NTC_CONFIG_H_
Definition VortexNtcConfig.h:22
constexpr HfFunctionalAdcChannel kBoardNtcAdcChannel
Functional ADC channel the board NTC is wired to.
Definition VortexNtcConfig.h:25
ntc_temp_handler_config_t MakeBoardNtcConfig() noexcept
NTC handler configuration for the board thermistor.
Definition VortexNtcConfig.h:47
constexpr float kBoardNtcLowThresholdC
Over-temperature window the board NTC reports against (degrees Celsius).
Definition VortexNtcConfig.h:38
constexpr uint8_t BoardNtcHwChannel() noexcept
Hardware channel id of the board NTC on the shared TMC9660 ADC wrapper, from the pin map.
Definition VortexNtcConfig.h:28
constexpr float kBoardNtcHighThresholdC
Definition VortexNtcConfig.h:39