I2C bus upgrade (#432)

This commit is contained in:
Zaltora 2017-09-01 06:29:32 -03:00 committed by Ruslan V. Uss
parent d100f42b1f
commit b83c2629b9
56 changed files with 909 additions and 804 deletions

View file

@ -1,4 +1,4 @@
/* Test code for DS3231 high precision RTC module
/* Test code for DS3231 high precision RTC module
*
* Part of esp-open-rtos
* Copyright (C) 2016 Bhuvanchandra DV <bhuvanchandra.dv@gmail.com>
@ -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);
}
}
@ -35,7 +41,7 @@ void user_init(void)
printf("SDK version : %s\n", sdk_system_get_sdk_version());
printf("GIT version : %s\n", GITSHORTREV);
ds3231_Init(scl, sda);
i2c_init(0,scl,sda,I2C_FREQ_400K);
xTaskCreate(task1, "tsk1", 256, NULL, 2, NULL);
}