modm API documentation
modm::ads816x< SpiMaster, Cs > Class Template Reference

#include <modm/driver/adc/ads816x.hpp>

Inheritance diagram for modm::ads816x< SpiMaster, Cs >:
modm::SpiDevice< SpiMaster > modm::NestedResumable< 3 >

Public Types

enum  Register : uint16_t {
  REG_ACCESS = 0x000, PD_CNTL = 0x004, SDI_CNTL = 0x008, SDO_CNTL1 = 0x00C,
  SDO_CNTL2 = 0x00D, SDO_CNTL3 = 0x00E, SDO_CNTL4 = 0x00F, DATA_CNTL = 0x010,
  PARITY_CNTL = 0x011, OFST_CAL = 0x018, REF_MRG1 = 0x019, REF_MRG2 = 0x01A,
  REFby2_MRG = 0x01B, AIN_CFG = 0x024, COM_CFG = 0x027, DEVICE_CFG = 0x01C,
  CHANNEL_ID = 0x01D, SEQ_START = 0x01E, SEQ_STOP = 0x01F, ON_THE_FLY_CFG = 0x02A,
  AUTO_SEQ_CFG1 = 0x080, AUTO_SEQ_CFG2 = 0x082
}
 
enum  Command : uint8_t {
  NoOperation = 0b00000 << 3, Write = 0b00001 << 3, Read = 0b00010 << 3, SetBits = 0b00011 << 3,
  ClearBits = 0b00100 << 3
}
 
enum  Mode : uint8_t { Manual = 0b00, OnTheFly = 0b01, AutoSequence = 0b10, CustomSequence = 0b11 }
 
enum  DataFormat : uint8_t { OnlyResult = (0b00 << 4), ResultChannel = (0b01 << 4), ResultChannelStatus = (0b10 << 4) }
 

Public Member Functions

 Ads816x () = default
 
modm::ResumableResult< void > initialize (Mode mode=Mode::Manual)
 
modm::ResumableResult< uint16_t > manualModeConversion (uint8_t afterNextChannel)
 
void setTConv (modm::ShortPreciseDuration t)
 
void attachConfigurationHandler (Spi::ConfigurationHandler handler)
 

Protected Member Functions

bool acquireMaster ()
 
bool releaseMaster ()
 
int8_t getResumableDepth () const
 
bool isResumableRunning () const
 
void stopResumable ()
 

Detailed Description

template<typename SpiMaster, typename Cs>
class modm::ads816x< SpiMaster, Cs >

Template Parameters
SpiMasterSpiMaster interface
CsChip-select pin
Author
Raphael Lehmann

Member Function Documentation

template<typename SpiMaster , typename Cs >
modm::ResumableResult<void> modm::ads816x< SpiMaster, Cs >::initialize ( Mode  mode = Mode::Manual)

Call this function before using the device or to change operation mode

Warning
Only Mode::Manual is currently supported!
template<typename SpiMaster , typename Cs >
modm::ResumableResult<uint16_t> modm::ads816x< SpiMaster, Cs >::manualModeConversion ( uint8_t  afterNextChannel)

Initiate a single conversion and return the result of the conversion. Simultanously the channel for the after next conversion will be set, i.e. before reading the first valid data two dummy conversions have to be executed.

template<typename SpiMaster , typename Cs >
void modm::ads816x< SpiMaster, Cs >::setTConv ( modm::ShortPreciseDuration  t)
inline

Set T_CONV (minimal) value. According to the datasheet 660ns (-> 1us) for ADS8168, 1200ns (-> 2us) for ADS8167 and 2500ns (3us) for ADS8166 are the minimal values. Defaults to 3us, which works for all variants of the chip.


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