Define constants for ADC multiplexer settings and describe I2C status flags

This commit is contained in:
2024-09-06 19:47:09 +02:00
parent f4a6c655bd
commit 4ded84f3f8
3 changed files with 33 additions and 26 deletions

View File

@@ -16,7 +16,7 @@
// TODO: Write an improved command parser (low priority).
// TODO: Proper error handling and recovery (after testing).
int Init(void)
static int Init(void)
{
// MOSFETS control things like the heating element
// so they are the highest priority to initialize
@@ -94,7 +94,7 @@ int Init(void)
return 0;
}
void Update(void)
static void Update(void)
{
float temp[3], rh[3];
short adc[4];
@@ -110,10 +110,10 @@ void Update(void)
I2C_SetChannel(AHT03);
I2C_AHT20_Read(&temp[2], &rh[2]);
adc[0] = I2C_ADS1115_Read(0);
adc[1] = I2C_ADS1115_Read(1);
adc[2] = I2C_ADS1115_Read(2);
adc[3] = I2C_ADS1115_Read(3);
adc[0] = I2C_ADS1115_Read(ADS01);
adc[1] = I2C_ADS1115_Read(ADS02);
adc[2] = I2C_ADS1115_Read(ADS03);
adc[3] = I2C_ADS1115_Read(ADS04);
Info("TEMP0=%.2fC, RH0=%.2f%%", temp[0], rh[0]);
Info("TEMP1=%.2fC, RH1=%.2f%%", temp[1], rh[1]);