15 #include "simpletools.h" 25 #ifndef DOXYGEN_SHOULD_SKIP_THIS 27 typedef struct i2cslave_struct
30 volatile char address;
37 typedef i2cslave_t i2cslave;
39 #endif // DOXYGEN_SHOULD_SKIP_THIS 54 i2cslave_t *
i2cslave_open(
int pin_clock,
int pin_data,
int address);
void i2cslave_clearFlag(i2cslave_t *device, int index)
Clear a certain register's flag.
Definition: i2cslave.c:81
int i2cslave_checkFlags(i2cslave_t *device)
Check the flags register. Bits 31 to 0 indicate if data has changed in registers 31 to 0...
Definition: i2cslave.c:69
char i2cslave_getReg(i2cslave_t *device, int index)
Get the value stored by a certain register.
Definition: i2cslave.c:87
char * i2cslave_regAddr(i2cslave_t *device)
Provides a pointer to the first of the I2C slave device's 32 byte registers. Applications can use thi...
Definition: i2cslave.c:40
void i2cslave_flush(i2cslave_t *device)
Clear all register values and flags.
Definition: i2cslave.c:101
int i2cslave_checkForRegChange(i2cslave_t *device)
Check if any registers have changed. If a register has changed, return its number. If more than one register has changed, return the highest address that has changed. If no registers have changed, return -1.
Definition: i2cslave.c:46
int i2cslave_checkReg(i2cslave_t *device, int index)
Get the register value if it has changed.
Definition: i2cslave.c:54
int bitwiseEncode(int i)
Find out the highest bit with a 1 in a 32 bit register.
Definition: i2cslave.c:108
i2cslave_t * i2cslave_open(int pin_clock, int pin_data, int address)
Start an I2C slave processor in a new cog.
Definition: i2cslave.c:12
int i2cslave_checkFlag(i2cslave_t *device, int index)
Check a certain register's flag.
Definition: i2cslave.c:75
void i2cslave_close(i2cslave_t *device)
Stop the I2C slave processor and make cog and memory resources available for other uses...
Definition: i2cslave.c:29
void i2cslave_putReg(i2cslave_t *device, int index, int value)
Set the value of a register.
Definition: i2cslave.c:95