FastArduino  v1.8
C++ library to build fast but small Arduino/AVR projects
i2c::AbstractI2CAsyncManager< MODE_, POLICY_, HAS_LC_, HAS_STATUS_, STATUS_HOOK_, HAS_DEBUG_, DEBUG_HOOK_ > Class Template Reference

Abstract asynchronous I2C Manager. More...

#include <fastarduino/i2c_handler_atmega.h>

Public Types

using ABSTRACT_FUTURE = future::AbstractFuture
 
template<typename T >
using PROXY = typename LC::template PROXY< T >
 
template<typename OUT , typename IN >
using FUTURE = future::Future< OUT, IN >
 
using FUTURE_PROXY = PROXY< ABSTRACT_FUTURE >
 The type passed to callback functions registered alongside ISR. More...
 
using I2CCOMMAND = I2CCommand< FUTURE_PROXY >
 The type of I2CCommand to use in the buffer passed to the constructor of this AbstractI2CAsyncManager.
 

Public Member Functions

void begin ()
 Prepare and enable the MCU for I2C transmission. More...
 
void end ()
 Disable MCU I2C transmission. More...
 
void begin_ ()
 Prepare and enable the MCU for I2C transmission. More...
 
void end_ ()
 Disable MCU I2C transmission. More...
 

Friends

template<typename >
class I2CDevice
 
struct isr_handler
 

Detailed Description

template<I2CMode MODE_, I2CErrorPolicy POLICY_, bool HAS_LC_, bool HAS_STATUS_, typename STATUS_HOOK_, bool HAS_DEBUG_, typename DEBUG_HOOK_>
class i2c::AbstractI2CAsyncManager< MODE_, POLICY_, HAS_LC_, HAS_STATUS_, STATUS_HOOK_, HAS_DEBUG_, DEBUG_HOOK_ >

Abstract asynchronous I2C Manager.

It is specifically subclassed for ATmega architecture. You should never need to subclass AbstractI2CAsyncManager yourself.

Template Parameters
MODE_the I2C mode for this manager
POLICY_the policy to use in case of an error during I2C transaction
HAS_LC_tells if this I2C Manager must be able to handle proxies to Future that can move around and must be controlled by a LifeCycleManager; using false will generate smaller code.
HAS_STATUS_tells this I2C Manager to call a status hook at each step of an I2C transaction; using false will generate smaller code.
STATUS_HOOK_the type of the hook to be called when HAS_STATUS_ is true. This can be a simple function pointer (of type I2C_STATUS_HOOK) or a Functor class (or Functor class reference). Using a Functor class will generate smaller code.
HAS_DEBUG_tells this I2C Manager to call a debugging hook at each step of an I2C transaction; this is useful for debugging support for a new I2C device; using false will generate smaller code.
DEBUG_HOOK_the type of the hook to be called when IS_DEBUG is true. This can be a simple function pointer (of type I2C_DEBUG_HOOK) or a Functor class (or Functor class reference). Using a Functor class will generate smaller code.
See also
I2CMode
I2C_STATUS_HOOK
I2C_DEBUG_HOOK
i2c::debug
i2c::status

Definition at line 394 of file i2c_handler_atmega.h.

Member Typedef Documentation

◆ FUTURE_PROXY

template<I2CMode MODE_, I2CErrorPolicy POLICY_, bool HAS_LC_, bool HAS_STATUS_, typename STATUS_HOOK_ , bool HAS_DEBUG_, typename DEBUG_HOOK_ >
using i2c::AbstractI2CAsyncManager< MODE_, POLICY_, HAS_LC_, HAS_STATUS_, STATUS_HOOK_, HAS_DEBUG_, DEBUG_HOOK_ >::FUTURE_PROXY = PROXY<ABSTRACT_FUTURE>

The type passed to callback functions registered alongside ISR.

Callbacks cam use it to check the status of the Future used for the current I2C transaction.

See also
REGISTER_I2C_ISR_FUNCTION
REGISTER_I2C_ISR_METHOD

Definition at line 418 of file i2c_handler_atmega.h.

Member Function Documentation

◆ begin()

template<I2CMode MODE_, I2CErrorPolicy POLICY_, bool HAS_LC_, bool HAS_STATUS_, typename STATUS_HOOK_ , bool HAS_DEBUG_, typename DEBUG_HOOK_ >
void i2c::AbstractI2CAsyncManager< MODE_, POLICY_, HAS_LC_, HAS_STATUS_, STATUS_HOOK_, HAS_DEBUG_, DEBUG_HOOK_ >::begin ( )
inline

Prepare and enable the MCU for I2C transmission.

Preparation includes setup of I2C pins (SDA and SCL). This method is synchronized.

See also
end()
begin_()

Definition at line 433 of file i2c_handler_atmega.h.

◆ end()

template<I2CMode MODE_, I2CErrorPolicy POLICY_, bool HAS_LC_, bool HAS_STATUS_, typename STATUS_HOOK_ , bool HAS_DEBUG_, typename DEBUG_HOOK_ >
void i2c::AbstractI2CAsyncManager< MODE_, POLICY_, HAS_LC_, HAS_STATUS_, STATUS_HOOK_, HAS_DEBUG_, DEBUG_HOOK_ >::end ( )
inline

Disable MCU I2C transmission.

This method is synchronized.

See also
begin()
end_()

Definition at line 444 of file i2c_handler_atmega.h.

◆ begin_()

template<I2CMode MODE_, I2CErrorPolicy POLICY_, bool HAS_LC_, bool HAS_STATUS_, typename STATUS_HOOK_ , bool HAS_DEBUG_, typename DEBUG_HOOK_ >
void i2c::AbstractI2CAsyncManager< MODE_, POLICY_, HAS_LC_, HAS_STATUS_, STATUS_HOOK_, HAS_DEBUG_, DEBUG_HOOK_ >::begin_ ( )
inline

Prepare and enable the MCU for I2C transmission.

Preparation includes setup of I2C pins (SDA and SCL). This method is NOT synchronized.

See also
end_()
begin()

Definition at line 456 of file i2c_handler_atmega.h.

◆ end_()

template<I2CMode MODE_, I2CErrorPolicy POLICY_, bool HAS_LC_, bool HAS_STATUS_, typename STATUS_HOOK_ , bool HAS_DEBUG_, typename DEBUG_HOOK_ >
void i2c::AbstractI2CAsyncManager< MODE_, POLICY_, HAS_LC_, HAS_STATUS_, STATUS_HOOK_, HAS_DEBUG_, DEBUG_HOOK_ >::end_ ( )
inline

Disable MCU I2C transmission.

This method is NOT synchronized.

See also
begin_()
end()

Definition at line 473 of file i2c_handler_atmega.h.


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