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

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

Inheritance diagram for modm::Mmc5603< I2cMaster >:
modm::I2cDevice< I2cMaster, 3 > modm::NestedResumable< 10+1 >

Classes

struct  Data
 

Public Types

enum  Register : uint8_t
 
enum  Status1 : uint8_t
 
enum  Control0 : uint8_t
 
enum  Control1 : uint8_t
 
enum  Bandwidth : uint8_t
 
enum  Control2 : uint8_t
 
enum  PeriodicalSet : uint8_t
 

Public Member Functions

 MODM_FLAGS8 (Status1)
 
 MODM_FLAGS8 (Control0)
 
 MODM_FLAGS8 (Control1)
 
 MODM_FLAGS_CONFIG (Control1, Bandwidth)
 
 MODM_FLAGS8 (Control2)
 
 MODM_FLAGS_CONFIG (Control2, PeriodicalSet)
 
 Mmc5603 (Data &data, uint8_t address=addr ())
 Constructor, requires a mmc5603::Data object.
 
modm::ResumableResult< bool > ping ()
 
modm::ResumableResult< bool > startTemperatureMeasurement ()
 
modm::ResumableResult< bool > configureContinuousMode (uint8_t frequency, Bandwidth bandwidth=Bandwidth::Ms2_0)
 Continuous Mode up to 250Hz with Automatic Set/Reset, 2ms Measurement Time.
 
DatagetData ()
 
Status1_t getStatus1 ()
 
uint8_t getOutputDataRate ()
 
Control0_t getControl0 ()
 
Control1_t getControl1 ()
 
Control2_t getControl2 ()
 
modm::ResumableResult< bool > readProductId (uint8_t &value)
 
modm::ResumableResult< bool > readMagneticField ()
 
modm::ResumableResult< bool > update (Register reg, Register_t setMask, Register_t clearMask=Register_t (0))
 
modm::ResumableResult< bool > write (Register reg, uint8_t value)
 
modm::ResumableResult< bool > read (Register reg, uint8_t &value)
 
modm::ResumableResult< bool > read (Register reg, uint8_t *data, uint8_t size)
 
void attachConfigurationHandler (I2c::ConfigurationHandler handler)
 
void setAddress (uint8_t address)
 

Static Public Member Functions

static constexpr uint8_t addr (uint8_t factory=0)
 

Static Public Attributes

static constexpr uint8_t ProductID {0x10}
 

Protected Member Functions

uint8_t & rb (Register reg)
 
modm::ResumableResult< ReturnType > resumable function (...)
 
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 seperate 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 ()
 Force all resumable functions to stop running at the current nesting level.
 
bool wasTransactionSuccessful ()
 

Protected Attributes

Datadata
 
uint8_t regBuffer [9] = {}
 
uint8_t buffer [2]
 
I2cWriteReadTransaction transaction
 

Detailed Description

template<class I2cMaster>
class modm::Mmc5603< I2cMaster >

Author
Niklas Hauser

Member Enumeration Documentation

template<class I2cMaster >
enum modm::Mmc5603::Bandwidth : uint8_t
strong

The bandwidth adjusts the length of the decimation filter. It controls the duration of each measurement.

Note
X/Y/Z channel measurements are taken sequentially. Delay Time among those measurements is 1/3 of the Measurement Time defined in the table.
template<class I2cMaster >
enum modm::Mmc5603::PeriodicalSet : uint8_t
strong

These bits determine how many measurements are done before a set is executed, when the part is in continuous mode and the automatic set/reset is enabled. From 000 to 111, the sensor will do one set for every 1, 25, 75, 100, 250, 500, 1000, and 2000 samples. In order to enable this feature, both En_prd_set and Auto_SR must be set to 1, and the part should work in continuous mode. Please note that during this operation, the sensor will not be reset.

Member Function Documentation

template<class I2cMaster >
static constexpr uint8_t modm::Mmc5603< I2cMaster >::addr ( uint8_t  factory = 0)
inlinestaticconstexpr

The MEMSIC device 7-bit device address is 0110000 where the three LSB’s are pre-programmed into the MMC5603NJ by the factory.

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.

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
bool modm::NestedResumable< 1 >::isResumableRunning ( ) const
inheritedinline
Returns
true if a resumable function is running at the current nesting level, else false
bool modm::I2cDevice< I2cMaster, 10 , I2cWriteReadTransaction >::isTransactionRunning ( )
inheritedinlineprotected
Returns
true when transaction is busy.
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: