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 >

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...
 
bool ping ()
 Ping the LTC298x device. More...
 
void configure (ltc2984::Configuration::Rejection rejection, ltc2984::Configuration::TemperatureUnit temperatureUnit, uint8_t muxDelay=0)
 Configure. More...
 
bool isBusy ()
 Check if device is busy. More...
 
void configureChannel (ltc2984::Channel channel, uint32_t config)
 Configure channel. More...
 
void initiateSingleMeasurement (ltc2984::Channel channel)
 Initiate single conversion. More...
 
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...
 
void setChannels ()
 Write actived channel configuartion to device.
 
void enterSleepMode ()
 Enter sleep mode.
 
void readChannel (ltc2984::Channel channel, ltc2984::Data &value)
 Read temperature value. More...
 
void attachConfigurationHandler (Spi::ConfigurationHandler handler)
 

Protected Member Functions

void writeData (Register address, uint8_t *word, size_t length)
 Write 32-bit word to ltc2984 memory.
 
void writeData (Register address, CommandStatus command)
 
void readFourBytes (Register address, uint8_t *data)
 Read 32-bit word to ltc2984 memory.
 
void readByte (Register address, uint8_t &byte)
 
bool acquireMaster ()
 
bool releaseMaster ()
 

Detailed Description

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

Author
Raphael Lehmann

Member Function Documentation

template<class SpiMaster , class Cs >
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 >
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.
template<class SpiMaster , class Cs >
void modm::ltc2984< SpiMaster, Cs >::initiateSingleMeasurement ( ltc2984< SpiMaster, Cs >::Channel  channel)

Initiate single conversion.

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

Check if device is busy.

Returns
True if device is busy.
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 >
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 >
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: