ADS7952 Driver
API reference
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// ---- Reference and supply limits: SLAS605C 7.3 Recommended Operating
64// Conditions (V(REF) 2.0 V to 3.0 V, V(+VA) 2.7 V to 5.25 V) ----------
65inline constexpr float MIN_VREF = 2.0f; // Minimum V(REF), recommended operating conditions
66inline constexpr float MAX_VREF = 3.0f; // Maximum V(REF), recommended operating conditions
67inline constexpr float MIN_VA = 2.7f; // Minimum V(+VA), recommended operating conditions
68inline constexpr float MAX_VA = 5.25f; // Maximum V(+VA), recommended operating conditions
69
70// ---- Auto-1 default channel mask (all 12 channels) ------------------------
71#ifdef CONFIG_ADS7952_AUTO1_CHANNEL_MASK
72inline constexpr uint16_t DEFAULT_AUTO1_MASK = CONFIG_ADS7952_AUTO1_CHANNEL_MASK;
73#else
74inline constexpr uint16_t DEFAULT_AUTO1_MASK = 0x0FFF;
75#endif
76
77// ---- Auto-2 default last channel -------------------------------------------
78#ifdef CONFIG_ADS7952_AUTO2_LAST_CH
79inline constexpr uint8_t DEFAULT_AUTO2_LAST_CH = CONFIG_ADS7952_AUTO2_LAST_CH;
80#else
81inline constexpr uint8_t DEFAULT_AUTO2_LAST_CH = 11;
82#endif
83
84// ---- Safety margin frames for ReadAllChannels auto-read loop ---------------
85#ifdef CONFIG_ADS7952_READ_ALL_MAX_EXTRA
86inline constexpr uint8_t READ_ALL_MAX_EXTRA_FRAMES = CONFIG_ADS7952_READ_ALL_MAX_EXTRA;
87#else
88inline constexpr uint8_t READ_ALL_MAX_EXTRA_FRAMES = 4;
89#endif
90
91// ---- Manual-mode read: CONTINUE frames allowed before the requested channel
92// address appears in DO15:12. SLAS605C Figure 51: select in frame N,
93// data in frame N+2, so the minimum is 2; one spare for a mode change
94// that was still in flight.
95#ifdef CONFIG_ADS7952_MANUAL_READ_MAX_FRAMES
96inline constexpr uint8_t MANUAL_READ_MAX_FRAMES = CONFIG_ADS7952_MANUAL_READ_MAX_FRAMES;
97#else
98inline constexpr uint8_t MANUAL_READ_MAX_FRAMES = 4;
99#endif
100
101// ---- Max retries for mode change / programming operations ------------------
102#ifdef CONFIG_ADS7952_MAX_RETRIES
103inline constexpr uint8_t MAX_RETRIES = CONFIG_ADS7952_MAX_RETRIES;
104#else
105inline constexpr uint8_t MAX_RETRIES = 3;
106#endif
107
109} // 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 uint8_t MANUAL_READ_MAX_FRAMES
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)