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

General Future that can be used to write to an I2C device register. More...

#include <fastarduino/i2c_device_utilities.h>

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

Public Member Functions

 WriteRegisterFuture (uint8_t reg, const ARG_TYPE &value, future::FutureNotification notification=future::FutureNotification::NONE)
 Create a WriteRegisterFuture future for a given device register reg. More...
 

Detailed Description

template<typename MANAGER, typename T, typename FUNCTOR = functor::Identity<T>>
class i2c::WriteRegisterFuture< MANAGER, T, FUNCTOR >

General Future that can be used to write to 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. WriteRegisterFuture can be used in any I2C device supporting class (subclass of i2c::I2CDevice) in almost all situations where you need to write to a register, whatever its type. WriteRegisterFuture supports conversion of argument passed to constructor to a transformed value that fits the device register, 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).

Template Parameters
MANAGERthe type of I2C Manager used to handle I2C communication
Tthe type of the register to write to
FUNCTORthe type of an adequate functor to transform the value passed to this future constructor to a more suitable value for the device register; defaults to functor::Identity<T> which does nothing.
See also
TWriteRegisterFuture
ReadRegisterFuture
i2c::I2CSyncManager
i2c::I2CAsyncManager
functor

Definition at line 202 of file i2c_device_utilities.h.

Constructor & Destructor Documentation

◆ WriteRegisterFuture()

template<typename MANAGER , typename T , typename FUNCTOR = functor::Identity<T>>
i2c::WriteRegisterFuture< MANAGER, T, FUNCTOR >::WriteRegisterFuture ( uint8_t  reg,
const ARG_TYPE &  value,
future::FutureNotification  notification = future::FutureNotification::NONE 
)
inlineexplicit

Create a WriteRegisterFuture future for a given device register reg.

This future can then be used to write a value to the register.

Parameters
regthe address of the register to write to in the I2C device
valuethe value to write to the register in the I2C device
notificationdetermines if and which notifications should be dispatched by this WriteRegisterFuture; default is none.

Definition at line 227 of file i2c_device_utilities.h.


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