Andy Pomfret / lsm303d

Dependents:   UoY-32C-lab8-exercise UoY-32C-lab5-lsm303d

Embed: (wiki syntax)

« Back to documentation index

LSM303D::RWRegister< T > Class Template Reference

LSM303D::RWRegister< T > Class Template Reference

Read-write register class. More...

#include <LSM303D.h>

Inherits LSM303D::Register< T >.

Protected Member Functions

void write (T const &data)
 Explicit write method.
virtual T read () const
 Explicit read method with cache.
RWRegisteroperator= (T const &data)
 Equivalent to write().
RWRegisteroperator= (int const &data)
 Equivalent to write(), with an explicit int parameter.
RWRegisteroperator|= (T const &data)
 Or-assignment operator.
RWRegisteroperator|= (int const &data)
 Or-assignment operator, with an explicit int parameter.
RWRegisteroperator&= (T const &data)
 And-assignment operator.
RWRegisteroperator&= (int const &data)
 And-assignment operator, with an explicit int parameter.

Friends

class LSM303D

Detailed Description

template<class T>
class LSM303D::RWRegister< T >

Read-write register class.

Template Parameters:
TThe underlying data type of the register. Provides an interface onto the writable registers of the LSM303D. Operator overloading means that it can be treated as a variable of type T for most purposes. Assignment from int is also explicitly supported to allow integer literals to be used without qualification or casting. The register value is cached on first read and updated on write, so read accesses do not use the I2C bus.

Definition at line 104 of file LSM303D.h.


Member Function Documentation

RWRegister& operator&= ( T const &  data ) [protected]

And-assignment operator.

Parameters:
dataThe value to AND with the register's existing contents.
Returns:
A reference to this object.

Definition at line 166 of file LSM303D.h.

RWRegister& operator&= ( int const &  data ) [protected]

And-assignment operator, with an explicit int parameter.

Parameters:
dataThe value to AND with the register's existing contents.
Returns:
A reference to this object.

Definition at line 173 of file LSM303D.h.

RWRegister& operator= ( int const &  data ) [protected]

Equivalent to write(), with an explicit int parameter.

Parameters:
dataThe new value to write to the register.
Returns:
A reference to this object.

Definition at line 145 of file LSM303D.h.

RWRegister& operator= ( T const &  data ) [protected]

Equivalent to write().

Parameters:
dataThe new value to write to the register.
Returns:
A reference to this object.

Definition at line 138 of file LSM303D.h.

RWRegister& operator|= ( T const &  data ) [protected]

Or-assignment operator.

Parameters:
dataThe value to OR with the register's existing contents.
Returns:
A reference to this object.

Definition at line 152 of file LSM303D.h.

RWRegister& operator|= ( int const &  data ) [protected]

Or-assignment operator, with an explicit int parameter.

Parameters:
dataThe value to OR with the register's existing contents.
Returns:
A reference to this object.

Definition at line 159 of file LSM303D.h.

virtual T read (  ) const [protected, virtual]

Explicit read method with cache.

Returns:
The current value of the register, from cache if available.

Reimplemented from LSM303D::Register< T >.

Definition at line 128 of file LSM303D.h.

void write ( T const &  data ) [protected]

Explicit write method.

Parameters:
dataThe new value to write to the register.

Definition at line 116 of file LSM303D.h.