#include <modm/driver/adc/ad7928.hpp>
|
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 > |
|
|
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.
|
|
template<typename SpiMaster, typename Cs>
class modm::ad7928< SpiMaster, Cs >
- Template Parameters
-
- Author
- Christopher Durand
template<typename SpiMaster , typename Cs >
Control register.
Enum Values | Documentation |
---|
WriteControlReg | Enables writing to the control register.
|
VrefRange | If this bit is set, the input range is 0..Vref, else 0..2*Vref (4.75V < AVdd < 5.25V required)
|
UnsignedOutput | Unsigned output, else two's complement signed output for differential signals (output 0 for input Vref/2)
|
template<typename SpiMaster , typename Cs >
Sequence mode.
Enum Values | Documentation |
---|
NoSequence | Sequence mode disabled.
|
ProgramShadowRegister | If this bit is set, the next 2 bytes written to the device will be clocked into the shadow register and non-continuous sequence mode will be enabled
|
ContinueSequence | Continue the current sequence, conversion settings can be changed.
|
ContinuousSequence | Enable continuous sequence mode, not supported.
|
template<typename SpiMaster , typename Cs >
Shutdown device Calling wakeup() or initiating a conversion will wake up the device
Run the resumable function.
You need to implement this method in you subclass yourself.
- Returns
- >
NestingError
if still running, <=NestingError
if it has finished.
- Returns
- the nesting depth in the current resumable function, or -1 if called outside any resumable function
- Returns
true
if a resumable function is running at the current nesting level, else false
template<typename SpiMaster , typename Cs >
Perform the next sequence conversion The result is undefined if the device is not in sequence mode or not in normal power mode.
template<typename SpiMaster , typename Cs >
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)
template<typename SpiMaster , typename Cs >
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.
template<typename SpiMaster , typename Cs >
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.
The documentation for this class was generated from the following file: