HF-ADS7952 Driver 0.1.0-dev
HF-ADS7952 C++ Driver
Loading...
Searching...
No Matches
ads7952_config.hpp
Go to the documentation of this file.
1
11#pragma once
12#include <cstdint>
13
14#include "ads7952_types.hpp"
15
16namespace ADS7952_CFG {
17
29// ---- Operating mode default ------------------------------------------------
30#ifdef CONFIG_ADS7952_MODE_AUTO1
32#elif defined(CONFIG_ADS7952_MODE_AUTO2)
34#else
36#endif
37
38// ---- Input range default ---------------------------------------------------
39#ifdef CONFIG_ADS7952_RANGE_2VREF
41#else
43#endif
44
45// ---- Device constants ------------------------------------------------------
46inline constexpr uint8_t NUM_CHANNELS = 12;
47inline constexpr uint8_t RESOLUTION_BITS = 12;
48inline constexpr uint16_t MAX_COUNT = (1U << RESOLUTION_BITS) - 1;
49
50// ---- Voltage reference defaults --------------------------------------------
51#ifdef CONFIG_ADS7952_VREF_MV
52inline constexpr float DEFAULT_VREF = CONFIG_ADS7952_VREF_MV / 1000.0f;
53#else
54inline constexpr float DEFAULT_VREF = 2.5f; // REF5025 typical
55#endif
56
57#ifdef CONFIG_ADS7952_VA_MV
58inline constexpr float DEFAULT_VA = CONFIG_ADS7952_VA_MV / 1000.0f;
59#else
60inline constexpr float DEFAULT_VA = 5.0f; // Typical VA supply
61#endif
62
63// ---- Voltage reference limits (per ADS7952 datasheet) ---------------------
64inline constexpr float MIN_VREF = 1.0f; // Minimum Vref (datasheet limit)
65inline constexpr float MAX_VREF = 2.5f; // Maximum Vref (datasheet limit)
66inline constexpr float MIN_VA = 2.7f; // Minimum VA (datasheet absolute min)
67inline constexpr float MAX_VA = 5.5f; // Maximum VA (datasheet absolute max)
68
69// ---- Auto-1 default channel mask (all 12 channels) ------------------------
70#ifdef CONFIG_ADS7952_AUTO1_CHANNEL_MASK
71inline constexpr uint16_t DEFAULT_AUTO1_MASK = CONFIG_ADS7952_AUTO1_CHANNEL_MASK;
72#else
73inline constexpr uint16_t DEFAULT_AUTO1_MASK = 0x0FFF;
74#endif
75
76// ---- Auto-2 default last channel -------------------------------------------
77#ifdef CONFIG_ADS7952_AUTO2_LAST_CH
78inline constexpr uint8_t DEFAULT_AUTO2_LAST_CH = CONFIG_ADS7952_AUTO2_LAST_CH;
79#else
80inline constexpr uint8_t DEFAULT_AUTO2_LAST_CH = 11;
81#endif
82
83// ---- Safety margin frames for ReadAllChannels auto-read loop ---------------
84#ifdef CONFIG_ADS7952_READ_ALL_MAX_EXTRA
85inline constexpr uint8_t READ_ALL_MAX_EXTRA_FRAMES = CONFIG_ADS7952_READ_ALL_MAX_EXTRA;
86#else
87inline constexpr uint8_t READ_ALL_MAX_EXTRA_FRAMES = 4;
88#endif
89
90// ---- Max retries for mode change / programming operations ------------------
91#ifdef CONFIG_ADS7952_MAX_RETRIES
92inline constexpr uint8_t MAX_RETRIES = CONFIG_ADS7952_MAX_RETRIES;
93#else
94inline constexpr uint8_t MAX_RETRIES = 3;
95#endif
96
98} // namespace ADS7952_CFG
Type definitions for the ADS7952 driver.
constexpr uint8_t RESOLUTION_BITS
constexpr float MIN_VA
constexpr float DEFAULT_VA
constexpr uint8_t DEFAULT_AUTO2_LAST_CH
constexpr ads7952::Range DEFAULT_RANGE
constexpr uint8_t READ_ALL_MAX_EXTRA_FRAMES
constexpr ads7952::Mode DEFAULT_MODE
constexpr uint16_t DEFAULT_AUTO1_MASK
constexpr uint8_t MAX_RETRIES
constexpr float MIN_VREF
constexpr uint8_t NUM_CHANNELS
constexpr float DEFAULT_VREF
constexpr uint16_t MAX_COUNT
constexpr float MAX_VREF
constexpr float MAX_VA
@ Auto2
Device sequences channels 0 to last_channel.
@ Auto1
Device sequences through programmed channel mask.
@ Manual
Host selects channel each frame.
@ Vref
0 to Vref (RANGE bit = 0)
@ TwoVref
0 to 2*Vref, clamped to VA (RANGE bit = 1)