ds3231 ads111x bh1750 update + I2c device desciptor
This commit is contained in:
parent
130385fecd
commit
a731034e65
12 changed files with 190 additions and 177 deletions
|
|
@ -12,15 +12,21 @@
|
|||
|
||||
#include "ds3231/ds3231.h"
|
||||
|
||||
#define ADDR DS3231_ADDR
|
||||
#define I2C_BUS 0
|
||||
|
||||
void task1(void *pvParameters)
|
||||
{
|
||||
struct tm time;
|
||||
float tempFloat;
|
||||
|
||||
i2c_dev_t dev = {
|
||||
.addr = ADDR,
|
||||
.bus = I2C_BUS,
|
||||
};
|
||||
while(1) {
|
||||
vTaskDelay(100);
|
||||
ds3231_getTime(&time);
|
||||
ds3231_getTempFloat(&tempFloat);
|
||||
ds3231_getTime(&dev, &time);
|
||||
ds3231_getTempFloat(&dev, &tempFloat);
|
||||
printf("TIME:%d:%d:%d, TEMPERATURE:%.2f DegC\r\n", time.tm_hour, time.tm_min, time.tm_sec, tempFloat);
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +42,6 @@ void user_init(void)
|
|||
printf("GIT version : %s\n", GITSHORTREV);
|
||||
|
||||
i2c_init(0,scl,sda,I2C_FREQ_400K);
|
||||
ds3231_Init(0);
|
||||
|
||||
xTaskCreate(task1, "tsk1", 256, NULL, 2, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue