modm API documentation
|
#include <modm/driver/adc/ad7928.hpp>
Classes | |
struct | Data |
Public Typedefs | |
typedef modm::Configuration< ControlRegister_t, SequenceMode, Bit14|Bit7 > | SequenceMode_t |
typedef modm::Configuration< ControlRegister_t, InputChannel, 0b111, 10 > | InputChannel_t |
typedef modm::Configuration< ControlRegister_t, PowerMode, 0b11, 8 > | PowerMode_t |
typedef modm::Configuration< ShadowRegister_t, SequenceChannels, 0xFF, 8 > | Sequence1Channels_t |
typedef modm::Configuration< ShadowRegister_t, SequenceChannels, 0xFF, 0 > | Sequence2Channels_t |
using | Register_t = modm::FlagsGroup< ControlRegister_t, ShadowRegister_t > |
Public Types | |
enum | ControlRegister : uint16_t { ControlRegister::WriteControlReg = Bit15, ControlRegister::VrefRange = Bit5, ControlRegister::UnsignedOutput = Bit4 } |
Control register. More... | |
enum | SequenceMode : uint16_t { SequenceMode::NoSequence = 0, SequenceMode::ProgramShadowRegister = Bit7, SequenceMode::ContinueSequence = Bit14, SequenceMode::ContinuousSequence = Bit14 | Bit7 } |
Sequence mode. More... | |
enum | InputChannel : uint8_t { Ch0 = 0, Ch1 = Bit0, Ch2 = Bit1, Ch3 = Bit1 | Bit0, Ch4 = Bit2, Ch5 = Bit2 | Bit0, Ch6 = Bit2 | Bit1, Ch7 = Bit2 | Bit1 | Bit0 } |
ADC input channels. | |
enum | PowerMode : uint8_t { Normal = Bit1 | Bit0, FullShutdown = Bit1, AutoShutdown = Bit0 } |
Power mode. | |
enum | ShadowRegister : uint16_t |
Shadow register, used for channel selection in sequence mode. | |
enum | SequenceChannels : uint8_t { Ch0 = Bit7, Ch1 = Bit6, Ch2 = Bit5, Ch3 = Bit4, Ch4 = Bit3, Ch5 = Bit2, Ch6 = Bit1, Ch7 = Bit0 } |
Configuration to select input channels for sequence conversion. | |
Public Member Functions | |
MODM_FLAGS16 (ControlRegister) | |
MODM_FLAGS16 (ShadowRegister) | |
MODM_FLAGS8 (SequenceChannels) | |
Ad7928 () | |
modm::ResumableResult< void > | initialize () |
Call this function once before using the device. | |
modm::ResumableResult< Data > | singleConversion (InputChannel channel) |
modm::ResumableResult< void > | startSequence (SequenceChannels_t channels1, SequenceChannels_t channels2=SequenceChannels_t (0)) |
modm::ResumableResult< Data > | nextSequenceConversion () |
void | setExtendedRange (bool enabled) |
bool | isExtendedRange () |
Test if extended range mode is enabled. | |
void | setAutoShutdownEnabled (bool enabled) |
Shutdown device after each conversion, not supported in sequence mode. | |
bool | isAutoShutdownEnabled () |
Test if auto-shutdown is enabled. | |
modm::ResumableResult< void > | fullShutdown () |
modm::ResumableResult< void > | wakeup () |
Wake up the device from full shutdown mode. | |
void | attachConfigurationHandler (Spi::ConfigurationHandler handler) |
Protected Member Functions | |
bool | acquireMaster () |
bool | releaseMaster () |
int8_t | getResumableDepth () const |
bool | isResumableRunning () const |
void | stopResumable () |
|
strong |
Control register.
|
strong |
Sequence mode.
modm::ResumableResult<void> modm::ad7928< SpiMaster, Cs >::fullShutdown | ( | ) |
Shutdown device Calling wakeup() or initiating a conversion will wake up the device
modm::ResumableResult<Data> modm::ad7928< SpiMaster, Cs >::nextSequenceConversion | ( | ) |
Perform the next sequence conversion The result is undefined if the device is not in sequence mode or not in normal power mode.
void modm::ad7928< SpiMaster, Cs >::setExtendedRange | ( | bool | enabled | ) |
Enable extended range mode (0V < input < 2*Vref) The configuration will be applied after the next conversion Default mode: (0V < input < Vref)
modm::ResumableResult<Data> modm::ad7928< SpiMaster, Cs >::singleConversion | ( | InputChannel | channel | ) |
Initiate a single conversion and return the result of the previous conversion A running sequence will be aborted. If the device is in full shutdown, it will be woken up.
modm::ResumableResult<void> modm::ad7928< SpiMaster, Cs >::startSequence | ( | SequenceChannels_t | channels1, |
SequenceChannels_t | channels2 = SequenceChannels_t (0) |
||
) |
Start a conversion sequence. The device will automatically cycle through the specified channels, starting with the lowest channel index in sequence1, when nextSequenceConversion() is called.