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

Class to allow dynamic creation of futures from values stored in flash memory, leading to launch of I2C transactions. More...

#include <fastarduino/i2c_device_utilities.h>

Inheritance diagram for i2c::I2CSameFutureGroup< MANAGER >:
Collaboration diagram for i2c::I2CSameFutureGroup< MANAGER >:

Public Member Functions

 I2CSameFutureGroup (uint16_t address, uint8_t size, future::FutureNotification notification=future::FutureNotification::NONE)
 Construct a new I2CSameFutureGroup from an array of bytes stored in flash memory. More...
 
bool start (typename PARENT::DEVICE &device)
 Start the I2C transactions needed by this group of futures. More...
 

Friends

DECL_FUTURE_LISTENERS_FRIEND friend bool await_same_future_group (I2CDevice< MANAGER > &, const uint8_t *, uint8_t)
 Helper function that creates a I2CSameFutureGroup instance for the provided flash array, launches its I2C transactions on the provided I2C device, and waits for the transaction to finish. More...
 

Detailed Description

template<typename MANAGER>
class i2c::I2CSameFutureGroup< MANAGER >

Class to allow dynamic creation of futures from values stored in flash memory, leading to launch of I2C transactions.

Generated Futures are of type WriteRegisterFuture, in order to write one byte to one register (or a sequence of 2 bytes) of the I2C device. This allows to await() for all futures, or query the overall status() of the group. This is particularly useful with complex I2C devices that require heavy setup procedures, such as VL53L0X.

Template Parameters
MANAGERthe type of I2C Manager used to handle I2C communication
See also
await_same_future_group()

Definition at line 689 of file i2c_device_utilities.h.

Constructor & Destructor Documentation

◆ I2CSameFutureGroup()

template<typename MANAGER >
i2c::I2CSameFutureGroup< MANAGER >::I2CSameFutureGroup ( uint16_t  address,
uint8_t  size,
future::FutureNotification  notification = future::FutureNotification::NONE 
)
inline

Construct a new I2CSameFutureGroup from an array of bytes stored in flash memory.

Parameters
addressaddress in flash space of the first byte to write to the I2C device
sizesize in bytes of the array at address
notificationdetermines if and which notifications should be dispatched by this I2CSameFutureGroup; default is none.

Definition at line 708 of file i2c_device_utilities.h.

Member Function Documentation

◆ start()

template<typename MANAGER >
bool i2c::I2CSameFutureGroup< MANAGER >::start ( typename PARENT::DEVICE &  device)
inline

Start the I2C transactions needed by this group of futures.

This is either called by the I2C device support class or by the helper function await_same_future_group().

Warning
Asynchronous API! If the currently active I2C Manager is asynchronous, then this method is too!
Blocking API! If the currently active I2C Manager is synchronous, then this method is blocking!
Parameters
devicethe i2c::I2CDevice subclass instance that shall handle I2C commands to the I2C device
Return values
trueif the first I2C command could be launched successfully

Definition at line 737 of file i2c_device_utilities.h.

Friends And Related Function Documentation

◆ await_same_future_group

template<typename MANAGER >
DECL_FUTURE_LISTENERS_FRIEND friend bool await_same_future_group ( I2CDevice< MANAGER > &  device,
const uint8_t *  buffer,
uint8_t  size 
)
friend

Helper function that creates a I2CSameFutureGroup instance for the provided flash array, launches its I2C transactions on the provided I2C device, and waits for the transaction to finish.

Warning
Blocking API!
Template Parameters
MANAGERthe type of I2C Manager used to handle I2C communication
Parameters
devicethe i2c::I2CDevice subclass instance that shall handle I2C commands to the I2C device
bufferpointer, in flash storage space, to the first byte to write to the I2C device
sizesize in bytes of the buffer array
Return values
trueif the whole I2C transactions could be completely performed successfully
See also
I2CSameFutureGroup

Definition at line 819 of file i2c_device_utilities.h.


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