FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
i2c::TReadRegisterFuture< MANAGER, REGISTER, T, FUNCTOR > Class Template Reference

Generic Future that can be used to read an I2C device register. More...

#include <fastarduino/i2c_device_utilities.h>

Inheritance diagram for i2c::TReadRegisterFuture< MANAGER, REGISTER, T, FUNCTOR >:
Collaboration diagram for i2c::TReadRegisterFuture< MANAGER, REGISTER, T, FUNCTOR >:

Public Member Functions

 TReadRegisterFuture (future::FutureNotification notification=future::FutureNotification::NONE)
 Create a TReadRegisterFuture future. More...
 
- Public Member Functions inherited from i2c::ReadRegisterFuture< MANAGER, T, FUNCTOR >
 ReadRegisterFuture (uint8_t reg, future::FutureNotification notification=future::FutureNotification::NONE)
 Create a ReadRegisterFuture future for a given device register reg. More...
 

Detailed Description

template<typename MANAGER, uint8_t REGISTER, typename T, typename FUNCTOR = functor::Identity<T>>
class i2c::TReadRegisterFuture< MANAGER, REGISTER, T, FUNCTOR >

Generic 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. TReadRegisterFuture 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. TReadRegisterFuture 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). Typical usage is through using statement as in the following snippet:

// Excerpt from VL53L0X device
int get_direct_range(GetDirectRangeFuture& future) {
...
}
Generic Future that can be used to read an I2C device register.
Contains the API around Future implementation.
Definition: future.h:312
Template Parameters
MANAGERthe type of I2C Manager used to handle I2C communication
REGISTERthe address of the register to read from the I2C device
Tthe type of the register to read from
FUNCTORthe type of an adequate functor to transform the register value to a more suitable result; defaults to functor::Identity<T> which does nothing.
See also
ReadRegisterFuture
TWriteRegisterFuture
i2c::I2CSyncManager
i2c::I2CAsyncManager
functor

Definition at line 154 of file i2c_device_utilities.h.

Constructor & Destructor Documentation

◆ TReadRegisterFuture()

template<typename MANAGER , uint8_t REGISTER, typename T , typename FUNCTOR = functor::Identity<T>>
i2c::TReadRegisterFuture< MANAGER, REGISTER, T, FUNCTOR >::TReadRegisterFuture ( future::FutureNotification  notification = future::FutureNotification::NONE)
inlineexplicit

Create a TReadRegisterFuture future.

This future can then be used to read the register value.

Parameters
notificationdetermines if and which notifications should be dispatched by this TReadRegisterFuture; default is none.

Definition at line 164 of file i2c_device_utilities.h.


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