modm API documentation
modm::Lsm303a< I2cMaster > Class Template Reference

#include <modm/driver/inertial/lsm303a.hpp>

Inheritance diagram for modm::Lsm303a< I2cMaster >:
modm::Lis3TransportI2c< I2cMaster > modm::I2cDevice< I2cMaster, 2 > modm::NestedResumable< 10+1 >

Classes

struct  Data
 

Public Typedefs

typedef FlagsGroup< Control1_t, Control2_t, Control3_t, Control4_t, Control5_t, Control6_t, FifoControl_t, IntConfig_t, ClickConfig_t > Control_t
 

Public Types

enum  Register : uint8_t
 
enum  Control1 : uint8_t
 CTRL_REG1 default value is 0x07.
 
enum  Control2 : uint8_t
 CTRL_REG2 default value is 0x00.
 
enum  Control3 : uint8_t
 CTRL_REG3 default value is 0x00.
 
enum  Control4 : uint8_t
 CTRL_REG4 default value is 0x00.
 
enum  Control5 : uint8_t
 CTRL_REG5 default value is 0x00.
 
enum  Control6 : uint8_t
 CTRL_REG6 default value is 0x00.
 
enum  Status : uint8_t
 STATUS is read-only.
 
enum  FifoControl : uint8_t
 FIFO_CTRL default value is 0x00.
 
enum  FifoSource : uint8_t
 FIFO_SRC is read-only.
 
enum  IntConfig : uint8_t
 INT_CFG default value is 0x00.
 
enum  IntSource : uint8_t
 INT1_SRC default value is 0x00.
 
enum  ClickConfig : uint8_t
 CLOCK_CFG default value is 0x00.
 
enum  ClickSource : uint8_t
 CLOCK_SRC default value is 0x00.
 
enum  FifoMode : uint8_t
 
enum  MeasurementRate : uint8_t
 
enum  Scale : uint8_t
 

Public Member Functions

 MODM_FLAGS8 (Control1)
 
 MODM_FLAGS8 (Control2)
 
 MODM_FLAGS8 (Control3)
 
 MODM_FLAGS8 (Control4)
 
 MODM_FLAGS8 (Control5)
 
 MODM_FLAGS8 (Control6)
 
 MODM_FLAGS8 (Status)
 
 MODM_FLAGS8 (FifoControl)
 
 MODM_FLAGS8 (FifoSource)
 
 MODM_FLAGS8 (IntConfig)
 
 MODM_FLAGS8 (IntSource)
 
 MODM_FLAGS8 (ClickConfig)
 
 MODM_FLAGS8 (ClickSource)
 
 Lsm303a (Data &data, uint8_t address=0b0011001)
 Constructor, requires a lsm303a::Data object.
 
bool configureBlocking (Scale scale, MeasurementRate rate=MeasurementRate::Hz100)
 
modm::ResumableResult< bool > configure (Scale scale, MeasurementRate rate=MeasurementRate::Hz100)
 
modm::ResumableResult< bool > updateControl (Control1_t setMask, Control1_t clearMask=Control1_t (0xff))
 
modm::ResumableResult< bool > updateControl (Control2_t setMask, Control2_t clearMask=Control2_t (0xff))
 
modm::ResumableResult< bool > updateControl (Control3_t setMask, Control3_t clearMask=Control3_t (0xff))
 
modm::ResumableResult< bool > updateControl (Control4_t setMask, Control4_t clearMask=Control4_t (0xff))
 
modm::ResumableResult< bool > updateControl (Control5_t setMask, Control5_t clearMask=Control5_t (0xff))
 
modm::ResumableResult< bool > updateControl (Control6_t setMask, Control6_t clearMask=Control6_t (0xff))
 
modm::ResumableResult< bool > updateFifoControl (FifoControl_t setMask, FifoControl_t clearMask=FifoControl_t (0xff))
 
modm::ResumableResult< bool > readAcceleration ()
 
Control1_t getControl1 ()
 
Control2_t getControl2 ()
 
Control3_t getControl3 ()
 
Control4_t getControl4 ()
 
Control5_t getControl5 ()
 
Control6_t getControl6 ()
 
uint8_t getReference ()
 
FifoControl_t getFifoControl ()
 
Status_t getStatus ()
 
FifoSource_t getFifoSource ()
 
DatagetData ()
 Get the data object for this sensor.
 
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 > read (uint8_t reg, uint8_t &value)
 read a 8bit value
 
modm::ResumableResult< bool > read (uint8_t reg, uint8_t *buffer, uint8_t length)
 read multiple 8bit values from a start register
 
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 ()
 
modm::ResumableResult< bool > write (uint8_t reg, uint8_t value)
 write a 8bit value
 

Protected Attributes

I2cWriteReadTransaction transaction
 

Detailed Description

template<class I2cMaster>
class modm::Lsm303a< I2cMaster >

Template Parameters
I2cMasterA class conforming to the I2cMaster interface
Author
Niklas Hauser

Member Function Documentation

void modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::attachConfigurationHandler ( I2c::ConfigurationHandler  handler)
inheritedinline

Attaches a configuration handler, which is called before a transaction, whenever the configuration has to be changed.

bool modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::isTransactionRunning ( )
inheritedinlineprotected
Returns
true when transaction is busy.
modm::ResumableResult<bool> modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::ping ( )
inheritedinline
Return Values
truedevice responds to address
falseno device with address found
void modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::setAddress ( uint8_t  address)
inheritedinline

Sets a new address of the slave device.

Parameters
addressthe slave address not yet shifted left (address < 128).
bool modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::wasTransactionSuccessful ( )
inheritedinlineprotected
Returns
true when transaction did not return an error.

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