C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
rtos_HW_I2C_Master Class Reference

This is a C++ wrapper for the original pico SDK i2c master API, adapted to FreeRTOS environment. More...

#include <rtos_hw_i2c.h>

Inheritance diagram for rtos_HW_I2C_Master:
Inheritance graph
Collaboration diagram for rtos_HW_I2C_Master:
Collaboration graph

Public Member Functions

 rtos_HW_I2C_Master (struct_ConfigMasterI2C cfg)
 Constructor of the class.
 
 ~rtos_HW_I2C_Master ()
 Destructor of the class.
 
struct_I2CXferResult burst_byte_write (uint8_t slave_address, uint8_t mem_addr, uint8_t *source_address, size_t length)
 a function member to write a burst of data to a slave device, using DMA and FreeRTOS queue
 
struct_I2CXferResult repeat_byte_write (uint8_t slave_address, uint8_t mem_addr, uint8_t pattern, size_t length)
 a function member to write a burst of data to a slave device, using DMA and FreeRTOS queue
 
struct_I2CXferResult burst_byte_read (uint8_t slave_address, uint8_t mem_address, uint8_t *destination_address, size_t length)
 a convenient C++ member wrapper to read a block of data starting at a slave memory address, using DMA and FreeRTOS queue
 
void i2c_dma_isr ()
 the I2C IRQ handler, to be called in the main program IRQ map
 
- Public Member Functions inherited from HW_I2C_Master
 HW_I2C_Master (struct_ConfigMasterI2C master_config)
 Construct a new hw i2c master object.
 
struct_I2CXferResult single_byte_write (uint8_t slave_address, uint8_t mem_addr, uint8_t mem_value)
 a convenient C++ member wrapper to write a single byte at a slave memory address. The operation is bounded by a timeout.
 
struct_I2CXferResult single_byte_read (uint8_t slave_address, uint8_t mem_addr, uint8_t *dest)
 a convenient C++ member wrapper to read a single byte at a slave memory address. The operation is bounded by a timeout.
 
std::set< uint8_t > bus_scan ()
 A utility that scan the I2C bus and return the set of answering devices.
 
bool device_is_connected (uint8_t slave_address)
 utility to know if a device is connected
 

Public Attributes

HW_DMAtx_dma
 the DMA channel used for I2C TX
 
SemaphoreHandle_t i2c_tx_FIFO_empty
 semaphore to signal the TX FIFO of I2C is empty
 
SemaphoreHandle_t i2c_access_mutex
 semaphore to protect access to the I2C bus
 

Additional Inherited Members

- Protected Attributes inherited from HW_I2C_Master
i2c_inst_t * i2c
 the i2c hardware instance of the Pico that handles the i2c master
 
irq_handler_t i2c_master_exclusive_irq_handler = NULL
 a function pointer to the IRQ i2c_master_exclusive_handler, to the program that manage the I2C IRQ when used with DMA
 
irq_num_t i2c_irq_number
 the attached irq to the i2c instance
 

Detailed Description

This is a C++ wrapper for the original pico SDK i2c master API, adapted to FreeRTOS environment.

Constructor & Destructor Documentation

◆ rtos_HW_I2C_Master()

rtos_HW_I2C_Master::rtos_HW_I2C_Master ( struct_ConfigMasterI2C cfg)

Constructor of the class.

Parameters
cfgthe configuration structure for the I2C master
Here is the call graph for this function:

Member Function Documentation

◆ burst_byte_read()

struct_I2CXferResult rtos_HW_I2C_Master::burst_byte_read ( uint8_t slave_address,
uint8_t mem_address,
uint8_t * destination_address,
size_t length )
virtual

a convenient C++ member wrapper to read a block of data starting at a slave memory address, using DMA and FreeRTOS queue

Parameters
slave_addressthe slave address
mem_addressthe starting address of slave memory to read from
destination_addressPointer to buffer to receive data
lengththe size of the block of data
Returns
struct_I2CXferResult code error

Reimplemented from HW_I2C_Master.

◆ burst_byte_write()

struct_I2CXferResult rtos_HW_I2C_Master::burst_byte_write ( uint8_t slave_address,
uint8_t mem_addr,
uint8_t * source_address,
size_t length )
virtual

a function member to write a burst of data to a slave device, using DMA and FreeRTOS queue

Parameters
slave_addressthe 7-bit I2C slave address
mem_addrthe adresse to write in the slave peripheral
source_addressthe address of the data to send
lengththe number of data to send
Returns
struct_I2CXferResult code error

Reimplemented from HW_I2C_Master.

◆ repeat_byte_write()

struct_I2CXferResult rtos_HW_I2C_Master::repeat_byte_write ( uint8_t slave_address,
uint8_t mem_addr,
uint8_t pattern,
size_t length )

a function member to write a burst of data to a slave device, using DMA and FreeRTOS queue

Parameters
slave_addressthe 7-bit I2C slave address
mem_addrthe adresse to write in the slave peripheral
patternthe data to send
lengththe number of time te byte at sourcedata to send
Returns

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