HF-ADS7952 Driver 0.1.0-dev
HF-ADS7952 C++ Driver
Loading...
Searching...
No Matches
ads7952::ChannelReadings Struct Reference

#include <ads7952_types.hpp>

Public Member Functions

bool ok () const noexcept
 True when error equals Error::Ok.
 
bool hasChannel (uint8_t ch) const noexcept
 Check if a specific channel has valid data in this reading.
 
uint8_t validChannelCount () const noexcept
 Count channels currently marked valid.
 

Public Attributes

uint16_t count [MAX_CHANNELS] = {}
 Raw counts per channel.
 
float voltage [MAX_CHANNELS] = {}
 Converted voltages per channel.
 
uint16_t valid_mask = 0
 Bitmask indicating which channels contain valid data.
 
Error error = Error::Ok
 

Static Public Attributes

static constexpr uint8_t MAX_CHANNELS = 12
 

Detailed Description

Definition at line 148 of file ads7952_types.hpp.

Member Function Documentation

◆ hasChannel()

bool ads7952::ChannelReadings::hasChannel ( uint8_t ch) const
inlinenoexcept

Check if a specific channel has valid data in this reading.

Definition at line 175 of file ads7952_types.hpp.

References MAX_CHANNELS, and valid_mask.

◆ ok()

bool ads7952::ChannelReadings::ok ( ) const
inlinenoexcept

True when error equals Error::Ok.

Definition at line 172 of file ads7952_types.hpp.

References error, and ads7952::Ok.

◆ validChannelCount()

uint8_t ads7952::ChannelReadings::validChannelCount ( ) const
inlinenoexcept

Count channels currently marked valid.

Returns
Number of set bits in valid_mask for channels [0..11].

Definition at line 183 of file ads7952_types.hpp.

References valid_mask.

Member Data Documentation

◆ count

uint16_t ads7952::ChannelReadings::count[MAX_CHANNELS] = {}

Raw counts per channel.

Definition at line 151 of file ads7952_types.hpp.

◆ error

Error ads7952::ChannelReadings::error = Error::Ok

Definition at line 169 of file ads7952_types.hpp.

Referenced by ok(), and ads7952::ADS7952< SpiType >::ReadAllChannels().

◆ MAX_CHANNELS

constexpr uint8_t ads7952::ChannelReadings::MAX_CHANNELS = 12
staticconstexpr

Definition at line 149 of file ads7952_types.hpp.

Referenced by hasChannel(), and ads7952::ADS7952< SpiType >::ReadAllChannels().

◆ valid_mask

uint16_t ads7952::ChannelReadings::valid_mask = 0

Bitmask indicating which channels contain valid data.

Bit ordering: bit N corresponds to channel N (bit 0 = CH0, bit 11 = CH11). Only bits [11:0] are meaningful; upper bits are always 0.

Use hasChannel(ch) for single-channel checks, or inspect the mask directly for bulk operations:

for (uint8_t ch = 0; ch < 12; ++ch)
if (readings.valid_mask & (1U << ch)) { ... }

Definition at line 167 of file ads7952_types.hpp.

Referenced by hasChannel(), and validChannelCount().

◆ voltage

float ads7952::ChannelReadings::voltage[MAX_CHANNELS] = {}

Converted voltages per channel.

Definition at line 152 of file ads7952_types.hpp.


The documentation for this struct was generated from the following file: