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

#include <modm/driver/temperature/ltc2984.hpp>

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

Classes

struct  Configuration
 
struct  Data
 

Public Types

enum  Register : uint16_t {
  CommandStatus = 0x000, Results = 0x010, GlobalConfiguration = 0x0f0, MuxChannels = 0x0f4,
  MuxConfigDelay = 0x0f4, ChannelConfig = 0x200, CustomDataTable = 0x250
}
 
enum  CommandStatus : uint8_t { Done = Bit6, Start = Bit7, DoneAndStart = Bit6 | Bit7, Sleep = 0x97 }
 
enum  Channel : uint8_t {
  Ch1 = 0, Ch2 = 1, Ch3 = 2, Ch4 = 3,
  Ch5 = 4, Ch6 = 5, Ch7 = 6, Ch8 = 7,
  Ch9 = 8, Ch10 = 9, Ch11 = 10, Ch12 = 11,
  Ch13 = 12, Ch14 = 13, Ch15 = 14, Ch16 = 15,
  Ch17 = 16, Ch18 = 17, Ch19 = 18, Ch20 = 19
}
 List of available channels.
 

Public Member Functions

 MODM_FLAGS8 (CommandStatus)
 
 Ltc2984 ()
 Initialize. More...
 
modm::ResumableResult< bool > ping ()
 Ping the LTC298x device. More...
 
modm::ResumableResult< void > configure (ltc2984::Configuration::Rejection rejection, ltc2984::Configuration::TemperatureUnit temperatureUnit, uint8_t muxDelay=0)
 Configure. More...
 
modm::ResumableResult< bool > isBusy ()
 Check if device is busy. More...
 
modm::ResumableResult< void > configureChannel (ltc2984::Channel channel, uint32_t config)
 Configure channel. More...
 
modm::ResumableResult< void > initiateSingleMeasurement (ltc2984::Channel channel)
 Initiate single conversion. More...
 
modm::ResumableResult< void > initiateMeasurements ()
 Initiate measurements for all actived channels.
 
void enableChannel (ltc2984::Configuration::MuxChannel channel)
 Enable channel for multiplexed conversation. More...
 
void disableChannel (ltc2984::Configuration::MuxChannel channel)
 Deactivate channel for multiplexed conversation. More...
 
modm::ResumableResult< void > setChannels ()
 Write actived channel configuartion to device.
 
modm::ResumableResult< void > enterSleepMode ()
 Enter sleep mode.
 
modm::ResumableResult< void > readChannel (ltc2984::Channel channel, ltc2984::Data &value)
 Read temperature value. More...
 
void attachConfigurationHandler (Spi::ConfigurationHandler handler)
 

Protected Member Functions

modm::ResumableResult< void > writeData (Register address, uint8_t *word, size_t length)
 Write 32-bit word to ltc2984 memory.
 
modm::ResumableResult< void > writeData (Register address, CommandStatus command)
 
modm::ResumableResult< void > readFourBytes (Register address, uint8_t *data)
 Read 32-bit word to ltc2984 memory.
 
modm::ResumableResult< void > readByte (Register address, uint8_t &byte)
 
bool acquireMaster ()
 
bool releaseMaster ()
 
modm::ResumableResult< ReturnType > resumable function (...)
 
int8_t getResumableDepth () const
 
bool isResumableRunning () const
 
void stopResumable ()
 Force all resumable functions to stop running at the current nesting level.
 

Detailed Description

template<class SpiMaster, class Cs>
class modm::ltc2984< SpiMaster, Cs >

Author
Raphael Lehmann

Member Function Documentation

template<class SpiMaster , class Cs >
modm::ResumableResult<void> modm::ltc2984< SpiMaster, Cs >::configure ( ltc2984< SpiMaster, Cs >::Configuration::Rejection  rejection,
ltc2984< SpiMaster, Cs >::Configuration::TemperatureUnit  temperatureUnit,
uint8_t  muxDelay = 0 
)

Configure.

Parameters
rejectionLTC2983/LTC2984 hat built-in simultaneous 50Hz/60Hz Rejection, default both are activated
temperatureUnitTemperature unit to use, °C or °F
muxDelayMux configuration delay in 100 microseconds (maximum: 255 x 100us = 25.5ms)
template<class SpiMaster , class Cs >
modm::ResumableResult<void> modm::ltc2984< SpiMaster, Cs >::configureChannel ( ltc2984< SpiMaster, Cs >::Channel  channel,
uint32_t  config 
)

Configure channel.

Parameters
channelThe channel to configure.
configThe configuration for the channel.
template<class SpiMaster , class Cs >
void modm::ltc2984< SpiMaster, Cs >::disableChannel ( ltc2984< SpiMaster, Cs >::Configuration::MuxChannel  channel)

Deactivate channel for multiplexed conversation.

This has no effect until setChannels() is called

Parameters
channelThe channel to disable.
template<class SpiMaster , class Cs >
void modm::ltc2984< SpiMaster, Cs >::enableChannel ( ltc2984< SpiMaster, Cs >::Configuration::MuxChannel  channel)

Enable channel for multiplexed conversation.

This has no effect until setChannels() is called

Parameters
channelThe channel to activate.
modm::ResumableResult< ReturnType > resumable modm::NestedResumable< 1 >::function (   ...)
inherited

Run the resumable function.

You need to implement this method in you subclass yourself.

Returns
>NestingError if still running, <=NestingError if it has finished.
int8_t modm::NestedResumable< 1 >::getResumableDepth ( ) const
inheritedinline
Returns
the nesting depth in the current resumable function, or -1 if called outside any resumable function
template<class SpiMaster , class Cs >
modm::ResumableResult<void> modm::ltc2984< SpiMaster, Cs >::initiateSingleMeasurement ( ltc2984< SpiMaster, Cs >::Channel  channel)

Initiate single conversion.

Parameters
channelThe channel to measure.
template<class SpiMaster , class Cs >
modm::ResumableResult<bool> modm::ltc2984< SpiMaster, Cs >::isBusy ( )

Check if device is busy.

Returns
True if device is busy.
bool modm::NestedResumable< 1 >::isResumableRunning ( ) const
inheritedinline
Returns
true if a resumable function is running at the current nesting level, else false
template<class SpiMaster , class Cs >
modm::ltc2984< SpiMaster, Cs >::Ltc2984 ( )

Initialize.

Sets used pins as output. SPI must be initialized by the user!

template<class SpiMaster , class Cs >
modm::ResumableResult<bool> modm::ltc2984< SpiMaster, Cs >::ping ( )

Ping the LTC298x device.

Warning
Do not use ping() while any measurement is running. The ping() function writes data to the Custom Sensor Table Data memory region but restores the data before finishing the device available check.
Returns
config True if the device is reachable.
template<class SpiMaster , class Cs >
modm::ResumableResult<void> modm::ltc2984< SpiMaster, Cs >::readChannel ( ltc2984< SpiMaster, Cs >::Channel  channel,
ltc2984< SpiMaster, Cs >::Data value 
)

Read temperature value.

Parameters
channelThe channel to read the temperature value from.
valueThe temperature value as configured before.
Returns
True if result is valid.

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