11#ifndef PICO_DRIVER_SRC_I2C_I2CMASATER_HPP_
12#define PICO_DRIVER_SRC_I2C_I2CMASATER_HPP_
13#if __has_include(<hardware/i2c.h>) || __has_include(<gmock/gmock.h>) || DOXYGEN_COMPILE
17#if __has_include(<hardware/i2c.h>)
18#include "hardware/i2c.h"
23#define PICO_ERROR_GENERIC -1
26#define GPIO_FUNC_I2C 11
117 virtual int ReadBlocking(uint8_t addr, uint8_t *dst,
size_t len,
bool nostop);
145#if __has_include(<gmock/gmock.h>)|| DOXYGEN_COMPILE
156 :
I2cMaster(sdk, dummy_i2c, 100'000, 10, 11) {
159 int(uint8_t addr, uint8_t *dst,
size_t len,
bool nostop));
161 int(uint8_t addr,
const uint8_t *src,
size_t len,
bool nostop));
I2C Master controller class.
Definition: i2cmaster.hpp:83
I2cMaster(SdkWrapper &sdk, i2c_inst_t &i2c, uint clock_freq, uint scl_pin, uint sda_pin)
Initialize the given I2C port and setup the pins.
virtual int ReadBlocking(uint8_t addr, uint8_t *dst, size_t len, bool nostop)
Attempt to read specified number of bytes from address, blocking.
virtual ~I2cMaster()
deinit the I2C by SdkWrapper::i2c_deinit();
virtual bool IsDeviceExisting(uint8_t addr)
Check wether device at specified I2C address exists or not.
virtual int WriteBlocking(uint8_t addr, const uint8_t *src, size_t len, bool nostop)
Attempt to write specified number of bytes to address, blocking.
Mock class for test.
Definition: i2cmaster.hpp:150
Wrapper class for the RasPi Pico SDK functions.
Definition: sdkwrapper.hpp:74
int i2c_inst_t
Alternate definition for unit test.
Definition: i2cmaster.hpp:21
Collection of the RP2040/RP2350 control.
Definition: adau1361.hpp:17
Wrapper for RasPi Pico SDK API.