|
/*
|
|
|
|
I2C MODULE
|
|
|
|
Copyright (C) 2017-2019 by Xose Pérez <xose dot perez at gmail dot com>
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#if I2C_SUPPORT
|
|
|
|
#if I2C_USE_BRZO
|
|
#include <brzo_i2c.h>
|
|
#else
|
|
#include <Wire.h>
|
|
#endif
|
|
|
|
void i2c_wakeup(uint8_t address);
|
|
uint8_t i2c_write_buffer(uint8_t address, uint8_t * buffer, size_t len);
|
|
uint8_t i2c_write_uint8(uint8_t address, uint8_t value);
|
|
uint8_t i2c_write_uint8(uint8_t address, uint8_t reg, uint8_t value);
|
|
uint8_t i2c_write_uint8(uint8_t address, uint8_t reg, uint8_t value1, uint8_t value2);
|
|
uint8_t i2c_write_uint16(uint8_t address, uint16_t value);
|
|
uint8_t i2c_write_uint16(uint8_t address, uint8_t reg, uint16_t value);
|
|
uint8_t i2c_read_uint8(uint8_t address);
|
|
uint8_t i2c_read_uint8(uint8_t address, uint8_t reg);
|
|
uint16_t i2c_read_uint16(uint8_t address);
|
|
uint16_t i2c_read_uint16(uint8_t address, uint8_t reg);
|
|
uint16_t i2c_read_uint16_le(uint8_t address, uint8_t reg);
|
|
int16_t i2c_read_int16(uint8_t address, uint8_t reg);
|
|
int16_t i2c_read_int16_le(uint8_t address, uint8_t reg);
|
|
void i2c_read_buffer(uint8_t address, uint8_t * buffer, size_t len);
|
|
|
|
void i2cScan();
|
|
void i2cClearBus();
|
|
bool i2cGetLock(unsigned char address);
|
|
bool i2cReleaseLock(unsigned char address);
|
|
|
|
unsigned char i2cFindAndLock(size_t size, unsigned char * addresses);
|
|
|
|
#endif // I2C_SUPPORT == 1
|