TLE92466ED Driver 0.1.0
API reference
Loading...
Searching...
No Matches
tle92466ed.hpp
Go to the documentation of this file.
1
13#ifndef TLE92466ED_HPP
14#define TLE92466ED_HPP
15
16#include <array>
17#include <cstddef>
18#include <cstdint>
19
20#include "tle92466ed_detail.hpp"
23#include "tle92466ed_types.hpp"
24#include "tle92466ed_version.h"
25
26namespace tle92466ed {
27
28namespace detail {
29
30// Optional hooks: a `Declares*` concept only tests the name, the `Has*` concept the exact
31// signature, `noexcept` and the result type; the driver rejects a hook that is declared but does
32// not match (KB-CPP20-007).
33
35template <typename Port>
36concept DeclaresGpioSet =
37 requires(Port& port) { port.GpioSet(CtrlPin::Reset, GpioSignal::ACTIVE); };
38
40template <typename Port>
41concept HasGpioSet =
42 requires { ExactHook<Port, bool(CtrlPin, GpioSignal) noexcept>::Take(&Port::GpioSet); };
43
45template <typename Port>
46concept DeclaresGpioRead =
47 requires(Port& port, GpioSignal& signal) { port.GpioRead(CtrlPin::Fault, signal); };
48
50template <typename Port>
51concept HasGpioRead =
52 requires { ExactHook<Port, bool(CtrlPin, GpioSignal&) noexcept>::Take(&Port::GpioRead); };
53
55template <typename Port>
56concept DeclaresDelayUs = requires(Port& port) { port.DelayUs(1_u32); };
57
60template <typename Port>
61concept HasDelayUs = requires { ExactHook<Port, void(uint32_t) noexcept>::Take(&Port::DelayUs); };
62
64template <typename Port>
65concept DeclaresLog = requires(Port& port) { port.Log(LogLevel::Info, ""); };
66
68template <typename Port>
69concept HasLog =
70 requires { ExactHook<Port, void(LogLevel, const char*) noexcept>::Take(&Port::Log); };
71
74template <typename Port>
75void DelayUs(Port& port, uint32_t us) noexcept {
76 if constexpr (HasDelayUs<Port>) {
77 port.DelayUs(us);
78 } else {
79 static_assert(kAlwaysFalse<Port>,
80 "tle92466ed: the port must implement `void DelayUs(uint32_t us) noexcept`");
81 }
82}
83
85template <typename Port>
86void Log(Port& port, [[maybe_unused]] LogLevel level,
87 [[maybe_unused]] const char* message) noexcept {
88 if constexpr (HasLog<Port>) {
89 port.Log(level, message);
90 } else {
91 (void)port;
92 }
93}
94
95// Register encoders: free constexpr functions, emitted once whatever the port type, and proved
96// below with static_assert (KB-CPP20-009, -012).
97
99[[nodiscard]] constexpr uint16_t ChannelBit(Channel channel) noexcept {
100 return static_cast<uint16_t>(
101 1U << (static_cast<uint32_t>(ToUnderlying(channel)) % kChannelCount));
102}
103
105[[nodiscard]] constexpr uint32_t LoadedMask(const Config& config) noexcept {
106 uint32_t mask = 0U;
107 for (uint32_t ch = 0U; ch < kChannelCount; ++ch) {
108 mask |= config.channels[ch].loaded ? (1U << ch) : 0U;
109 }
110 return mask;
111}
112
114[[nodiscard]] constexpr uint16_t PairBits(const Config& config) noexcept {
115 uint32_t bits = config.parallel[0] ? reg::kChCtrlPar03 : 0U;
116 bits |= config.parallel[1] ? reg::kChCtrlPar12 : 0U;
117 bits |= config.parallel[2] ? reg::kChCtrlPar45 : 0U;
118 return static_cast<uint16_t>(bits);
119}
120
122[[nodiscard]] constexpr uint16_t GlobalConfigValue(const Config& config) noexcept {
123 uint32_t v = config.clock_watchdog ? reg::kGlobalConfigClkWdEn : 0U;
124 v |= config.spi_watchdog ? reg::kGlobalConfigSpiWdEn : 0U;
125 v |= config.crc_check ? reg::kGlobalConfigCrcEn : 0U;
126 v |= (config.vio == VioLevel::V5V0) ? reg::kGlobalConfigVioSel : 0U;
127 return static_cast<uint16_t>(v);
128}
129
131[[nodiscard]] constexpr uint16_t ClkDivValue(const Config& config) noexcept {
132 if (config.clock == ClockSource::Internal) {
133 return reg::kClkDivReset;
134 }
135 const uint32_t khz = config.external_clock_khz;
136 auto v = reg::PllFbDiv::Insert(reg::kClkDivExtClk, PllFbDiv(khz));
137 return reg::PllRefDiv::Insert(v, PllRefDiv(khz));
138}
139
141[[nodiscard]] constexpr uint16_t VbatThValue(const Config& config) noexcept {
142 const auto v = reg::VbatUvTh::Insert(0_u16, config.vbat_uv_code);
143 return reg::VbatOvTh::Insert(v, config.vbat_ov_code);
144}
145
147[[nodiscard]] constexpr uint16_t FaultMask0Value(const Config& config) noexcept {
148 const FaultPinMask& m = config.fault_pin;
149 uint32_t v = static_cast<uint32_t>(m.channel_errors) & LoadedMask(config);
150 v |= m.en_pin ? reg::kMask0EnPin : 0U;
153 return static_cast<uint16_t>(v);
154}
155
157[[nodiscard]] constexpr uint16_t FaultMask1Value(const Config& config) noexcept {
158 const FaultPinMask& m = config.fault_pin;
159 uint32_t v = static_cast<uint32_t>(m.channel_warnings) & LoadedMask(config);
162 v |= m.clock_too_slow ? reg::kMask1ClkLow : 0U;
163 return static_cast<uint16_t>(v);
164}
165
167[[nodiscard]] constexpr uint16_t FaultMask2Value(const Config& config) noexcept {
168 uint32_t v = config.fault_pin.data_error ? reg::kMask2DataErr : 0U;
169 v |= config.fault_pin.spi_watchdog ? reg::kMask2SpiWd : 0U;
170 return static_cast<uint16_t>(v);
171}
172
174[[nodiscard]] constexpr uint16_t ModeValue(ChannelMode mode) noexcept {
175 const auto code = static_cast<uint32_t>(ToUnderlying(mode));
176 return static_cast<uint16_t>((mode == ChannelMode::Measurement) ? reg::kChModeMeasurement
177 : (code & 0x7U));
178}
179
182[[nodiscard]] constexpr uint16_t ChConfigValue(const ChannelConfig& c) noexcept {
183 auto v = reg::SlewRate::Insert(0_u16, ToUnderlying(c.slew));
184 v = reg::IDiag::Insert(v, ToUnderlying(c.diag.current));
185 if (c.loaded) {
186 v = reg::OlTh::Insert(v, c.diag.ol_relative_eighths);
187 v = reg::OlThFixed::Insert(v, c.diag.ol_fixed);
188 return reg::OffDiagCh::Insert(v, ToUnderlying(c.diag.off_state));
189 }
190 return reg::OffDiagCh::Insert(v, reg::kOffDiagDisabled);
191}
192
194[[nodiscard]] constexpr uint16_t CtrlValue(const ChannelConfig& c) noexcept {
195 auto v = reg::MinIntThresh::Insert(
196 0_u16, static_cast<uint32_t>(static_cast<uint8_t>(c.icc.min_int_thresh)));
197 v = static_cast<uint16_t>(static_cast<uint32_t>(v) |
199 v = reg::OlsgWarnWindow::Insert(v, c.diag.olsg_warn_window);
200 return static_cast<uint16_t>(static_cast<uint32_t>(v) |
202}
203
205[[nodiscard]] constexpr uint16_t PeriodValue(const IccConfig& icc) noexcept {
206 auto v = reg::PeriodMant::Insert(0_u16, icc.period_mant);
207 v = reg::PeriodExp::Insert(v, icc.period_exp);
208 v = static_cast<uint16_t>(static_cast<uint32_t>(v) |
210 return reg::PwmCtrlParam::Insert(v, icc.ki);
211}
212
214[[nodiscard]] constexpr uint16_t IntegratorLimitValue(const IccConfig& icc) noexcept {
215 return reg::AutoLimValueAbs::Insert(reg::LimValueAbs::Insert(0_u16, icc.limit), icc.auto_limit);
216}
217
219[[nodiscard]] constexpr uint16_t DitherClkDivValue(const DitherConfig& d) noexcept {
220 auto v = reg::DitherExp::Insert(reg::DitherMant::Insert(0_u16, d.mant), d.exp);
221 uint32_t bits = static_cast<uint32_t>(v) | (d.pwm_sync ? reg::kDitherPwmSyncEn : 0U);
223 return static_cast<uint16_t>(bits);
224}
225
227[[nodiscard]] constexpr uint16_t DitherStepValue(const DitherConfig& d) noexcept {
228 return reg::DitherSteps::Insert(reg::DitherFlat::Insert(0_u16, d.flat), d.steps);
229}
230
232[[nodiscard]] constexpr uint16_t DitherCtrlValue(const DitherConfig& d) noexcept {
233 auto v = reg::DitherStepSize::Insert(0_u16, d.step_size);
234 v = static_cast<uint16_t>(static_cast<uint32_t>(v) | (d.deep ? reg::kDeepDither : 0U));
235 return reg::FastMeas::Insert(v, ToUnderlying(d.fast));
236}
237
239[[nodiscard]] constexpr uint16_t TonValue(const ChannelConfig& c) noexcept {
240 return reg::OlsgTimeout::Insert(reg::TonMant::Insert(0_u16, c.on_time_mant), c.diag.olsg_timeout);
241}
242
244[[nodiscard]] constexpr uint16_t SetpointValue(const IccConfig& icc, uint32_t target) noexcept {
245 const auto v = reg::Target::Insert(0_u16, target);
246 return static_cast<uint16_t>(static_cast<uint32_t>(v) |
248}
249
251inline constexpr std::array<uint16_t, 11> kChannelOffsets = {
255
258inline constexpr std::array<uint16_t, 11> kChannelCompare = {0x000FU, 0x1FFFU, 0x7FFFU, 0xFFFFU,
259 0x7FFFU, 0xFFFFU, 0xFFFFU, 0xEFFFU,
260 0xFFFFU, 0x01FFU, 0xFFFFU};
261
263[[nodiscard]] constexpr std::array<uint16_t, 11> ChannelWords(const ChannelConfig& c) noexcept {
264 return {ModeValue(c.mode),
265 ChConfigValue(c),
266 CtrlValue(c),
267 PeriodValue(c.icc),
268 IntegratorLimitValue(c.icc),
269 DitherClkDivValue(c.dither),
270 DitherStepValue(c.dither),
271 DitherCtrlValue(c.dither),
272 TonValue(c),
273 reg::IntThresh::Insert(0_u16, c.icc.int_thresh),
274 SetpointValue(c.icc, 0U)};
275}
276
278inline constexpr uint32_t kPairMask = 0x7000U;
279
281struct RegWrite {
282 uint16_t address{0};
283 uint16_t value{0};
284};
285
287inline constexpr uint16_t kErrClear = 0x1F1FU;
289inline constexpr uint16_t kOcBoth = 0x0404U;
291inline constexpr uint16_t kWarnClear = 0x0F0FU;
293inline constexpr uint16_t kDiag2Clear = 0x000AU;
295inline constexpr uint32_t kDiag0Any = 0x47FFU;
296static_assert(kOcBoth == (static_cast<uint32_t>(reg::kErrOc) * 0x0101U));
297static_assert(kDiag2Clear == (static_cast<uint32_t>(reg::kDiag2RegEccErr) | reg::kDiag2OtpEccErr));
298static_assert(kDiag0Any == (static_cast<uint32_t>(reg::kDiag0Flags) | reg::kDiag0PorEvent |
300
302inline constexpr std::array<uint16_t, 5> kFeedbackOffsets = {
304
306[[nodiscard]] constexpr DeviceStatus DecodeStatus(uint32_t raw) noexcept {
307 DeviceStatus s{};
308 s.init_done = (raw & reg::kStatInitDone) != 0U;
309 s.spi_watchdog_error = (raw & reg::kStatSpiWdErr) != 0U;
310 s.clock_fault = (raw & reg::kStatClkNok) != 0U;
311 s.central_ot_error = (raw & reg::kStatCotErr) != 0U;
312 s.central_ot_warning = (raw & reg::kStatCotWarn) != 0U;
313 s.reset_event = (raw & reg::kStatResEvent) != 0U;
314 s.power_on_event = (raw & reg::kStatPorEvent) != 0U;
315 s.data_error = (raw & reg::kStatDataErr) != 0U;
316 s.supply_external = (raw & reg::kStatSupNokExt) != 0U;
317 s.supply_internal = (raw & reg::kStatSupNokInt) != 0U;
318 s.error_groups = static_cast<uint8_t>((raw >> 14U) & 0x7U);
319 s.warning_groups = static_cast<uint8_t>(raw & 0x7U);
320 s.check_skipped_groups = static_cast<uint8_t>((raw >> 3U) & 0x7U);
321 s.raw = raw & reg::kData22Mask;
322 return s;
323}
324
326[[nodiscard]] constexpr PinStatus DecodePins(uint32_t raw) noexcept {
327 PinStatus p{};
328 p.drv0 = (raw & reg::kPinDrv0) != 0U;
329 p.drv1 = (raw & reg::kPinDrv1) != 0U;
330 p.enable = (raw & reg::kPinEn) != 0U;
331 p.fault = (raw & reg::kPinFaultn) == 0U;
332 p.faultn_high = (raw & reg::kPinFaultnFb) != 0U;
333 return p;
334}
335
338[[nodiscard]] constexpr SupplyReadings DecodeSupply(uint32_t v1, uint32_t v2) noexcept {
339 SupplyReadings s{};
340 s.vio_mv = (reg::VioRaw::Extract(v1) * 34534U) / 10000U;
341 s.vdd_mv = (reg::VddRaw::Extract(v1) * 34534U) / 10000U;
342 s.vbat_mv = (reg::VbatRaw::Extract(v2) * 41470U) / 2047U;
343 const auto temp = static_cast<int64_t>(reg::TempRaw::Extract(v2));
344 s.temperature_mc = static_cast<int32_t>((511'875'000 - (370'625 * temp)) / 1000);
345 return s;
346}
347
351[[nodiscard]] constexpr Result<ChannelFeedback> DecodeFeedback(const std::array<uint32_t, 5>& w,
352 uint32_t system_hz) noexcept {
353 const uint32_t tp = reg::TpMant::Extract(w[0]);
354 if ((tp == 0U) || (system_hz == 0U)) {
356 }
357 const uint32_t to = reg::ToMant::Extract(w[0]);
358 ChannelFeedback f{};
359 f.average_current_ua = static_cast<int32_t>(
360 (4'000'000 * static_cast<int64_t>(SignExtend<12U>(reg::IAvgMant::Extract(w[2])))) /
361 static_cast<int64_t>(tp));
362 const uint32_t duty = (to * 10000U) / tp;
363 f.duty_permyriad =
364 (duty < 10000U) ? duty : 10000U; // TO_MANT never exceeds TP_MANT on a real chip
365 f.vbat_mv = (reg::VbatAvgMant::Extract(w[1]) * 41470U) / tp;
366 f.period_us = static_cast<uint32_t>(
367 ((static_cast<uint64_t>(tp) << reg::FbExp::Extract(w[1])) * 1'000'000U) / system_hz);
368 f.min_current_ua = (4'000'000 * SignExtend<10U>(reg::IMin::Extract(w[3]))) / 511;
369 f.max_current_ua = (4'000'000 * SignExtend<10U>(reg::IMax::Extract(w[3]))) / 511;
370 f.min_pwm_period_ns = static_cast<uint32_t>(
371 (static_cast<uint64_t>(reg::PMin::Extract(w[4])) * 256'000'000'000U) / system_hz);
372 f.max_pwm_period_ns = static_cast<uint32_t>(
373 (static_cast<uint64_t>(reg::PMax::Extract(w[4])) * 256'000'000'000U) / system_hz);
374 f.period_count = static_cast<uint8_t>(reg::DitherPeriodCnt::Extract(w[1]));
375 f.quad_count = static_cast<uint8_t>(reg::DitherQuadCnt::Extract(w[1]));
377}
378
379// Decoders on worked values: 25 degC is TEMP 1313.6 (Equation 32); 0 A at mid-scale.
380static_assert(DecodeSupply(0U, 1314U).temperature_mc == 24'873);
381static_assert(DecodeSupply(1448U, 0U).vio_mv == 5000U);
382static_assert(DecodeFeedback({0x0000'0000U, 0U, 0U, 0U, 0U}, kInternalClockHz).error ==
384static_assert(DecodeFeedback({(1000U << 11U) | 2000U, 0x5000U | 1000U, 0x0FFFU, 0U, 0U},
386 .value.average_current_ua == -2000);
387static_assert(DecodeFeedback({(1000U << 11U) | 2000U, 0x5000U | 1000U, 0x0FFFU, 0U, 0U},
389 .value.duty_permyriad == 5000U);
390static_assert(DecodeFeedback({(1000U << 11U) | 2000U, 0x5000U | 1000U, 0x0FFFU, 0U, 0U},
392 .value.period_us == 2285U);
393
395[[nodiscard]] constexpr Config AllLoaded() noexcept {
396 Config c{};
397 for (ChannelConfig& ch : c.channels) {
398 ch.loaded = true;
399 }
400 return c;
401}
402
403// The reset configuration encodes to the reset values of section 5.3.
404static_assert(GlobalConfigValue(Config{}) == reg::kGlobalConfigReset);
405static_assert(ClkDivValue(Config{}) == reg::kClkDivReset);
406static_assert(VbatThValue(Config{}) == reg::kVbatThReset);
407static_assert((FaultMask0Value(AllLoaded()) == reg::kMask0Reset) &&
408 (FaultMask1Value(AllLoaded()) == reg::kMask1Reset) &&
409 (FaultMask2Value(Config{}) == reg::kMask2Reset));
410static_assert((ChConfigValue(AllLoaded().channels[0]) == reg::kChConfigReset) &&
411 (CtrlValue(ChannelConfig{}) == reg::kCtrlReset) &&
412 (IntegratorLimitValue(IccConfig{}) == reg::kIntegratorLimitReset) &&
413 (ChannelWords(ChannelConfig{})[9] == reg::kCtrlIntThreshReset));
414static_assert((ModeValue(ChannelMode::Off) == 0U) && (PeriodValue(IccConfig{}) == 0U) &&
415 (DitherClkDivValue(DitherConfig{}) == 0U) && (TonValue(ChannelConfig{}) == 0U));
416// An unloaded channel never reaches FAULTN and runs no OFF-state diagnosis (KB-CPP-131).
417static_assert((FaultMask0Value(Config{}) == 0xC000U) && (FaultMask1Value(Config{}) == 0x7000U));
418static_assert(reg::OffDiagCh::Extract(ChConfigValue(ChannelConfig{})) == reg::kOffDiagDisabled);
419static_assert(ModeValue(ChannelMode::Measurement) == 0xCU);
420// The fields land where Table 24's registers put them.
421static_assert(CtrlValue(CurrentControlChannel()) == 0x4602U);
422static_assert(PeriodValue(CurrentControlChannel().icc) == 0x07DBU);
423static_assert(DitherClkDivValue(CurrentControlChannel().dither) == 0x176BU);
424static_assert(ClkDivValue(Config{.clock = ClockSource::External, .external_clock_khz = 4000U}) ==
425 0x8838U);
426
427} // namespace detail
428
435// clang-format off: the table below must keep one row per line.
458// clang-format on
459template <SpiPort Port>
461 static_assert(!detail::DeclaresGpioSet<Port> || detail::HasGpioSet<Port>,
462 "tle92466ed: the optional GpioSet hook must be `bool GpioSet(CtrlPin, GpioSignal) "
463 "noexcept`, so that a failed pin write is reported");
464 static_assert(!detail::DeclaresGpioRead<Port> || detail::HasGpioRead<Port>,
465 "tle92466ed: the optional GpioRead hook must be `bool GpioRead(CtrlPin, "
466 "GpioSignal&) noexcept`");
467 static_assert(
468 !detail::DeclaresDelayUs<Port> || detail::HasDelayUs<Port>,
469 "tle92466ed: the DelayUs hook must be `void DelayUs(uint32_t us) noexcept`, so that no "
470 "wait is truncated");
471 static_assert(
472 !detail::DeclaresLog<Port> || detail::HasLog<Port>,
473 "tle92466ed: the optional Log hook must be `void Log(LogLevel, const char* message) "
474 "noexcept`");
475
476public:
482 explicit TLE92466ED(Port& port, const Config& config = {}) noexcept
483 : bus_(port), config_(config) {}
484
486 TLE92466ED(const TLE92466ED&) = delete;
488 TLE92466ED& operator=(const TLE92466ED&) = delete;
489
492
516
518 [[nodiscard]] bool IsInitialized() const noexcept {
519 return initialized_;
520 }
521
529
535 Result<void> HardwareReset() noexcept;
536
540
548 Result<void> ApplyConfig(const Config& config) noexcept;
549
551 [[nodiscard]] const Config& GetConfig() const& noexcept {
552 return config_;
553 }
555 void GetConfig() const&& = delete;
556
566 Result<void> ConfigureChannel(Channel channel, const ChannelConfig& config,
567 Verify verify = Verify::None) noexcept;
568
579 Result<void> SetParallel(ParallelPair pair, bool enabled) noexcept;
580
584
596 Result<void> EnterMissionMode() noexcept;
597
603 Result<void> EnterConfigMode() noexcept;
604
606 [[nodiscard]] bool IsMissionMode() const noexcept {
607 return (static_cast<uint32_t>(ch_ctrl_) & reg::kChCtrlOpMode) != 0U;
608 }
609
618
622
636 Result<void> SetEnabledChannels(uint8_t mask, Verify verify = Verify::None) noexcept;
637
644 Result<void> EnableChannel(Channel channel, Verify verify = Verify::None) noexcept;
645
654 Result<void> DisableChannel(Channel channel, Verify verify = Verify::None) noexcept;
655
664 [[nodiscard]] uint8_t GetDroppedChannels() const noexcept {
665 return dropped_;
666 }
668 void ClearDroppedChannels() noexcept {
669 dropped_ = 0U;
670 }
671
677 [[nodiscard]] uint8_t GetEnabledChannels() const noexcept {
678 return static_cast<uint8_t>(static_cast<uint32_t>(ch_ctrl_) & reg::kChCtrlEnMask);
679 }
680
695 Result<uint32_t> SetCurrent(Channel channel, uint32_t microamps,
696 Verify verify = Verify::None) noexcept;
697
704 [[nodiscard]] uint32_t GetCurrentSetpoint(Channel channel) const noexcept;
705
716 Verify verify = Verify::None) noexcept;
717
731
739 Result<void> SetDrivePin(CtrlPin pin, [[maybe_unused]] bool high) noexcept;
740
744
752
756
762
770
782 Result<void> ClearFaults() noexcept;
783
792 Result<void> ClearChannelFaults(Channel channel) noexcept;
793
798 [[nodiscard]] const Faults& GetLatchedFaults() const& noexcept {
799 return latched_;
800 }
802 void GetLatchedFaults() const&& = delete;
803
805 void ClearLatchedFaults() noexcept {
806 latched_ = Faults{};
807 }
808
813 [[nodiscard]] const Faults& GetStartupFaults() const& noexcept {
814 return startup_;
815 }
817 void GetStartupFaults() const&& = delete;
818
823 Result<bool> ReadFaultPin() noexcept;
824
830
837
850
859
865
867 [[nodiscard]] uint8_t GetIcVersion() const noexcept {
868 return version_;
869 }
870
875 [[nodiscard]] bool IsResetWatchArmed() const noexcept {
876 return reset_watch_;
877 }
878
882
890 Result<uint32_t> ReadRegister(uint16_t address) noexcept;
891
893 [[nodiscard]] uint32_t GetLastReply() const noexcept {
894 return bus_.LastReply();
895 }
896
901 [[nodiscard]] uint8_t GetLastCriticalFault() const noexcept {
902 return bus_.LastCritical();
903 }
904
906 [[nodiscard]] BusDiagnostics GetBusDiagnostics() const noexcept {
907 return bus_.Diagnostics();
908 }
909
911
912private:
913 Result<void> initialize() noexcept;
914 Result<void> resetChip() noexcept;
915 Result<void> waitInitDone() noexcept;
916 Result<void> identify() noexcept;
917 Result<void> takeStartupFaults() noexcept;
918 Result<Faults> readFaults() noexcept;
919 Result<void> clearAll() noexcept;
920 Result<void> clearRead(const Faults& f) noexcept;
921 Result<void> clearTwice(uint16_t address, uint16_t bits, uint16_t twice) noexcept;
922 Result<void> armWatchdog(const Config& config) noexcept;
923 Result<void> checkMissionEntry() noexcept;
924 Result<void> checkGroupTemperature(uint32_t group, const DeviceStatus& status) noexcept;
925 Result<void> reconcile() noexcept;
926 void adopt(uint16_t chip) noexcept;
927 Result<void> writeEnables(uint32_t set, uint32_t clear, Verify verify) noexcept;
928 [[nodiscard]] Error checkEnable(uint32_t bits) const noexcept;
929 Result<uint32_t> readOnce(uint16_t address) noexcept;
930 void latchAll(const Faults& f) noexcept;
931 void noteDropped(uint32_t bits) noexcept;
932 Result<uint32_t> waitBist() noexcept;
933 Result<void> writeAll(const Config& config) noexcept;
934 Result<void> writeGlobal(const Config& config) noexcept;
935 Result<void> writeChannel(Channel channel, const ChannelConfig& config, Verify verify) noexcept;
936 Result<void> armResetWatch() noexcept;
937 Result<void> writeChCtrl(uint16_t value, Verify verify) noexcept;
938 Result<void> setPin([[maybe_unused]] CtrlPin pin, [[maybe_unused]] GpioSignal signal) noexcept;
939 Result<void> readFeedbackSet(uint16_t base, std::array<uint32_t, 5>& words) noexcept;
940 Result<uint32_t> read(uint16_t address) noexcept;
941 Result<void> write(uint16_t address, uint16_t value) noexcept;
942 Result<void> writeVerified(uint16_t address, uint16_t value, uint16_t compare,
943 Verify verify) noexcept;
944 [[nodiscard]] Error checkChannel(Channel channel) const noexcept;
945 [[nodiscard]] Error checkKnown(Channel channel, bool dither) const noexcept;
946 [[nodiscard]] bool maybeMission() const noexcept;
947 [[nodiscard]] Error checkCurrent(Channel channel, uint32_t microamps,
948 const DitherConfig& dither) const noexcept;
949 void latch(uint16_t address, uint32_t value) noexcept;
950 void track(Error error) noexcept;
951 Result<void> fail(Error error, const char* message) noexcept;
952
953 detail::Transport<Port> bus_;
954 Config config_{};
955 Faults latched_{};
956 Faults startup_{};
957 std::array<uint16_t, kChannelCount> setpoint_{};
958 uint16_t ch_ctrl_{0};
959 uint8_t version_{0};
960 uint8_t wanted_{0};
961 // What a write whose reply failed may have changed (it may have taken effect): each guard that
962 // depends on one refuses with WrongState and no I/O until a validated read or a successful write.
963 uint16_t par_unknown_{0};
964 uint8_t config_unknown_{0};
965 uint8_t dither_unknown_{0};
966 bool global_unknown_{false};
967 bool maybe_mission_{false};
968 uint8_t dropped_{0};
969 bool reset_watch_{false};
970 bool initialized_{false};
971};
972
975} // namespace tle92466ed
976
977// codeql::misra_deviation_next_line(MD-CPP-009)
978#include "../src/tle92466ed.ipp" // IWYU pragma: export
979
980#endif // TLE92466ED_HPP
Driver for one TLE92466ED on a platform port.
Definition tle92466ed.hpp:460
TLE92466ED(const TLE92466ED &)=delete
One driver object per chip.
bool IsMissionMode() const noexcept
Definition tle92466ed.hpp:606
Result< void > SetDrivePin(CtrlPin pin, bool high) noexcept
Drive DRV0 or DRV1, the inputs of the direct-drive channels (section 4.8.1).
Result< uint32_t > SetCurrent(Channel channel, uint32_t microamps, Verify verify=Verify::None) noexcept
Set a channel's average current setpoint (SETPOINT.TARGET, section 4.6.1).
Result< void > EnterMissionMode() noexcept
Enter Mission Mode, as Figure 4 allows it. First the entry conditions: FB_STAT (INIT_DONE = 1; no SPI...
Result< void > EnsureInitialized() noexcept
Start the chip, once: the only way to initialise the driver.
uint8_t GetLastCriticalFault() const noexcept
Definition tle92466ed.hpp:901
TLE92466ED & operator=(const TLE92466ED &)=delete
One driver object per chip.
const Faults & GetLatchedFaults() const &noexcept
Definition tle92466ed.hpp:798
bool IsResetWatchArmed() const noexcept
Definition tle92466ed.hpp:875
TLE92466ED(Port &port, const Config &config={}) noexcept
Bind the driver to a port and store the configuration. No I/O, cannot fail.
Definition tle92466ed.hpp:482
Result< DeviceStatus > ReadStatus() noexcept
Read FB_STAT, the one-register summary (section 5.3.2.21). Two frames.
void ClearLatchedFaults() noexcept
Empty the latch of GetLatchedFaults(). No I/O.
Definition tle92466ed.hpp:805
Result< PinStatus > ReadPinStatus() noexcept
Read PIN_STAT (section 5.3.2.20). Two frames.
const Faults & GetStartupFaults() const &noexcept
Definition tle92466ed.hpp:813
void ClearDroppedChannels() noexcept
Empty the record of GetDroppedChannels(). No I/O.
Definition tle92466ed.hpp:668
Result< void > ConfigureChannel(Channel channel, const ChannelConfig &config, Verify verify=Verify::None) noexcept
Write one channel's registers (MODE is writable in Config Mode only, section 4.4.1)....
Result< void > EnterConfigMode() noexcept
Enter Config Mode: OP_MODE 0, which turns every channel off (section 4.3.1), then EN low,...
uint8_t GetIcVersion() const noexcept
Definition tle92466ed.hpp:867
Result< bool > ReadFaultPin() noexcept
Read the FAULTN pin through the port's GpioRead().
Result< void > SetEnabledChannels(uint8_t mask, Verify verify=Verify::None) noexcept
Switch channels on and off together. CH_CTRL is read first, so the copy is the chip's (a channel a fa...
Result< SupplyReadings > ReadSupply() noexcept
Read FB_VOLTAGE1 and FB_VOLTAGE2: VIO, VDD, VBAT and the central temperature (sections 4....
Result< ChipId > ReadChipId() noexcept
Read CHIPID0..2, the unique chip identification. Six frames.
Result< void > Deinitialize() noexcept
Switch every channel off: Config Mode (CH_CTRL with OP_MODE and every EN_CH 0), then EN low....
Result< void > DisableChannel(Channel channel, Verify verify=Verify::None) noexcept
Switch one channel off, leaving the others as they are. Allowed in any state. When the CH_CTRL read f...
Result< void > ReloadWatchdog() noexcept
Reload the SPI watchdog: write Config::watchdog_reload to WD_RELOAD. Call it more often than the time...
bool IsInitialized() const noexcept
Definition tle92466ed.hpp:518
Result< BistResult > RunBist() noexcept
Run the safety flip-flop self-test (section 4.9.8, Config Mode only): start it, poll SMU_SLF_TST_DONE...
Result< Faults > ReadFaults() noexcept
Read the nine diagnosis registers (GLOBAL_DIAG0..2, DIAG_ERR_CHGR0..2, DIAG_WARN_CHGR0....
Result< void > ClearChannelFaults(Channel channel) noexcept
Clear one channel's flags and warnings: its DIAG_ERR_CHGR and DIAG_WARN_CHGR group read and latched (...
Result< uint32_t > ReadRegister(uint16_t address) noexcept
Read one register once: two frames, no retry, no decoding. Reading DIAG_WARN_CHGR clears OLSG_WARN_CH...
Result< void > HardwareReset() noexcept
Pulse RESN and start again as EnsureInitialized() does, with the stored configuration.
void GetConfig() const &&=delete
Not on a temporary driver: the reference would dangle (KB-CPP20-044).
uint8_t GetEnabledChannels() const noexcept
Definition tle92466ed.hpp:677
void GetStartupFaults() const &&=delete
Not on a temporary driver.
Result< void > EnableChannel(Channel channel, Verify verify=Verify::None) noexcept
Switch one channel on, leaving the others as they are. As SetEnabledChannels().
Result< void > SetParallel(ParallelPair pair, bool enabled) noexcept
Join or split a pair (CH_CTRL.CH_PAR, Config Mode only, section 4.5.2). Joining sets the master's SET...
uint32_t GetLastReply() const noexcept
Definition tle92466ed.hpp:893
const Config & GetConfig() const &noexcept
Definition tle92466ed.hpp:551
Result< void > StartOvercurrentCheck(Channel channel) noexcept
Run the OFF-state overcurrent check once (section 4.9.6): set CH_CONFIG.OC_DIAG_EN and the channel's ...
Result< uint16_t > ReadChannelControl() noexcept
Read CH_CTRL: the operation state and the enabled channels as the chip has them. A supply,...
void GetLatchedFaults() const &&=delete
Not on a temporary driver.
Result< void > ApplyConfig(const Config &config) noexcept
Change the whole configuration. Before the start it is only stored, with no I/O; on a started driver ...
uint32_t GetCurrentSetpoint(Channel channel) const noexcept
Result< ChannelFeedback > ReadChannelFeedback(Channel channel) noexcept
Read one measurement period of a channel's feedback, as section 4.10.5 recommends: read FB_UPD; when ...
Result< void > SetDither(Channel channel, const DitherConfig &dither, Verify verify=Verify::None) noexcept
Change a channel's dither at run time (section 4.7.2): DITHER_CLK_DIV (takes effect at once),...
uint8_t GetDroppedChannels() const noexcept
Definition tle92466ed.hpp:664
Result< void > ClearFaults() noexcept
Clear the diagnosis flags on the chip: every diagnosis register is read and latched (GetLatchedFaults...
BusDiagnostics GetBusDiagnostics() const noexcept
Definition tle92466ed.hpp:906
constexpr uint16_t kChConfig
CH_CONFIG: slew, diagnosis, OL limits.
Definition tle92466ed_registers.hpp:71
constexpr uint32_t kOffDiagDisabled
OFF_DIAG_CH = 11B: diagnosis off.
Definition tle92466ed_registers.hpp:305
constexpr uint16_t kLowFreqRangeEn
LOW_FREQ_RANGE_EN: period times 8.
Definition tle92466ed_registers.hpp:273
constexpr uint16_t kPinFaultnFb
FAULTN pin level.
Definition tle92466ed_registers.hpp:231
constexpr uint16_t kAutoLimitDis
AUTO_LIMIT_DIS.
Definition tle92466ed_registers.hpp:256
constexpr uint16_t kDeepDither
DEEP_DITHER.
Definition tle92466ed_registers.hpp:293
constexpr uint16_t kChConfigReset
After reset: 10 V/us, diagnosis on.
Definition tle92466ed_registers.hpp:306
constexpr uint16_t kDiag0PorEvent
POR_EVENT (rw): power-on reset happened.
Definition tle92466ed_registers.hpp:121
constexpr uint16_t kPinEn
EN level.
Definition tle92466ed_registers.hpp:229
constexpr uint16_t kMask1ClkLow
CLK_LOW_MASK.
Definition tle92466ed_registers.hpp:199
constexpr uint32_t kStatSupNokInt
SUP_NOK_INT.
Definition tle92466ed_registers.hpp:245
constexpr uint16_t kCtrlReset
After reset.
Definition tle92466ed_registers.hpp:266
constexpr uint16_t kDiag2OtpEccErr
OTP_ECC_ERR (rwh): two clears (4.9.7).
Definition tle92466ed_registers.hpp:147
constexpr uint32_t kStatInitDone
Definition tle92466ed_registers.hpp:248
constexpr uint32_t kStatPorEvent
POR_event.
Definition tle92466ed_registers.hpp:242
constexpr uint16_t kPeriod
PERIOD: PWM frequency controller.
Definition tle92466ed_registers.hpp:66
constexpr uint16_t kSetpoint
SETPOINT: TARGET, AUTO_LIMIT_DIS.
Definition tle92466ed_registers.hpp:64
constexpr uint16_t kGlobalConfigReset
Definition tle92466ed_registers.hpp:104
constexpr uint16_t kErrOc
OC: overcurrent; two clears (4.9.6, 4.11.2).
Definition tle92466ed_registers.hpp:174
constexpr uint16_t kPinDrv0
DRV0 level.
Definition tle92466ed_registers.hpp:227
constexpr uint16_t kIntegratorLimitReset
After reset: 1023 and 16.
Definition tle92466ed_registers.hpp:281
constexpr uint16_t kGlobalConfigVioSel
VIO_SEL: 0 = 3.3 V, 1 = 5.0 V.
Definition tle92466ed_registers.hpp:103
constexpr uint32_t kStatResEvent
RES_event.
Definition tle92466ed_registers.hpp:241
constexpr uint16_t kDitherClkDiv
DITHER_CLK_DIV: t_ref_clk, sync.
Definition tle92466ed_registers.hpp:68
constexpr uint16_t kMode
MODE (Config Mode only): CH_MODE.
Definition tle92466ed_registers.hpp:72
constexpr uint16_t kChCtrlPar45
CH_PAR_4_5 (Config Mode only).
Definition tle92466ed_registers.hpp:90
constexpr uint16_t kDiag0Flags
The rwh fault flags, cleared by a write of 1 (section 4.1.2).
Definition tle92466ed_registers.hpp:125
constexpr uint16_t kMask0SupExt
SUP_NOK_EXT_MASK.
Definition tle92466ed_registers.hpp:195
constexpr uint16_t kCtrl
CTRL: ICC threshold, OLSG warning.
Definition tle92466ed_registers.hpp:65
constexpr uint16_t kCtrlIntThreshReset
After reset.
Definition tle92466ed_registers.hpp:316
constexpr uint16_t kChCtrlEnMask
EN_CH0..5, bits 5..0.
Definition tle92466ed_registers.hpp:89
constexpr uint16_t kGlobalConfigCrcEn
CRC_EN: check MOSI frame CRCs.
Definition tle92466ed_registers.hpp:102
constexpr uint16_t kMask1CotErr
COTERR_MASK.
Definition tle92466ed_registers.hpp:198
constexpr uint16_t kOlsgWarnEn
OLSG_WARN_EN.
Definition tle92466ed_registers.hpp:265
constexpr uint16_t kMask0EnPin
EN_PIN_MASK.
Definition tle92466ed_registers.hpp:193
constexpr uint16_t kClkDivReset
After reset: REFDIV 2, FBDIV 56, internal.
Definition tle92466ed_registers.hpp:211
constexpr uint16_t kChCtrlPar03
CH_PAR_0_3 (Config Mode only).
Definition tle92466ed_registers.hpp:91
constexpr uint16_t kMask2SpiWd
SPI_WD_MASK.
Definition tle92466ed_registers.hpp:202
constexpr uint32_t kStatCotErr
COTERR.
Definition tle92466ed_registers.hpp:239
constexpr uint16_t kDitherSetpointSyncEn
DITHER_SETPOINT_SYNC_EN.
Definition tle92466ed_registers.hpp:289
constexpr uint16_t kFbIAvg
FB_I_AVG (22 bits): I_AVG_MANT, EXP.
Definition tle92466ed_registers.hpp:77
constexpr uint16_t kVbatThReset
After reset: UV 25 (4.05 V), OV 255.
Definition tle92466ed_registers.hpp:156
constexpr uint32_t kStatCotWarn
COTWARN.
Definition tle92466ed_registers.hpp:240
constexpr uint32_t kData22Mask
Data of a 22-bit reply.
Definition tle92466ed_registers.hpp:357
constexpr uint32_t kStatSpiWdErr
SPI_WD_ERR.
Definition tle92466ed_registers.hpp:247
constexpr uint16_t kMask0Reset
After reset.
Definition tle92466ed_registers.hpp:196
constexpr uint16_t kPinDrv1
DRV1 level.
Definition tle92466ed_registers.hpp:228
constexpr uint32_t kStatSupNokExt
SUP_NOK_EXT.
Definition tle92466ed_registers.hpp:244
constexpr uint16_t kFbIminImax
FB_IMIN_IMAX (22 bits).
Definition tle92466ed_registers.hpp:78
constexpr uint16_t kFbDc
FB_DC (22 bits): TP_MANT, TO_MANT.
Definition tle92466ed_registers.hpp:75
constexpr uint16_t kMask2DataErr
DATA_ERR_MASK.
Definition tle92466ed_registers.hpp:201
constexpr uint16_t kMask0SupInt
SUP_NOK_INT_MASK.
Definition tle92466ed_registers.hpp:194
constexpr uint16_t kPinFaultn
FAULTN internal: 0 = fault.
Definition tle92466ed_registers.hpp:230
constexpr uint16_t kGlobalConfigClkWdEn
CLK_WD_EN: clock watchdog.
Definition tle92466ed_registers.hpp:100
constexpr uint16_t kDitherPwmSyncEn
DITHER_PWM_SYNC_EN.
Definition tle92466ed_registers.hpp:288
constexpr uint16_t kChCtrlPar12
CH_PAR_1_2 (Config Mode only).
Definition tle92466ed_registers.hpp:92
constexpr uint16_t kDitherStep
DITHER_STEP: STEPS, FLAT.
Definition tle92466ed_registers.hpp:69
constexpr uint32_t kChModeMeasurement
CH_MODE = CH: free-running measurement.
Definition tle92466ed_registers.hpp:312
constexpr uint16_t kCtrlIntThresh
CTRL_INT_THRESH: ICC start threshold.
Definition tle92466ed_registers.hpp:74
constexpr uint16_t kFbPeriodMinMax
Definition tle92466ed_registers.hpp:81
constexpr uint16_t kChCtrlOpMode
OP_MODE: 0 Config Mode, 1 Mission Mode.
Definition tle92466ed_registers.hpp:93
constexpr uint16_t kDitherCtrl
DITHER_CTRL: STEP_SIZE, fast feedback.
Definition tle92466ed_registers.hpp:70
constexpr uint16_t kGlobalConfigSpiWdEn
SPI_WD_EN: SPI watchdog.
Definition tle92466ed_registers.hpp:101
constexpr uint16_t kDiag2RegEccErr
REG_ECC_ERR (rwh).
Definition tle92466ed_registers.hpp:146
constexpr uint32_t kStatClkNok
CLK_NOK.
Definition tle92466ed_registers.hpp:238
constexpr uint16_t kClkDivExtClk
EXT_CLK: 1 = clock from the CLK pin.
Definition tle92466ed_registers.hpp:210
constexpr uint16_t kIntegratorLimit
INTEGRATOR_LIMIT: ICC limits.
Definition tle92466ed_registers.hpp:67
constexpr uint16_t kDiag0ResEvent
RES_EVENT (rw): RESN reset happened.
Definition tle92466ed_registers.hpp:120
constexpr uint16_t kPwmPeriodCalcMode
PWM_PERIOD_CALC_MODE.
Definition tle92466ed_registers.hpp:263
constexpr uint32_t kStatDataErr
DATA_err: OTP ECC, OTP virgin, HVADC.
Definition tle92466ed_registers.hpp:243
constexpr uint16_t kMask1Reset
After reset.
Definition tle92466ed_registers.hpp:200
constexpr uint16_t kFbVbat
FB_VBAT (22 bits): VBAT, EXP, counters.
Definition tle92466ed_registers.hpp:76
constexpr uint16_t kTon
TON: on-time, OLSG time-out.
Definition tle92466ed_registers.hpp:73
constexpr uint16_t kMask2Reset
After reset.
Definition tle92466ed_registers.hpp:203
constexpr uint16_t kMask1CotWarn
COTWARN_MASK.
Definition tle92466ed_registers.hpp:197
Error
Why a call failed. Every call of the driver returns one of these in its Result.
Definition tle92466ed_types.hpp:37
Verify
Extra traffic a setter may spend to confirm its write (handbook KB-ARCH-041).
Definition tle92466ed_types.hpp:211
constexpr uint32_t PllRefDiv(uint32_t khz) noexcept
PLL_REFDIV for an external clock: f_CLK / 1 MHz, rounded down as in Table 10.
Definition tle92466ed_types.hpp:679
ChannelMode
How a channel drives its output (MODE.CH_MODE, section 5.3.3.11).
Definition tle92466ed_types.hpp:238
constexpr uint32_t PllFbDiv(uint32_t khz) noexcept
PLL_FBDIV for an external clock: 56 MHz * PLL_REFDIV / f_CLK, rounded to the nearest as in Table 10 (...
Definition tle92466ed_types.hpp:689
ParallelPair
The channel pairs that can drive one load together (section 4.5.2).
Definition tle92466ed_types.hpp:229
constexpr uint32_t kChannelCount
Number of output channels (section 4.5.1).
Definition tle92466ed_types.hpp:226
constexpr ChannelConfig CurrentControlChannel() noexcept
A starting point for one current-controlled channel with feedback: ICC, a 1 kHz PWM target (PERIOD_MA...
Definition tle92466ed_types.hpp:993
constexpr uint32_t kInternalClockHz
f_SYS of the internal oscillator, typical (Table 6).
Definition tle92466ed_types.hpp:428
Channel
One of the six output channels.
Definition tle92466ed_types.hpp:217
LogLevel
Severity passed to the optional Log() hook.
Definition tle92466ed_types.hpp:201
@ None
No extra frame and no compare. The default.
@ Measurement
Free-running measurement, switch off (4.4.3); CH_MODE = CH.
@ Off
Output off, no measurement. Reset value.
@ V5V0
5.0 V. Reset value.
@ Internal
The internal oscillator; the dividers are ignored. Reset value.
@ External
The CLK pin, Config::external_clock_khz.
@ Info
Lifecycle events: initialised, reset.
The TLE92466ED driver: everything it declares lives here; internals in detail.
Definition tle92466ed.hpp:26
GpioSignal
Logical level of a control pin; the port maps it to the physical polarity.
Definition tle92466ed_spi_interface.hpp:87
@ ACTIVE
The pin function is asserted.
CtrlPin
The chip's control pins the port drives (GpioSet) or reads (GpioRead).
Definition tle92466ed_spi_interface.hpp:77
@ Reset
RESN, active low: ACTIVE holds the chip in reset (section 4.2.3).
The result of the safety flip-flop self-test (SFF_BIST, section 4.9.8).
Definition tle92466ed_types.hpp:624
Counters of the protocol layer (handbook KB-ARCH-044). No I/O to read them.
Definition tle92466ed_types.hpp:656
Everything the driver writes for one channel. Defaults are the reset values.
Definition tle92466ed_types.hpp:345
IccConfig icc
Current controller.
Definition tle92466ed_types.hpp:353
ChannelMode mode
MODE.CH_MODE (Config Mode only).
Definition tle92466ed_types.hpp:349
bool loaded
Definition tle92466ed_types.hpp:346
DiagConfig diag
Diagnosis.
Definition tle92466ed_types.hpp:355
SlewRate slew
CH_CONFIG.SLEWR.
Definition tle92466ed_types.hpp:350
DitherConfig dither
Dither and measurement period.
Definition tle92466ed_types.hpp:354
uint16_t on_time_mant
Definition tle92466ed_types.hpp:351
One measurement period of a channel's feedback, read under the freeze of section 4....
Definition tle92466ed_types.hpp:641
int32_t average_current_ua
Definition tle92466ed_types.hpp:642
The unique chip identification, CHIPID0..2 (sections 5.3.2.24 to 5.3.2.26).
Definition tle92466ed_types.hpp:631
Everything EnsureInitialized() writes to the chip, and the driver's own settings.
Definition tle92466ed_types.hpp:382
bool clock_watchdog
GLOBAL_CONFIG.CLK_WD_EN (4.2.2).
Definition tle92466ed_types.hpp:387
FaultPinMask fault_pin
FAULT_MASK0..2.
Definition tle92466ed_types.hpp:397
uint32_t external_clock_khz
Definition tle92466ed_types.hpp:393
uint8_t vbat_uv_code
VBAT_TH.VBAT_UV_TH, 162.08 mV per count (4.05 V).
Definition tle92466ed_types.hpp:395
bool crc_check
Definition tle92466ed_types.hpp:385
uint8_t vbat_ov_code
VBAT_TH.VBAT_OV_TH (41.3 V).
Definition tle92466ed_types.hpp:396
ClockSource clock
CLK_DIV.EXT_CLK.
Definition tle92466ed_types.hpp:392
bool spi_watchdog
GLOBAL_CONFIG.SPI_WD_EN (5.2.2).
Definition tle92466ed_types.hpp:388
std::array< ChannelConfig, kChannelCount > channels
Per channel, indexed by Channel.
Definition tle92466ed_types.hpp:399
std::array< bool, kPairCount > parallel
CH_CTRL.CH_PAR_x_y, indexed by ParallelPair.
Definition tle92466ed_types.hpp:398
VioLevel vio
Definition tle92466ed_types.hpp:383
FB_STAT, the chip's one-word status summary, decoded (section 5.3.2.21).
Definition tle92466ed_types.hpp:588
bool init_done
INIT_DONE: clock and logic ready.
Definition tle92466ed_types.hpp:589
DiagCurrent current
CH_CONFIG.I_DIAG.
Definition tle92466ed_types.hpp:333
OffStateDiag off_state
CH_CONFIG.OFF_DIAG_CH.
Definition tle92466ed_types.hpp:338
uint8_t olsg_timeout
TON.OLSG_TIMEOUT, 0 to 63 (Equation 15).
Definition tle92466ed_types.hpp:341
uint8_t ol_relative_eighths
Definition tle92466ed_types.hpp:334
uint8_t olsg_warn_window
CTRL.OLSG_WARN_WINDOW, 0 to 31.
Definition tle92466ed_types.hpp:340
uint8_t ol_fixed
Definition tle92466ed_types.hpp:336
bool olsg_warning
CTRL.OLSG_WARN_EN (4.9.3).
Definition tle92466ed_types.hpp:339
The dither generator of one channel (DITHER_CLK_DIV, DITHER_STEP, DITHER_CTRL; section 4....
Definition tle92466ed_types.hpp:315
bool setpoint_sync
DITHER_CLK_DIV.DITHER_SETPOINT_SYNC_EN (4.7.5).
Definition tle92466ed_types.hpp:319
uint8_t exp
DITHER_CLK_DIV.EXP, 0 to 15; also the TON exponent.
Definition tle92466ed_types.hpp:317
uint16_t mant
DITHER_CLK_DIV.MANT of t_ref_clk, 0 to 1023.
Definition tle92466ed_types.hpp:316
uint16_t step_size
DITHER_CTRL.STEP_SIZE, 0 to 4095, in TARGET counts.
Definition tle92466ed_types.hpp:322
uint8_t flat
DITHER_STEP.FLAT reference clocks at each plateau.
Definition tle92466ed_types.hpp:321
FastFeedback fast
DITHER_CTRL.FAST_MEAS (4.10.3).
Definition tle92466ed_types.hpp:324
bool pwm_sync
DITHER_CLK_DIV.DITHER_PWM_SYNC_EN (4.7.3).
Definition tle92466ed_types.hpp:318
bool deep
DITHER_CTRL.DEEP_DITHER (4.7.7).
Definition tle92466ed_types.hpp:323
uint8_t steps
DITHER_STEP.STEPS per quarter period.
Definition tle92466ed_types.hpp:320
Which faults pull FAULTN low (FAULT_MASK0..2, sections 5.3.2.14 to 5.3.2.16); true reports the fault ...
Definition tle92466ed_types.hpp:363
uint8_t channel_warnings
CHx_WARN_MASK, bit x: OTW, I_REG, PWM_REG, OLSG warnings.
Definition tle92466ed_types.hpp:365
bool supply_external
SUP_NOK_EXT_MASK.
Definition tle92466ed_types.hpp:368
bool supply_internal
SUP_NOK_INT_MASK.
Definition tle92466ed_types.hpp:367
bool clock_too_slow
CLK_LOW_MASK.
Definition tle92466ed_types.hpp:371
bool central_ot_warning
COTWARN_MASK.
Definition tle92466ed_types.hpp:369
bool central_ot_error
COTERR_MASK.
Definition tle92466ed_types.hpp:370
bool spi_watchdog
SPI_WD_MASK.
Definition tle92466ed_types.hpp:373
bool en_pin
EN_PIN_MASK: EN low.
Definition tle92466ed_types.hpp:366
bool data_error
DATA_ERR_MASK.
Definition tle92466ed_types.hpp:372
uint8_t channel_errors
CHx_ERR_MASK, bit x: OC, SG, OL, OTE, OLSG of channel x.
Definition tle92466ed_types.hpp:364
The diagnosis registers as read: GLOBAL_DIAG0..2, DIAG_ERR_CHGR0..2 and DIAG_WARN_CHGR0....
Definition tle92466ed_types.hpp:528
The integrating current controller of one channel (CTRL, PERIOD, INTEGRATOR_LIMIT,...
Definition tle92466ed_types.hpp:294
uint8_t period_exp
PERIOD.PERIOD_EXP, 0 to 7.
Definition tle92466ed_types.hpp:299
uint8_t auto_limit
Definition tle92466ed_types.hpp:303
int8_t min_int_thresh
Definition tle92466ed_types.hpp:295
bool auto_limit_disable
SETPOINT.AUTO_LIMIT_DIS (4.6.2.2).
Definition tle92466ed_types.hpp:305
bool low_freq_range
PERIOD.LOW_FREQ_RANGE_EN: the period times 8.
Definition tle92466ed_types.hpp:300
uint16_t int_thresh
CTRL_INT_THRESH.INT_THRESH, 0 to 511.
Definition tle92466ed_types.hpp:306
uint8_t ki
PERIOD.PWM_CTRL_PARAM, the controller gain, 0 to 15.
Definition tle92466ed_types.hpp:301
bool skip_falling_dither
CTRL.PWM_PERIOD_CALC_MODE (4.6.2.3).
Definition tle92466ed_types.hpp:297
uint16_t limit
INTEGRATOR_LIMIT.LIM_VALUE_ABS, 0 to 1023.
Definition tle92466ed_types.hpp:302
uint8_t period_mant
PERIOD.PERIOD_MANT; 0 turns the PWM controller off.
Definition tle92466ed_types.hpp:298
PIN_STAT, decoded (section 5.3.2.20).
Definition tle92466ed_types.hpp:615
bool drv0
DRV0 is high.
Definition tle92466ed_types.hpp:616
The value of a call, or why there is none.
Definition tle92466ed_types.hpp:141
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition tle92466ed_types.hpp:167
static constexpr Result Success(T v) noexcept
A successful result.
Definition tle92466ed_types.hpp:159
The supply and temperature feedback (FB_VOLTAGE1, FB_VOLTAGE2; 5.3.2.22, 5.3.2.23).
Definition tle92466ed_types.hpp:606
int32_t temperature_mc
Definition tle92466ed_types.hpp:610
uint32_t vio_mv
VIO = 3.4534 mV * VIO.
Definition tle92466ed_types.hpp:607
Compile-time helpers of the TLE92466ED driver: typed integer literals, exact hook matching,...
TLE92466ED register map: addresses, bit fields, reset values and the frame CRC (datasheet section 5....
The SPI port of the TLE92466ED driver: the CRTP base, its pin enums, the SpiPort concept,...
Public types of the TLE92466ED driver: errors, Result<T>, configuration, decoded status and feedback,...