FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
General Future that can be used to read an I2C device register. More...
#include <fastarduino/i2c_device_utilities.h>
Public Member Functions | |
ReadRegisterFuture (uint8_t reg, future::FutureNotification notification=future::FutureNotification::NONE) | |
Create a ReadRegisterFuture future for a given device register reg . More... | |
General Future that can be used to read an I2C device register.
Most I2C devices have registers, accessible by a byte address; register values may be one or more bytes long; these may be integral types or not. ReadRegisterFuture can be used in any I2C device supporting class (subclass of i2c::I2CDevice
) in almost all situations where you need to read a register, whatever its type. ReadRegisterFuture supports conversion of register value to a transformed result, thanks to its use of functors. Standard functors are provided for e.g. endianness conversion, if the I2C device uses big endian (while ATmel MCU are little-endian).
MANAGER | the type of I2C Manager used to handle I2C communication |
T | the type of the register to read from |
FUNCTOR | the type of an adequate functor to transform the register value to a more suitable result; defaults to functor::Identity<T> which does nothing. |
Definition at line 82 of file i2c_device_utilities.h.
|
inlineexplicit |
Create a ReadRegisterFuture future for a given device register reg
.
This future can then be used to read the register value.
reg | the address of the register to read from the I2C device |
notification | determines if and which notifications should be dispatched by this ReadRegisterFuture; default is none. |
Definition at line 105 of file i2c_device_utilities.h.