AVR-Playground/i2c.h
2024-03-24 04:07:20 +01:00

20 lines
No EOL
380 B
C

#pragma once
#include <stdint.h>
#define TW_WRITE 0
#define TW_READ 1
// Function to initialize I2C
void I2C_init(uint32_t SCL_CLOCK);
// Function to send start condition
uint8_t I2C_start(uint8_t addr);
// Function to send stop condition
void I2C_stop();
// Write a byte to I2C bus
uint8_t I2C_write(uint8_t data);
// Read a byte from I2C bus
uint8_t I2C_read(uint8_t ack);