modm API documentation for ATTINY85V-20SU
|
#include <modm/driver/adc/ads101x.hpp>
Classes | |
struct | Data |
Public Typedefs | |
typedef Configuration< ConfigRegister_t, FullScaleRange,(Bit11|Bit10|Bit9)> | FullScaleRange_t |
typedef Configuration< ConfigRegister_t, DeviceOperatingMode, Bit8 > | DeviceOperatingMode_t |
typedef Configuration< ConfigRegister_t, InputMultiplexer,(Bit14|Bit13|Bit12)> | InputMultiplexer_t |
typedef Configuration< ConfigRegister_t, DataRate,(Bit7|Bit6|Bit5)> | DataRate_t |
typedef Configuration< ConfigRegister_t, ComparatorMode, Bit4 > | ComparatorMode_t |
typedef Configuration< ConfigRegister_t, ComparatorPolarity, Bit3 > | ComparatorPolarity_t |
typedef Configuration< ConfigRegister_t, ComparatorLatch, Bit2 > | ComparatorLatch_t |
typedef Configuration< ConfigRegister_t, ComparatorQueue, Bit4 > | ComparatorQueue_t |
Public Types | |
enum | Register : uint8_t { Conversion = 0b00, Config = 0b01, LowThreshold = 0b10, HighThreshold = 0b11 } |
enum | ConfigRegister : uint16_t { OS = Bit15, MUX2 = Bit14, MUX1 = Bit13, MUX0 = Bit12, PGA2 = Bit11, PGA1 = Bit10, PGA0 = Bit9, MODE = Bit8, DR2 = Bit7, DR1 = Bit6, DR0 = Bit5, COMP_MODE = Bit4, COMP_POL = Bit3, COMP_LAT = Bit2, COMP_QUE1 = Bit1, COMP_QUE0 = Bit0 } |
The Config register is used to control the operating mode, input selection, data rate, full-scale range, and comparator modes. | |
enum | FullScaleRange : uint16_t { V6_144 = 0, V4_096 = int(ConfigRegister::PGA0), V2_048 = int(ConfigRegister::PGA1), V1_024 = int(ConfigRegister::PGA1) | int(ConfigRegister::PGA0), V0_512 = int(ConfigRegister::PGA2), V0_256 = int(ConfigRegister::PGA2) | int(ConfigRegister::PGA0) } |
enum | DeviceOperatingMode : uint16_t { Continuous = 0, SingleShot = int(ConfigRegister::MODE) } |
enum | InputMultiplexer : uint16_t { Input0 = 0, Input1 = int(ConfigRegister::MUX0), Input2 = int(ConfigRegister::MUX1), Input3 = int(ConfigRegister::MUX1) | int(ConfigRegister::MUX0), Input4 = int(ConfigRegister::MUX2), Input5 = int(ConfigRegister::MUX2) | int(ConfigRegister::MUX0), Input6 = int(ConfigRegister::MUX2) | int(ConfigRegister::MUX1), Input7 = int(ConfigRegister::MUX2) | int(ConfigRegister::MUX1) | int(ConfigRegister::MUX0) } |
enum | DataRate : uint16_t { Sps128 = 0, Sps250 = int(ConfigRegister::DR0), Sps490 = int(ConfigRegister::DR1), Sps920 = int(ConfigRegister::DR1) | int(ConfigRegister::DR0), Sps1600 = int(ConfigRegister::DR2), Sps2400 = int(ConfigRegister::DR2) | int(ConfigRegister::DR0), Sps3300 = int(ConfigRegister::DR2) | int(ConfigRegister::DR1) } |
enum | ComparatorMode : uint16_t { Traditional = 0, Window = int(ConfigRegister::COMP_MODE) } |
enum | ComparatorPolarity : uint16_t { ActiveLow = 0, ActiveHigh = int(ConfigRegister::COMP_POL) } |
enum | ComparatorLatch : uint16_t { Nonlatching = 0, Latching = int(ConfigRegister::COMP_LAT) } |
enum | ComparatorQueue : uint16_t { OneConversion = 0, TwoConversions = int(ConfigRegister::COMP_QUE0), FourConversions = int(ConfigRegister::COMP_QUE1), Disable = int(ConfigRegister::COMP_QUE1) | int(ConfigRegister::COMP_QUE0) } |
Public Member Functions | |
MODM_FLAGS16 (ConfigRegister) | |
Ads101x (Data &data, uint8_t address=0x49) | |
modm::ResumableResult< bool > | initialize () |
Call this function before using the device. | |
modm::ResumableResult< bool > | isBusy () |
Determine if the device is currently performing a conversion. | |
modm::ResumableResult< bool > | startSingleShotConversion () |
Start a single conversion with the specified input. | |
modm::ResumableResult< bool > | startContinuousConversion (DataRate dataRate=DataRate::Sps1600) |
Start continuous conversions with the specified datarate and input. | |
modm::ResumableResult< bool > | startSingleShotConversion (InputMultiplexer input=InputMultiplexer::Input0) |
modm::ResumableResult< bool > | startContinuousConversion (InputMultiplexer input=InputMultiplexer::Input0, DataRate dataRate=DataRate::Sps1600) |
modm::ResumableResult< bool > | readConversionResult () |
modm::ResumableResult< bool > | enableConversionReadyFunction () |
modm::ResumableResult< bool > | enableComparator (ComparatorMode mode, ComparatorPolarity polarity, ComparatorLatch latch, ComparatorQueue queue) |
modm::ResumableResult< bool > | setLowThreshold (uint16_t threshold) |
modm::ResumableResult< bool > | setHighThreshold (uint16_t threshold) |
modm::ResumableResult< bool > | setFullScaleRange (FullScaleRange fullScaleRange) |
Set the full scale range by programming the PGA and corresponding LSB size. | |
void | attachConfigurationHandler (I2c::ConfigurationHandler handler) |
modm::ResumableResult< bool > | ping () |
modm::ResumableResult< bool > | read (uint8_t *buffer, std::size_t size) |
Starts a write transaction and waits until finished. | |
void | setAddress (uint8_t address) |
modm::ResumableResult< bool > | write (const uint8_t *buffer, std::size_t size) |
Starts a write transaction and waits until finished. | |
modm::ResumableResult< bool > | writeRead (const uint8_t *writeBuffer, std::size_t writeSize, uint8_t *readBuffer, std::size_t readSize) |
Starts a write-read transaction and waits until finished. | |
Protected Member Functions | |
int8_t | getResumableDepth () const |
bool | isResumableRunning () const |
bool | isTransactionRunning () |
modm::ResumableResult< bool > | runTransaction () |
Starts our own transaction and waits until finished. | |
bool | startRead (uint8_t *buffer, std::size_t size) |
Configures the transaction with a read operation and starts it. | |
bool | startTransaction () |
Starts the transaction with our own transaction object. | |
bool | startTransaction (modm::I2cTransaction *transaction) |
Starts the transaction with a separate transaction object. | |
bool | startWrite (const uint8_t *buffer, std::size_t size) |
Configures the transaction with a write operation and starts it. | |
bool | startWriteRead (const uint8_t *writeBuffer, std::size_t writeSize, uint8_t *readBuffer, std::size_t readSize) |
Configures the transaction with a write/read operation and starts it. | |
void | stopResumable () |
bool | wasTransactionSuccessful () |
Protected Attributes | |
I2cWriteReadTransaction | transaction |
Static Protected Attributes | |
static constexpr float | lsbSizeTable [] |
modm::ads101x< I2cMaster >::Ads101x | ( | Data & | data, |
uint8_t | address = 0x49 |
||
) |
data | |
address |
|
inheritedinline |
Attaches a configuration handler, which is called before a transaction, whenever the configuration has to be changed.
modm::ResumableResult<bool> modm::ads101x< I2cMaster >::enableComparator | ( | ComparatorMode | mode, |
ComparatorPolarity | polarity, | ||
ComparatorLatch | latch, | ||
ComparatorQueue | queue | ||
) |
Enable the comparator
modm::ResumableResult<bool> modm::ads101x< I2cMaster >::enableConversionReadyFunction | ( | ) |
Enable the conversion-ready function of the ALERT/RDY pin
|
inheritedinlineprotected |
true
when transaction is busy.
|
inheritedinline |
true | device responds to address |
false | no device with address found |
modm::ResumableResult<bool> modm::ads101x< I2cMaster >::readConversionResult | ( | ) |
Read the last conversion result
|
inheritedinline |
Sets a new address of the slave device.
address | the slave address not yet shifted left (address < 128). |
|
inline |
Set the high threshold used by the comparator queue
|
inline |
Set the low threshold used by the comparator queue
modm::ResumableResult<bool> modm::ads101x< I2cMaster >::startContinuousConversion | ( | InputMultiplexer | input = InputMultiplexer::Input0 , |
DataRate | dataRate = DataRate::Sps1600 |
||
) |
Start continuous conversions with the specified datarate and input
modm::ResumableResult<bool> modm::ads101x< I2cMaster >::startSingleShotConversion | ( | InputMultiplexer | input = InputMultiplexer::Input0 | ) |
Start a single conversion with the specified input
|
inheritedinlineprotected |
true
when transaction did not return an error.
|
staticprotectedconstexpr |