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

Generic Future that can be used to write to several I2C device registers. More...

#include <fastarduino/i2c_device_utilities.h>

Inheritance diagram for i2c::TWriteMultiRegisterFuture< MANAGER, T, REGISTERS >:
Collaboration diagram for i2c::TWriteMultiRegisterFuture< MANAGER, T, REGISTERS >:

Public Member Functions

 TWriteMultiRegisterFuture (std::initializer_list< T > values, future::FutureNotification notification=future::FutureNotification::NONE)
 Create a TWriteMultiRegisterFuture future. More...
 

Static Public Attributes

static constexpr uint8_t NUM_WRITES = sizeof...(REGISTERS)
 Number of write commands to use inside the complete I2C transaction in order to perform this multiple registers write. More...
 
static constexpr uint8_t WRITE_SIZE = sizeof(T) + 1
 The number of bytes to write for each register command in the I2C transaction. More...
 

Detailed Description

template<typename MANAGER, typename T, uint8_t... REGISTERS>
class i2c::TWriteMultiRegisterFuture< MANAGER, T, REGISTERS >

Generic Future that can be used to write to several I2C device registers.

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. TWriteMultiRegisterFuture can be used in any I2C device supporting class (subclass of i2c::I2CDevice) in almost all situations where you need to write to several registers, whatever their address on the device.

Template Parameters
MANAGERthe type of I2C Manager used to handle I2C communication
Tthe type of all registers to write to (all registers must be the same type)
REGISTERSthe address of all registers to write in the I2C device
See also
TReadRegisterFuture
WriteRegisterFuture
i2c::I2CSyncManager
i2c::I2CAsyncManager

Definition at line 359 of file i2c_device_utilities.h.

Constructor & Destructor Documentation

◆ TWriteMultiRegisterFuture()

template<typename MANAGER , typename T , uint8_t... REGISTERS>
i2c::TWriteMultiRegisterFuture< MANAGER, T, REGISTERS >::TWriteMultiRegisterFuture ( std::initializer_list< T >  values,
future::FutureNotification  notification = future::FutureNotification::NONE 
)
inlineexplicit

Create a TWriteMultiRegisterFuture future.

This future can then be used to write values to all registers for this instance.

Parameters
valuesthe values to write to the registers in the I2C device; all values must be the same type T and the list must contains the same number of values as there are registers for this instance.
notificationdetermines if and which notifications should be dispatched by this TWriteMultiRegisterFuture; default is none.

Definition at line 392 of file i2c_device_utilities.h.

Member Data Documentation

◆ NUM_WRITES

template<typename MANAGER , typename T , uint8_t... REGISTERS>
constexpr uint8_t i2c::TWriteMultiRegisterFuture< MANAGER, T, REGISTERS >::NUM_WRITES = sizeof...(REGISTERS)
staticconstexpr

Number of write commands to use inside the complete I2C transaction in order to perform this multiple registers write.

Definition at line 374 of file i2c_device_utilities.h.

◆ WRITE_SIZE

template<typename MANAGER , typename T , uint8_t... REGISTERS>
constexpr uint8_t i2c::TWriteMultiRegisterFuture< MANAGER, T, REGISTERS >::WRITE_SIZE = sizeof(T) + 1
staticconstexpr

The number of bytes to write for each register command in the I2C transaction.

Definition at line 380 of file i2c_device_utilities.h.


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