2017-04-23 08:35:23 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2017-04-25 16:57:40 +00:00
|
|
|
#include "espressif/esp_common.h"
|
|
|
|
#include "esp/uart.h"
|
|
|
|
|
|
|
|
#include "FreeRTOS.h"
|
|
|
|
#include "task.h"
|
|
|
|
|
|
|
|
#include "i2c/i2c.h"
|
|
|
|
#include "pcf8591/pcf8591.h"
|
2017-04-23 08:35:23 +00:00
|
|
|
|
|
|
|
#define SCL_PIN 5
|
|
|
|
#define SDA_PIN 4
|
|
|
|
|
2017-04-25 16:57:40 +00:00
|
|
|
static void measure(void *pvParameters)
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
|
|
printf("Value: %d\n", pcf8591_read(PCF8591_DEFAULT_ADDRESS, 0x03));
|
|
|
|
}
|
|
|
|
}
|
2017-04-23 08:35:23 +00:00
|
|
|
|
|
|
|
void user_init(void)
|
|
|
|
{
|
|
|
|
uart_set_baud(0, 115200);
|
|
|
|
|
2017-04-25 16:57:40 +00:00
|
|
|
// Just some information
|
|
|
|
printf("\n");
|
|
|
|
printf("SDK version : %s\n", sdk_system_get_sdk_version());
|
|
|
|
printf("GIT version : %s\n", GITSHORTREV);
|
2017-04-23 08:35:23 +00:00
|
|
|
|
2017-04-25 16:57:40 +00:00
|
|
|
i2c_init(SCL_PIN, SDA_PIN);
|
2017-04-23 08:35:23 +00:00
|
|
|
|
2017-04-25 16:57:40 +00:00
|
|
|
xTaskCreate(measure, "measure_task", 256, NULL, 2, NULL);
|
2017-04-23 08:35:23 +00:00
|
|
|
}
|