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

this is a C++ wrapper for the original pico SDK i2c master API More...

#include <hw_i2c.h>

Collaboration diagram for HW_I2C_Master:
Collaboration graph

Public Member Functions

 HW_I2C_Master (struct_ConfigMasterI2C master_config)
 Construct a new hw i2c master object.
 
struct_I2CXferResult burst_byte_write (uint8_t slave_address, uint8_t mem_addr, uint8_t *src, size_t len)
 a convenient C++ member wrapper to write a block of data starting at a slave memory address. The operation is bounded by a timeout
 
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.
 
struct_I2CXferResult burst_byte_read (uint8_t slave_address, uint8_t mem_addr, uint8_t *dest, size_t len)
 a convenient C++ member wrapper to read a block of data starting 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
 

Detailed Description

this is a C++ wrapper for the original pico SDK i2c master API

Constructor & Destructor Documentation

◆ HW_I2C_Master()

HW_I2C_Master::HW_I2C_Master ( struct_ConfigMasterI2C master_config)

Construct a new hw i2c master object.

Parameters
master_config

Member Function Documentation

◆ burst_byte_read()

struct_I2CXferResult HW_I2C_Master::burst_byte_read ( uint8_t slave_address,
uint8_t mem_addr,
uint8_t * dest,
size_t len )

a convenient C++ member wrapper to read a block of data starting at a slave memory address. The operation is bounded by a timeout.

Parameters
slave_addressthe slave address
mem_addrthe starting address of slave memory to read from
destPointer to buffer to receive data
lenthe size of the block of data
Returns
struct_I2CXferResult

◆ burst_byte_write()

struct_I2CXferResult HW_I2C_Master::burst_byte_write ( uint8_t slave_address,
uint8_t mem_addr,
uint8_t * src,
size_t len )

a convenient C++ member wrapper to write a block of data starting at a slave memory address. The operation is bounded by a timeout

Parameters
slave_addressthe slave address
mem_addrthe slave memory
srcthe address of the block of data
lenthe size of the block of data
Returns
struct_I2CXferResult

◆ bus_scan()

std::set< uint8_t > HW_I2C_Master::bus_scan ( )

A utility that scan the I2C bus and return the set of answering devices.

Returns
std::set<uint8_t> the set of responding addresses
Here is the call graph for this function:

◆ device_is_connected()

bool HW_I2C_Master::device_is_connected ( uint8_t slave_address)

utility to know if a device is connected

Parameters
slave_address
Returns
true the device responds ACK to a write
false no response
Here is the caller graph for this function:

◆ single_byte_read()

struct_I2CXferResult HW_I2C_Master::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.

Parameters
slave_addressthe slave address
mem_addrthe address of slave memory to read from
destPointer to buffer to receive data
Returns
struct_I2CXferResult

◆ single_byte_write()

struct_I2CXferResult HW_I2C_Master::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.

Parameters
slave_addressthe slave address
mem_addrthe slave memory
mem_valuethe byte to write
Returns
struct_I2CXferResult

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