Rename module TWI to I2C and add comments

This commit is contained in:
2024-09-04 02:47:45 +02:00
parent b9443f8cec
commit c4b6f8cdd9
4 changed files with 150 additions and 116 deletions

21
src/bus/i2c.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef MAD_CORE_BUS_I2C_H
#define MAD_CORE_BUS_I2C_H
// Sensors
#define AHT01 0x0 // Upper Sensor TWI Channel
#define AHT02 0x1 // Middle Sensor TWI Channel
#define AHT03 0x2 // Lower Sensor TWI Channel
int I2C_Init(void);
int I2C_Start(unsigned char addr, unsigned char mode);
int I2C_SetChannel(int channel);
int I2C_Write(unsigned char data);
unsigned char I2C_Read_ACK(void);
unsigned char I2C_Read_NACK(void);
int I2C_Wait_ACK(void);
int I2C_Stop(void);
int I2C_AHT20_Init(void);
int I2C_AHT20_Read(float *temp, float *rhum);
#endif // MAD_CORE_BUS_I2C_H