27#ifndef LIBRISHKA_I2C_H
28#define LIBRISHKA_I2C_H
194 static void on_receive(
void (*callback)(
int));
205 static void on_request(
void (*callback)(
void));
Class for handling I2C operations in Rishka applications.
Definition: i2c.h:42
static usize set_buffersize(usize size)
Set the buffer size for I2C transactions.
Definition: librishka_i2c.cpp:53
static bool begin(u8 address)
Initialize the I2C communication with the specified address.
Definition: librishka_i2c.cpp:21
static u32 get_clock()
Get the current clock frequency for I2C communication.
Definition: librishka_i2c.cpp:93
static bool pins(u8 sda, u8 scl)
Set the SDA and SCL pins for the I2C communication.
Definition: librishka_i2c.cpp:29
static void on_request(void(*callback)(void))
Register a callback function for I2C request events.
Definition: librishka_i2c.cpp:77
static void begin_transmission(u8 address)
Begin an I2C transmission to the specified device address.
Definition: librishka_i2c.cpp:37
static i32 available()
Get the number of bytes available for reading on the I2C bus.
Definition: librishka_i2c.cpp:65
static bool set_clock(u32 clock)
Set the clock frequency for I2C communication.
Definition: librishka_i2c.cpp:89
static void flush()
Flush the I2C buffer.
Definition: librishka_i2c.cpp:33
static i32 read()
Read data from the I2C bus.
Definition: librishka_i2c.cpp:57
static i32 peek()
Peek at the next byte on the I2C bus.
Definition: librishka_i2c.cpp:61
static usize write(u8 *data, usize size)
Write data to the I2C bus.
Definition: librishka_i2c.cpp:45
static usize slave_write(u8 *data, usize size)
Write data to the I2C bus as a slave device.
Definition: librishka_i2c.cpp:49
static u8 end_transmission(bool stop_bit)
End an I2C transmission with an optional stop bit.
Definition: librishka_i2c.cpp:41
static usize request(u8 address, usize size, bool stop_bit)
Request data from a remote I2C device.
Definition: librishka_i2c.cpp:69
static void set_timeout(u16 timeout)
Set the timeout for I2C operations.
Definition: librishka_i2c.cpp:81
static bool end()
End the I2C communication.
Definition: librishka_i2c.cpp:25
static u16 get_timeout()
Get the current timeout for I2C operations.
Definition: librishka_i2c.cpp:85
static void on_receive(void(*callback)(int))
Register a callback function for I2C receive events.
Definition: librishka_i2c.cpp:73
Header file for common data types used in Rishka applications.
signed int i32
Alias for the signed 32-bit integer type.
Definition: types.h:58
unsigned int u32
Alias for the unsigned 32-bit integer type.
Definition: types.h:82
unsigned short int u16
Alias for the unsigned 16-bit integer type.
Definition: types.h:76
unsigned char u8
Alias for the unsigned 8-bit integer type.
Definition: types.h:70
u32 usize
Alias for the unsigned integer type representing size.
Definition: types.h:94