1
0

Add ESP32_TFT lib, remove Ucglib

Implement first version of interface
This commit is contained in:
Christian Loch 2020-04-20 05:19:42 +02:00
parent f764f2fe2f
commit 0b568d7fda
17 changed files with 1572 additions and 695 deletions

7
.gitmodules vendored Normal file
View File

@ -0,0 +1,7 @@
[submodule "components/ucglib"]
path = components/ucglib
url = https://github.com/olikraus/ucglib.git
branch = master
[submodule "components/ESP32_TFT_library"]
path = components/ESP32_TFT_library
url = https://github.com/jeremyjh/ESP32_TFT_library.git

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//main/main.c=ISO-8859-1

View File

@ -3,4 +3,6 @@
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(EXTRA_COMPONENT_DIRS
externals/ESP32_TFT_library/components)
project(app-template)

View File

@ -0,0 +1,3 @@
idf_component_register(SRCS "esp32_ucglib_hal.c" "display.c"
INCLUDE_DIRS "."
REQUIRES ucglib driver tft)

View File

@ -0,0 +1,203 @@
/*
* display.c
*
* Created on: 19 Apr 2020
* Author: Chris
*/
#include "display.h"
#include "tftspi.h"
#include "tft.h"
#define SPI_BUS TFT_VSPI_HOST
typedef struct {
int datetimeW;
int datetimeA;
int dateTimeLeft;
int datetimeBaseline;
int innenW;
int aussenW;
int locA;
int tempW;
int degCW;
int tempA;
int humW;
int percentW;
int humA;
int pressW;
int pressA;
int hpaW;
int datetimebarH;
int margin;
int borderVMargin;
int innenBaseline;
int aussenBaseline;
int pressBaseline;
int humBaseline;
int tempBaseline;
int unitMaxW;
int unitW;
int ioW;
int unitLeft;
int innenLeft;
int aussenLeft;
} layout_t;
static layout_t layout;
layout_t create_layout()
{
layout_t layout;
int screenW = tft_width;
int screenH = tft_height;
layout.datetimebarH = 20; // Can be calculated too
layout.margin = 5;
layout.borderVMargin = 10;
TFT_setFont(UBUNTU16_FONT, NULL);
layout.datetimebarH = 20;
layout.datetimeW = TFT_getStringWidth("25.12.2031 08:31");
layout.datetimeA = TFT_getfontheight();
layout.dateTimeLeft = (screenW - layout.datetimeW) / 2;
layout.datetimeBaseline = (layout.datetimebarH - layout.datetimeA) / 2;
layout.innenW = TFT_getStringWidth("Innen");
layout.aussenW = TFT_getStringWidth("Außen");
layout.locA = TFT_getfontheight();
TFT_setFont(DEJAVU18_FONT, NULL);
layout.tempW = TFT_getStringWidth("-35.2");
layout.degCW = TFT_getStringWidth(" C");
layout.tempA = TFT_getfontheight();
TFT_setFont(UBUNTU16_FONT, NULL);
layout.humW = TFT_getStringWidth("25.2");
layout.percentW = TFT_getStringWidth("%");
layout.humA = TFT_getfontheight();
layout.pressW = TFT_getStringWidth("1281");
layout.pressA = TFT_getfontheight();
layout.hpaW = TFT_getStringWidth("hPa");
layout.innenBaseline = layout.datetimebarH + layout.borderVMargin;
layout.aussenBaseline = layout.innenBaseline;
layout.pressBaseline = screenH - layout.borderVMargin - layout.pressA;
layout.humBaseline = layout.pressBaseline - layout.pressA - layout.margin;
layout.tempBaseline = (layout.humBaseline - layout.humA + layout.innenBaseline) / 2
+ 0.5*layout.tempA - 1;
int unitMaxW = layout.degCW;
if (layout.percentW > unitMaxW) unitMaxW = layout.percentW;
if (layout.hpaW > unitMaxW) unitMaxW = layout.hpaW;
layout.unitW = 2*layout.margin + unitMaxW;
layout.ioW = (screenW - layout.unitW) / 2;
layout.unitLeft = screenW - layout.unitW + layout.margin;
layout.innenLeft = layout.margin;
layout.aussenLeft = layout.innenLeft + layout.ioW;
ESP_LOGI("main", "innen: %d x %d, aussen: %d x %d", layout.innenW,
layout.locA, layout.aussenW, layout.locA);
ESP_LOGI("main", "temps: %d x %d, unit: %d x %d", layout.tempW,
layout.tempA, layout.degCW, layout.tempA);
ESP_LOGI("main", "hum: %d x %d, unit: %d x %d", layout.humW, layout.humA,
layout.percentW, layout.humA);
ESP_LOGI("main", "press: %d x %d, unit: %d x %d", layout.pressW, layout.pressA,
layout.hpaW, layout.pressA);
ESP_LOGI("main", "Baselines - innen: %d, aussen: %d, press: %d, hum: %d, temp: %d",
layout.innenBaseline, layout.aussenBaseline,
layout.pressBaseline, layout.humBaseline, layout.tempBaseline);
ESP_LOGI("main", "Width - units: %d, i/o: %d", layout.unitW, layout.ioW);
ESP_LOGI("main", "Left - units: %d", layout.unitLeft);
return layout;
}
void display_data(int32_t temp_raw, uint32_t pressure_raw, uint32_t humidity_raw,
int32_t temp2_raw, uint32_t pressure2_raw, uint32_t humidity2_raw)
{
TFT_setFont(UBUNTU16_FONT, NULL);
TFT_fillScreen(TFT_BLACK);
tft_fg = TFT_WHITE;
const color_t red = {0, 0, 255};
const color_t green = {0, 255, 0};
const color_t blue = {255, 0, 0};
const color_t yellow = {255, 255, 0};
TFT_print("25.12.2031 08:31", layout.dateTimeLeft, layout.datetimeBaseline);
TFT_drawFastHLine(0, 20, 160, TFT_WHITE);
TFT_print("Innen", layout.innenLeft, layout.innenBaseline);
TFT_print("Aussen", layout.aussenLeft, layout.aussenBaseline);
TFT_setFont(DEJAVU18_FONT, NULL);
tft_fg = red;
TFT_print("-42,2", layout.innenLeft, layout.tempBaseline);
tft_fg = yellow;
TFT_print("-35,2", layout.aussenLeft, layout.tempBaseline);
tft_fg = TFT_WHITE;
TFT_print(" C", layout.unitLeft, layout.tempBaseline);
TFT_drawCircle(layout.unitLeft+3, layout.tempBaseline+3, 3, TFT_WHITE);
TFT_setFont(UBUNTU16_FONT, NULL);
TFT_print("25,2", layout.innenLeft, layout.humBaseline);
TFT_print("42,2", layout.aussenLeft, layout.humBaseline);
TFT_print("%", layout.unitLeft, layout.humBaseline);
TFT_print("1288", layout.innenLeft, layout.pressBaseline);
TFT_print("2563", layout.aussenLeft, layout.pressBaseline);
TFT_print("hPa", layout.unitLeft, layout.pressBaseline);
}
esp_err_t init_display()
{
tft_max_rdclock = 4000000;
TFT_PinsInit();
spi_lobo_device_handle_t spi;
spi_lobo_bus_config_t buscfg={
.miso_io_num=PIN_NUM_MISO, // set SPI MISO pin
.mosi_io_num=PIN_NUM_MOSI, // set SPI MOSI pin
.sclk_io_num=PIN_NUM_CLK, // set SPI CLK pin
.quadwp_io_num=-1,
.quadhd_io_num=-1,
.max_transfer_sz = 6*1024,
};
spi_lobo_device_interface_config_t devcfg={
.clock_speed_hz=8000000,
.mode=0,
.spics_io_num=-1,
.spics_ext_io_num=PIN_NUM_CS,
.flags=LB_SPI_DEVICE_HALFDUPLEX,
};
esp_err_t ret;
ret=spi_lobo_bus_add_device(SPI_BUS, &buscfg, &devcfg, &spi);
if (ret != ESP_OK)
{
return ret;
}
tft_disp_spi = spi;
TFT_display_init();
tft_max_rdclock = find_rd_speed();
spi_lobo_set_speed(spi, DEFAULT_SPI_CLOCK);
tft_font_rotate = 0;
tft_text_wrap = 0;
tft_font_transparent = 0;
tft_font_forceFixed = 0;
tft_gray_scale = 0;
TFT_setGammaCurve(DEFAULT_GAMMA_CURVE);
TFT_setRotation(LANDSCAPE_FLIP);
TFT_setFont(DEFAULT_FONT, NULL);
TFT_resetclipwin();
tft_image_debug = 0;
layout = create_layout();
return ESP_OK;
}

View File

@ -0,0 +1,26 @@
/*
* display.h
*
* Created on: 19 Apr 2020
* Author: Chris
*/
#ifndef COMPONENTS_DISPLAY_DISPLAY_H_
#define COMPONENTS_DISPLAY_DISPLAY_H_
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <esp_log.h>
#include <esp_err.h>
//#include "esp32_ucglib_hal.h"
//#include "ucg.h"
esp_err_t init_display();
void display_data(int32_t temp_raw, uint32_t pressure_raw, uint32_t humidity_raw,
int32_t temp2_raw, uint32_t pressure2_raw, uint32_t humidity2_raw);
//void update_temp1(int32_t temp1);
void test_tft_lib();
#endif /* COMPONENTS_DISPLAY_DISPLAY_H_ */

View File

@ -0,0 +1,290 @@
#include "esp32_ucglib_hal.h"
static spi_device_handle_t spi_hdl;
static ucg_esp32_hal_t pins;
static uint8_t* buffer_1 = 0;
static uint8_t* buffer_2 = 0;
static uint8_t* buffer_3 = 0;
int16_t ucg_esp32_hal(ucg_t *ucg, int16_t msg, uint16_t arg, uint8_t *data) {
//ESP_LOGI("hal", "spi_byte_cb: Received a msg: %d, arg: %d, arg_ptr: %p",
// msg, arg, data);
switch (msg) {
case UCG_COM_MSG_POWER_UP:
//ESP_LOGI("hal", "UCG_COM_MSG_POWER_UP");
/* "data" is a pointer to ucg_com_info_t structure with the following information: */
/* ((ucg_com_info_t *)data)->serial_clk_speed value in nanoseconds */
/* ((ucg_com_info_t *)data)->parallel_clk_speed value in nanoseconds */
/* "arg" is not used */
/* This message is sent once at the uC startup and for power up. */
/* setup i/o or do any other setup */
;
buffer_1 = (uint8_t*) heap_caps_malloc(1, MALLOC_CAP_DMA);
buffer_2 = (uint8_t*) heap_caps_malloc(1, MALLOC_CAP_DMA);
buffer_3 = (uint8_t*) heap_caps_malloc(1, MALLOC_CAP_DMA);
pins.clk = GPIO_NUM_18;
pins.cs = GPIO_NUM_17;
pins.dc = GPIO_NUM_2;
pins.mosi = GPIO_NUM_23;
pins.reset = GPIO_NUM_14;
gpio_config_t gp_config;
gp_config.intr_type = GPIO_INTR_DISABLE;
gp_config.mode = GPIO_MODE_OUTPUT;
gp_config.pin_bit_mask = ((1ULL << pins.reset) | (1ULL << pins.cs) | (1ULL << pins.dc));
gp_config.pull_down_en = GPIO_PULLDOWN_ENABLE;
gp_config.pull_up_en = GPIO_PULLUP_DISABLE;
gpio_config(&gp_config);
spi_bus_config_t* bus_config;
bus_config = heap_caps_calloc(1, sizeof(spi_bus_config_t), MALLOC_CAP_8BIT);
bus_config->mosi_io_num = pins.mosi;
bus_config->miso_io_num = -1;
bus_config->sclk_io_num = pins.clk;
bus_config->quadwp_io_num = -1;
bus_config->quadhd_io_num = -1;
bus_config->max_transfer_sz = 4094;
bus_config->flags = 0;
bus_config->intr_flags = 0;
esp_err_t err = spi_bus_initialize(VSPI_HOST, bus_config, 1);
if (err != ESP_OK) {
ESP_LOGE("hal", "Could not initialize spi bus...");
switch (err) {
case ESP_ERR_INVALID_ARG:
ESP_LOGE("hal", "ESP_ERR_INVALID_ARG");
break;
case ESP_ERR_INVALID_STATE:
ESP_LOGE("hal", "ESP_ERR_INVALID_STATE");
break;
case ESP_ERR_NO_MEM:
ESP_LOGE("hal", "ESP_ERR_NO_MEM");
break;
default:
ESP_LOGE("hal", "Unknown err!");
}
}
ESP_LOGI("hal", "successfully init bus!");
spi_device_interface_config_t* dev_config;
dev_config = heap_caps_calloc(1, sizeof(spi_device_interface_config_t), MALLOC_CAP_8BIT);
dev_config->address_bits = 0;
dev_config->command_bits = 0;
dev_config->dummy_bits = 0;
dev_config->mode = 0;
dev_config->duty_cycle_pos = 0;
dev_config->cs_ena_posttrans = 0;
dev_config->cs_ena_pretrans = 0;
dev_config->clock_speed_hz = SPI_MASTER_FREQ_40M;
dev_config->spics_io_num = pins.cs;
dev_config->queue_size = 200;
dev_config->flags = 0;
dev_config->pre_cb = NULL;
dev_config->post_cb = NULL;
err = spi_bus_add_device(VSPI_HOST, dev_config, &spi_hdl);
if (err != ESP_OK) {
ESP_LOGE("hal", "Could not initialize spi bus...");
switch (err) {
case ESP_ERR_INVALID_ARG:
ESP_LOGE("hal", "ESP_ERR_INVALID_ARG");
break;
case ESP_ERR_INVALID_STATE:
ESP_LOGE("hal", "ESP_ERR_INVALID_STATE");
break;
case ESP_ERR_NO_MEM:
ESP_LOGE("hal", "ESP_ERR_NO_MEM");
break;
default:
ESP_LOGE("hal", "Unknown err!");
}
}
ESP_LOGI("hal", "successfully init bus device!");
break;
case UCG_COM_MSG_POWER_DOWN:
//ESP_LOGI("hal", "UCG_COM_MSG_POWER_DOWN");
/* "data" and "arg" are not used*/
/* This message is sent for a power down request */
spi_bus_remove_device(spi_hdl);
spi_bus_free(HSPI_HOST);
heap_caps_free(buffer_1);
heap_caps_free(buffer_2);
heap_caps_free(buffer_3);
break;
case UCG_COM_MSG_DELAY:
//ESP_LOGI("hal", "UCG_COM_MSG_DELAY");
/* "data" is not used */
/* "arg" contains the number of microseconds for the delay */
/* By receiving this message, the following code should delay by */
/* "arg" microseconds. One microsecond is 0.000001 second */
//vTaskDelay(arg / portTICK_PERIOD_MS / 100);
break;
case UCG_COM_MSG_CHANGE_RESET_LINE:
//ESP_LOGI("hal", "UCG_COM_MSG_CHANGE_RESET_LINE");
/* "data" is not used */
/* "arg" = 1: set the reset output line to 1 */
/* "arg" = 0: set the reset output line to 0 */
gpio_set_level(pins.reset, arg);
break;
case UCG_COM_MSG_CHANGE_CD_LINE:
//ESP_LOGI("hal", "UCG_COM_MSG_CHANGE_CD_LINE");
/* "ucg->com_status" bit 0 contains the old level for the CD line */
/* "data" is not used */
/* "arg" = 1: set the command/data (a0) output line to 1 */
/* "arg" = 0: set the command/data (a0) output line to 0 */
gpio_set_level(pins.dc, arg);
break;
case UCG_COM_MSG_CHANGE_CS_LINE:
//ESP_LOGI("hal", "UCG_COM_MSG_CHANGE_CS_LINE");
/* "ucg->com_status" bit 1 contains the old level for the CS line */
/* "data" is not used */
/* "arg" = 1: set the chipselect output line to 1 */
/* "arg" = 0: set the chipselect output line to 0 */
gpio_set_level(pins.cs, arg);
break;
case UCG_COM_MSG_SEND_BYTE:
//ESP_LOGI("hal", "UCG_COM_MSG_SEND_BYTE");
/* "data" is not used */
/* "arg" contains one byte, which should be sent to the display */
/* The current status of the CD line is available */
/* in bit 0 of u8g->com_status */
;
*buffer_1 = (uint8_t) arg;
spi_transaction_t transaction;
transaction.addr = 0;
transaction.cmd = 0;
transaction.length = 8;
transaction.rxlength = 0;
transaction.tx_buffer = buffer_1;
transaction.rx_buffer = NULL;
transaction.flags = SPI_TRANS_USE_RXDATA ;
spi_device_transmit(spi_hdl, &transaction);
break;
case UCG_COM_MSG_REPEAT_1_BYTE:
{
ESP_LOGW("hal", "UCG_COM_MSG_REPEAT_1_BYTE");
/* "data[0]" contains one byte */
/* repeat sending the byte in data[0] "arg" times */
/* The current status of the CD line is available */
/* in bit 0 of u8g->com_status */
//spi_transaction_t transaction;
//transaction.length = 8;
//transaction.tx_buffer = data[0];
//transaction.flags = SPI_TRANS_USE_TXDATA;
//int i;
//for (i = 0; i < arg; i++) {
// spi_device_polling_transmit(spi_hdl, &transaction);
//}
break;
}
case UCG_COM_MSG_REPEAT_2_BYTES:
{
ESP_LOGW("hal", "UCG_COM_MSG_REPEAT_2_BYTES");
// spi_transaction_t transaction1;
// transaction.flags = SPI_TRANS_USE_TXDATA;
// transaction.length = 8;
// transaction.tx_buffer = data[0];
// spi_transaction_t transaction2;
// transaction2.flags = SPI_TRANS_USE_TXDATA;
// transaction2.length = 8;
// transaction2.tx_buffer = data[1];
// int i;
// for (i = 0; i < arg; i++) {
// spi_device_polling_transmit(spi_hdl, &transaction1);
// spi_device_polling_transmit(spi_hdl, &transaction2);
// }
/* "data[0]" contains first byte */
/* "data[1]" contains second byte */
/* repeat sending the two bytes "arg" times */
/* The current status of the CD line is available */
/* in bit 0 of u8g->com_status */
break;
}
case UCG_COM_MSG_REPEAT_3_BYTES:
{
//ESP_LOGI("hal", "UCG_COM_MSG_REPEAT_3_BYTES");
/* "data[0]" contains first byte */
/* "data[1]" contains second byte */
/* "data[2]" contains third byte */
/* repeat sending the three bytes "arg" times */
/* The current status of the CD line is available */
/* in bit 0 of u8g->com_status */
buffer_3[0] = data[0];
buffer_3[1] = data[1];
buffer_3[2] = data[2];
spi_transaction_t transaction;
transaction.addr = 0;
transaction.cmd = 0;
transaction.length = 3*8;
transaction.rxlength = 0;
transaction.tx_buffer = buffer_3;
transaction.rx_buffer = NULL;
transaction.flags = SPI_TRANS_USE_RXDATA ;
int i;
for (i = 0; i < arg; i++) {
spi_device_transmit(spi_hdl, &transaction);
}
// spi_transaction_t transaction1;
// transaction1.flags = SPI_TRANS_USE_TXDATA ;
// transaction1.length = 8;
// transaction1.tx_buffer = &data[0];
// spi_transaction_t transaction2;
// transaction2.flags = SPI_TRANS_USE_TXDATA ;
// transaction2.length = 8;
// transaction2.tx_buffer = &data[1];
// spi_transaction_t transaction3;
// transaction3.flags = SPI_TRANS_USE_TXDATA ;
// transaction3.length = 8;
// transaction3.tx_buffer = &data[2];
// int i;
// for (i = 0; i < arg; i++) {
// spi_device_polling_transmit(spi_hdl, &transaction1);
// spi_device_polling_transmit(spi_hdl, &transaction2);
// spi_device_polling_transmit(spi_hdl, &transaction3);
// }
break;
}
case UCG_COM_MSG_SEND_STR:
{
ESP_LOGW("hal", "UCG_COM_MSG_SEND_STR");
/* "data" is an array with "arg" bytes */
/* send "arg" bytes to the display */
spi_transaction_t transaction1;
transaction1.flags = SPI_TRANS_USE_RXDATA | SPI_TRANS_USE_TXDATA ;
transaction1.length = 8*arg;
transaction1.tx_buffer = &data[0];
spi_device_polling_transmit(spi_hdl, &transaction1);
break;
}
case UCG_COM_MSG_SEND_CD_DATA_SEQUENCE:
{
//ESP_LOGW("hal", "UCG_COM_MSG_SEND_CD_DATA_SEQUENCE");
/* "data" is a pointer to two bytes, which contain the cd line */
/* status and display data */
/* "arg" contains the number of these two byte tuples which need to */
/* be analysed and sent. Bellow is a example sequence */
/* The content of bit 0 in u8g->com_status is undefined for this message */
while (arg > 0) {
if (*data != 0) {
if (*data == 1) {
/* set CD (=D/C=A0) line to low */
} else {
/* set CD (=D/C=A0) line to high */
}
}
data++;
/* send *data to the display */
data++;
arg--;
}
break;
}
}
return 1;
}

View File

@ -0,0 +1,22 @@
#ifndef ESP32_UCGLIB_HAL_H
#define ESP32_UCGLIB_HAL_H
#include <ucg.h>
#include "driver/gpio.h"
#include "driver/spi_master.h"
#include "driver/i2c.h"
#include "esp_intr_alloc.h"
#include <esp_log.h>
typedef struct {
gpio_num_t clk;
gpio_num_t mosi;
gpio_num_t cs;
gpio_num_t reset;
gpio_num_t dc;
} ucg_esp32_hal_t ;
int16_t ucg_esp32_hal(ucg_t *ucg, int16_t msg, uint16_t arg, uint8_t *data);
#endif /* ESP32_UCGLIB_HAL_H */

@ -1 +0,0 @@
Subproject commit 12ed2e48354566216bfeee77449fc7ea41e5df2c

Binary file not shown.

BIN
doc/display_pins.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

1
externals/ESP32_TFT_library vendored Submodule

@ -0,0 +1 @@
Subproject commit a06a578356e0e6ad27b5efd1b815f9614a97f1bc

View File

@ -2,7 +2,7 @@
set(COMPONENT_REQUIRES )
set(COMPONENT_PRIV_REQUIRES )
set(COMPONENT_SRCS "main.c" "u8g2_esp32_hal.c" "bme280.c")
set(COMPONENT_SRCS "main.c" "bme280.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
register_component()

View File

@ -1,453 +1,456 @@
#include "bme280.h"
#include "bme280_defs.h"
#include "driver/i2c.h"
#include <u8g2.h>
#include "u8g2_esp32_hal.h"
//#include "bme280.h"
//#include "bme280_defs.h"
//#include "driver/i2c.h"
#include "display.h"
#include <esp_log.h>
#include <esp_wifi.h>
#include "freertos/event_groups.h"
#include "nvs_flash.h"
#include <esp_http_server.h>
#include <sys/param.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
//#include <esp_wifi.h>
//#include "freertos/event_groups.h"
//#include "nvs_flash.h"
//#include <esp_http_server.h>
//#include <sys/param.h>
#define WIFI_SSID "Netzknecht"
#define WIFI_PASS "SpvtNVYsSRTsX36I"
#define WIFI_RETRIES 10
//#define WIFI_SSID "Netzknecht"
//#define WIFI_PASS "SpvtNVYsSRTsX36I"
//#define WIFI_RETRIES 10
//
//static EventGroupHandle_t s_wifi_event_group;
//#define WIFI_CONNECTED_BIT BIT0
//#define WIFI_FAIL_BIT BIT1
//
//static const char *TAG = "wifi station";
//static int s_retry_num = 0;
//
//char cur_value_str[255];
//
///* An HTTP GET handler */
//static esp_err_t hello_get_handler(httpd_req_t *req)
//{
// char* buf;
// size_t buf_len;
//
// /* Get header value string length and allocate memory for length + 1,
// * extra byte for null termination */
// buf_len = httpd_req_get_hdr_value_len(req, "Host") + 1;
// if (buf_len > 1) {
// buf = malloc(buf_len);
// /* Copy null terminated value string into buffer */
// if (httpd_req_get_hdr_value_str(req, "Host", buf, buf_len) == ESP_OK) {
// ESP_LOGI(TAG, "Found header => Host: %s", buf);
// }
// free(buf);
// }
//
// buf_len = httpd_req_get_hdr_value_len(req, "Test-Header-2") + 1;
// if (buf_len > 1) {
// buf = malloc(buf_len);
// if (httpd_req_get_hdr_value_str(req, "Test-Header-2", buf, buf_len) == ESP_OK) {
// ESP_LOGI(TAG, "Found header => Test-Header-2: %s", buf);
// }
// free(buf);
// }
//
// buf_len = httpd_req_get_hdr_value_len(req, "Test-Header-1") + 1;
// if (buf_len > 1) {
// buf = malloc(buf_len);
// if (httpd_req_get_hdr_value_str(req, "Test-Header-1", buf, buf_len) == ESP_OK) {
// ESP_LOGI(TAG, "Found header => Test-Header-1: %s", buf);
// }
// free(buf);
// }
//
// /* Read URL query string length and allocate memory for length + 1,
// * extra byte for null termination */
// buf_len = httpd_req_get_url_query_len(req) + 1;
// if (buf_len > 1) {
// buf = malloc(buf_len);
// if (httpd_req_get_url_query_str(req, buf, buf_len) == ESP_OK) {
// ESP_LOGI(TAG, "Found URL query => %s", buf);
// char param[32];
// /* Get value of expected key from query string */
// if (httpd_query_key_value(buf, "query1", param, sizeof(param)) == ESP_OK) {
// ESP_LOGI(TAG, "Found URL query parameter => query1=%s", param);
// }
// if (httpd_query_key_value(buf, "query3", param, sizeof(param)) == ESP_OK) {
// ESP_LOGI(TAG, "Found URL query parameter => query3=%s", param);
// }
// if (httpd_query_key_value(buf, "query2", param, sizeof(param)) == ESP_OK) {
// ESP_LOGI(TAG, "Found URL query parameter => query2=%s", param);
// }
// }
// free(buf);
// }
//
// /* Set some custom headers */
// httpd_resp_set_hdr(req, "Custom-Header-1", "Custom-Value-1");
// httpd_resp_set_hdr(req, "Custom-Header-2", "Custom-Value-2");
//
// /* Send response with custom headers and body set as the
// * string passed in user context*/
// const char* resp_str = cur_value_str;
// httpd_resp_send(req, resp_str, strlen(resp_str));
//
// /* After sending the HTTP response the old HTTP request
// * headers are lost. Check if HTTP request headers can be read now. */
// if (httpd_req_get_hdr_value_len(req, "Host") == 0) {
// ESP_LOGI(TAG, "Request headers lost");
// }
// return ESP_OK;
//}
//
//static httpd_uri_t hello = {
// .uri = "/hello",
// .method = HTTP_GET,
// .handler = hello_get_handler,
// /* Let's pass response string in user
// * context to demonstrate it's usage */
// .user_ctx = "Hello World!"
//};
//
//static httpd_handle_t start_webserver(void)
//{
// httpd_handle_t server = NULL;
// httpd_config_t config = HTTPD_DEFAULT_CONFIG();
//
// // Start the httpd server
// ESP_LOGI(TAG, "Starting server on port: '%d'", config.server_port);
// if (httpd_start(&server, &config) == ESP_OK) {
// // Set URI handlers
// ESP_LOGI(TAG, "Registering URI handlers");
// httpd_register_uri_handler(server, &hello);
// return server;
// }
//
// ESP_LOGI(TAG, "Error starting server!");
// return NULL;
//}
//
//static void stop_webserver(httpd_handle_t server)
//{
// // Stop the httpd server
// httpd_stop(server);
//}
//
//static void disconnect_handler(void* arg, esp_event_base_t event_base,
// int32_t event_id, void* event_data)
//{
// httpd_handle_t* server = (httpd_handle_t*) arg;
// if (*server) {
// ESP_LOGI(TAG, "Stopping webserver");
// stop_webserver(*server);
// *server = NULL;
// }
//}
//
//static void connect_handler(void* arg, esp_event_base_t event_base,
// int32_t event_id, void* event_data)
//{
// httpd_handle_t* server = (httpd_handle_t*) arg;
// if (*server == NULL) {
// ESP_LOGI(TAG, "Starting webserver");
// *server = start_webserver();
// }
//}
//
//static void event_handler(void* arg, esp_event_base_t event_base,
// int32_t event_id, void* event_data)
//{
// if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
// esp_wifi_connect();
// } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
// if (s_retry_num < WIFI_RETRIES) {
// esp_wifi_connect();
// s_retry_num++;
// ESP_LOGI(TAG, "retry to connect to the AP");
// } else {
// xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
// }
// ESP_LOGI(TAG,"connect to the AP fail");
// } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
// ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
// ESP_LOGI(TAG, "got ip:%s",
// ip4addr_ntoa(&event->ip_info.ip));
// s_retry_num = 0;
// xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
// }
//}
static EventGroupHandle_t s_wifi_event_group;
#define WIFI_CONNECTED_BIT BIT0
#define WIFI_FAIL_BIT BIT1
//void wifi_init_sta()
//{
// s_wifi_event_group = xEventGroupCreate();
//
// tcpip_adapter_init();
//
// ESP_ERROR_CHECK(esp_event_loop_create_default());
//
// wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
// ESP_ERROR_CHECK(esp_wifi_init(&cfg));
//
// //tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA);
// //tcpip_adapter_ip_info_t info;
// //ip4_addr_t gw;
// //gw.addr = ipaddr_addr("192.168.0.1");
// //info.gw = gw;
// //ip4_addr_t ip;
// //ip.addr = ipaddr_addr("192.168.0.110");
// //info.ip = ip;
// //ip4_addr_t netmask;
// //netmask.addr = ipaddr_addr("255.255.255.0");
// //info.netmask = netmask;
// //tcpip_adapter_sta_start(0, &info);
//
// ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
// ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL));
//
// wifi_config_t wifi_config = {
// .sta = {
// .ssid = WIFI_SSID,
// .password = WIFI_PASS
// },
// };
// ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
// ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
// ESP_ERROR_CHECK(esp_wifi_start() );
//
// ESP_LOGI(TAG, "wifi_init_sta finished.");
//
// /* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum
// * number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
// EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
// WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
// pdFALSE,
// pdFALSE,
// portMAX_DELAY);
//
// //tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &info);
// /* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually
// * happened. */
// if (bits & WIFI_CONNECTED_BIT) {
// ESP_LOGI(TAG, "connected to ap SSID:%s password:%s",
// WIFI_SSID, WIFI_PASS);
// } else if (bits & WIFI_FAIL_BIT) {
// ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s",
// WIFI_SSID, WIFI_PASS);
// } else {
// ESP_LOGE(TAG, "UNEXPECTED EVENT");
// }
//
// ESP_ERROR_CHECK(esp_event_handler_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler));
// ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler));
// vEventGroupDelete(s_wifi_event_group);
//}
//
//void i2c_setup()
//{
// printf("Setting up I<>C driver on port 1... ");
// i2c_config_t config;
// config.mode = I2C_MODE_MASTER;
// config.sda_io_num = 33;
// config.sda_pullup_en = GPIO_PULLUP_ENABLE;
// config.scl_io_num = 32;
// config.scl_pullup_en = GPIO_PULLUP_ENABLE;
// config.master.clk_speed = 100000;
// i2c_param_config(I2C_NUM_0, &config);
// printf("Set driver parameters... ");
// esp_err_t err = i2c_driver_install(I2C_NUM_0, I2C_MODE_MASTER, 0, 0, 0);
// if (err == ESP_OK)
// printf("Driver installed!\n");
// else if (err == ESP_ERR_INVALID_ARG)
// printf("Driver install failed, invalid arguments!\n");
// else
// printf("Driver install failed!\n");
//}
//
//int8_t i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len) {
// i2c_cmd_handle_t cmd = i2c_cmd_link_create();
// i2c_master_start(cmd);
// i2c_master_write_byte(cmd, dev_id << 1 | I2C_MASTER_WRITE, 1);
// i2c_master_write_byte(cmd, reg_addr, 1);
// i2c_master_start(cmd);
// i2c_master_write_byte(cmd, dev_id << 1 | I2C_MASTER_READ, 1);
// if (len > 1) {
// i2c_master_read(cmd, data, len - 1, I2C_MASTER_ACK);
// }
// i2c_master_read_byte(cmd, data + len - 1, I2C_MASTER_NACK);
// i2c_master_stop(cmd);
// i2c_master_cmd_begin(I2C_NUM_0, cmd, 500 / portTICK_RATE_MS);
// i2c_cmd_link_delete(cmd);
// return 0;
//}
//
//int8_t i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len) {
// //printf("Writing to bus: dev_id=%x, reg_addr=%x, data=%p, length=%u\n", dev_id, reg_addr, data, len);
// i2c_cmd_handle_t cmd = i2c_cmd_link_create();
// i2c_master_start(cmd);
// i2c_master_write_byte(cmd, (dev_id << 1) | I2C_MASTER_WRITE, 1);
// i2c_master_write_byte(cmd, reg_addr, 1);
// i2c_master_write(cmd, data, len, 1);
// i2c_master_stop(cmd);
// i2c_master_cmd_begin(I2C_NUM_0, cmd, 500 / portTICK_RATE_MS);
// i2c_cmd_link_delete(cmd);
// return 0;
//}
//
//void i2c_delay(uint32_t period) {
// vTaskDelay(period / portTICK_PERIOD_MS);
//}
//
//void i2c_shutdown()
//{
// printf("Shutting down I<>C bus... ");
// esp_err_t err = i2c_driver_delete(I2C_NUM_0);
// if (err == ESP_ERR_INVALID_ARG)
// printf("Failed, invalid arguments!\n");
// else
// printf("Success!\n");
//}
//
//void read_sensor(struct bme280_dev* dev, int32_t* temp, uint32_t* pressure, uint32_t* humidity) {
//
// uint8_t settings_sel;
// uint32_t req_delay;
// struct bme280_data comp_data;
//
// dev->settings.osr_h = BME280_OVERSAMPLING_16X;
// dev->settings.osr_p = BME280_OVERSAMPLING_16X;
// dev->settings.osr_t = BME280_OVERSAMPLING_16X;
// dev->settings.filter = BME280_FILTER_COEFF_16;
//
// settings_sel = BME280_OSR_PRESS_SEL | BME280_OSR_TEMP_SEL | BME280_OSR_HUM_SEL | BME280_FILTER_SEL;
// bme280_set_sensor_settings(settings_sel, dev);
//
// req_delay = 12*bme280_cal_meas_delay(&(dev->settings));
//
// /* Continuously stream sensor data */
// bme280_set_sensor_mode(BME280_FORCED_MODE, dev);
// /* Wait for the measurement to complete and print data @25Hz */
// dev->delay_ms(req_delay / portTICK_PERIOD_MS);
// bme280_get_sensor_data(BME280_ALL, &comp_data, dev);
// *temp = comp_data.temperature;
// *pressure = comp_data.pressure;
// *humidity = comp_data.humidity;
//}
//
//void read_sensor2(struct bme280_dev* dev, int32_t* temp, uint32_t* pressure, uint32_t* humidity) {
//
// uint8_t settings_sel;
// uint32_t req_delay;
// struct bme280_data comp_data;
//
// dev->settings.osr_h = BME280_OVERSAMPLING_16X;
// dev->settings.osr_p = BME280_OVERSAMPLING_16X;
// dev->settings.osr_t = BME280_OVERSAMPLING_16X;
// dev->settings.filter = BME280_FILTER_COEFF_16;
//
// settings_sel = BME280_OSR_PRESS_SEL | BME280_OSR_TEMP_SEL | BME280_OSR_HUM_SEL | BME280_FILTER_SEL;
// bme280_set_sensor_settings(settings_sel, dev);
// /*Calculate the minimum delay required between consecutive measurement based upon the sensor enabled
// * and the oversampling configuration. */
// req_delay = 12*bme280_cal_meas_delay(&(dev->settings));
//
// bme280_set_sensor_mode(BME280_FORCED_MODE, dev);
// /* Wait for the measurement to complete and print data @25Hz */
// dev->delay_ms(req_delay / portTICK_PERIOD_MS);
// bme280_get_sensor_data(BME280_ALL, &comp_data, dev);
// *temp = comp_data.temperature;
// *pressure = comp_data.pressure;
// *humidity = comp_data.humidity;
//}
static const char *TAG = "wifi station";
static int s_retry_num = 0;
//void print_data(u8g2_t* u8g2, int32_t temp_raw, uint32_t pressure_raw, uint32_t humidity_raw,
// int32_t temp2_raw, uint32_t pressure2_raw, uint32_t humidity2_raw) {
// // Calc temperature pre and post comma values
// int32_t temp_pre = temp_raw / 100;
// int32_t temp_post = (abs(temp_raw) % 100) / 10;
// int32_t temp2_pre = temp2_raw / 100;
// int32_t temp2_post = (abs(temp2_raw) % 100) / 10;
//
// // Calc pressure values
// uint32_t press = pressure_raw / 100;
// uint32_t press2 = pressure2_raw / 100;
//
// // Calc humidity pre and post comma values
// uint32_t humid_pre = humidity_raw / 1024;
// uint32_t humid_post = (humidity_raw - humid_pre*1024) * 10 / 1024;
// uint32_t humid2_pre = humidity2_raw / 1024;
// uint32_t humid2_post = (humidity2_raw - humid2_pre*1024) * 10 / 1024;
//
// // Format temperatures
// char temp_str[2*(sizeof(int)*8+1)+5] = ""; // ""
// char temp_pre_str[sizeof(int)*8+1];
// itoa(temp_pre, temp_pre_str, 10);
// char temp_post_str[sizeof(int)*8+1];
// itoa(temp_post, temp_post_str, 10);
// char temp2_pre_str[sizeof(int)*8+1];
// itoa(temp2_pre, temp2_pre_str, 10);
// char temp2_post_str[sizeof(int)*8+1];
// itoa(temp2_post, temp2_post_str, 10);
// if (temp_pre < 10)
// strcat(temp_str, " "); // Add space if first temperatur is just one digit long " "
// strcat(temp_str, temp_pre_str); // " 1"
// strcat(temp_str, ","); // " 1,"
// strcat(temp_str, temp_post_str); // " 1,3"
// strcat(temp_str, " "); // " 1,3 "
// if (temp2_pre >= 0)
// strcat(temp_str, " "); // Add space if there is no minus sign " 1,3 "
// if (temp2_pre < 10)
// strcat(temp_str, " "); // Add space if second temperatur is just one digit long " 1,3 "
// strcat(temp_str, temp2_pre_str); // " 1,3 7"
// strcat(temp_str, ","); // " 1,3 7,"
// strcat(temp_str, temp2_post_str); // " 1,3 7,2"
// strcat(temp_str, " <20>C"); // " 1,3 7,2 <20>C"
//
// // Format temperatures
// char humid_str[2*(sizeof(int)*8+1)+5] = ""; // ""
// char humid_pre_str[sizeof(int)*8+1];
// itoa(humid_pre, humid_pre_str, 10);
// char humid_post_str[sizeof(int)*8+1];
// itoa(humid_post, humid_post_str, 10);
// char humid2_pre_str[sizeof(int)*8+1];
// itoa(humid2_pre, humid2_pre_str, 10);
// char humid2_post_str[sizeof(int)*8+1];
// itoa(humid2_post, humid2_post_str, 10);
// strcat(humid_str, humid_pre_str); // "12"
// strcat(humid_str, ","); // "12,"
// strcat(humid_str, humid_post_str); // "12,5"
// strcat(humid_str, " "); // "12,5 "
// strcat(humid_str, humid2_pre_str); // "12,5 45"
// strcat(humid_str, ","); // "12,5 45,"
// strcat(humid_str, humid2_post_str); // "12,5 45,23"
// strcat(humid_str, " %"); // "12,5 45,23 %"
//
// // Format pressure
// char pressure_str[2*(sizeof(int)*8+1)+5] = ""; // ""
// char press1_str[sizeof(int)*8+1];
// itoa(press, press1_str, 10);
// char press2_str[sizeof(int)*8+1];
// itoa(press2, press2_str, 10);
// if (press < 1000)
// strcat(pressure_str, " ");
// strcat(pressure_str, press1_str);
// strcat(pressure_str, " ");
// if (press2 < 1000)
// strcat(pressure_str, " ");
// strcat(pressure_str, press2_str);
// strcat(pressure_str, " hPa");
//
// u8g2_ClearBuffer(u8g2);
// u8g2_SetFont(u8g2, u8g2_font_profont17_mf);
// int8_t fontheight = u8g2_GetAscent(u8g2);
// int8_t fontmargin = abs(u8g2_GetDescent(u8g2))+2;
// u8g2_DrawStr(u8g2, 0, fontheight, " IN OUT ");
// u8g2_DrawStr(u8g2, 0, 2*fontheight + fontmargin, temp_str);
// u8g2_DrawStr(u8g2, 0, 3*fontheight + 2*fontmargin, humid_str);
// u8g2_DrawStr(u8g2, 0, 4*fontheight + 3*fontmargin, pressure_str);
// u8g2_SendBuffer(u8g2);
//}
char cur_value_str[255];
/* An HTTP GET handler */
static esp_err_t hello_get_handler(httpd_req_t *req)
{
char* buf;
size_t buf_len;
/* Get header value string length and allocate memory for length + 1,
* extra byte for null termination */
buf_len = httpd_req_get_hdr_value_len(req, "Host") + 1;
if (buf_len > 1) {
buf = malloc(buf_len);
/* Copy null terminated value string into buffer */
if (httpd_req_get_hdr_value_str(req, "Host", buf, buf_len) == ESP_OK) {
ESP_LOGI(TAG, "Found header => Host: %s", buf);
}
free(buf);
}
buf_len = httpd_req_get_hdr_value_len(req, "Test-Header-2") + 1;
if (buf_len > 1) {
buf = malloc(buf_len);
if (httpd_req_get_hdr_value_str(req, "Test-Header-2", buf, buf_len) == ESP_OK) {
ESP_LOGI(TAG, "Found header => Test-Header-2: %s", buf);
}
free(buf);
}
buf_len = httpd_req_get_hdr_value_len(req, "Test-Header-1") + 1;
if (buf_len > 1) {
buf = malloc(buf_len);
if (httpd_req_get_hdr_value_str(req, "Test-Header-1", buf, buf_len) == ESP_OK) {
ESP_LOGI(TAG, "Found header => Test-Header-1: %s", buf);
}
free(buf);
}
/* Read URL query string length and allocate memory for length + 1,
* extra byte for null termination */
buf_len = httpd_req_get_url_query_len(req) + 1;
if (buf_len > 1) {
buf = malloc(buf_len);
if (httpd_req_get_url_query_str(req, buf, buf_len) == ESP_OK) {
ESP_LOGI(TAG, "Found URL query => %s", buf);
char param[32];
/* Get value of expected key from query string */
if (httpd_query_key_value(buf, "query1", param, sizeof(param)) == ESP_OK) {
ESP_LOGI(TAG, "Found URL query parameter => query1=%s", param);
}
if (httpd_query_key_value(buf, "query3", param, sizeof(param)) == ESP_OK) {
ESP_LOGI(TAG, "Found URL query parameter => query3=%s", param);
}
if (httpd_query_key_value(buf, "query2", param, sizeof(param)) == ESP_OK) {
ESP_LOGI(TAG, "Found URL query parameter => query2=%s", param);
}
}
free(buf);
}
/* Set some custom headers */
httpd_resp_set_hdr(req, "Custom-Header-1", "Custom-Value-1");
httpd_resp_set_hdr(req, "Custom-Header-2", "Custom-Value-2");
/* Send response with custom headers and body set as the
* string passed in user context*/
const char* resp_str = cur_value_str;
httpd_resp_send(req, resp_str, strlen(resp_str));
/* After sending the HTTP response the old HTTP request
* headers are lost. Check if HTTP request headers can be read now. */
if (httpd_req_get_hdr_value_len(req, "Host") == 0) {
ESP_LOGI(TAG, "Request headers lost");
}
return ESP_OK;
}
static httpd_uri_t hello = {
.uri = "/hello",
.method = HTTP_GET,
.handler = hello_get_handler,
/* Let's pass response string in user
* context to demonstrate it's usage */
.user_ctx = "Hello World!"
};
static httpd_handle_t start_webserver(void)
{
httpd_handle_t server = NULL;
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
// Start the httpd server
ESP_LOGI(TAG, "Starting server on port: '%d'", config.server_port);
if (httpd_start(&server, &config) == ESP_OK) {
// Set URI handlers
ESP_LOGI(TAG, "Registering URI handlers");
httpd_register_uri_handler(server, &hello);
return server;
}
ESP_LOGI(TAG, "Error starting server!");
return NULL;
}
static void stop_webserver(httpd_handle_t server)
{
// Stop the httpd server
httpd_stop(server);
}
static void disconnect_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
{
httpd_handle_t* server = (httpd_handle_t*) arg;
if (*server) {
ESP_LOGI(TAG, "Stopping webserver");
stop_webserver(*server);
*server = NULL;
}
}
static void connect_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
{
httpd_handle_t* server = (httpd_handle_t*) arg;
if (*server == NULL) {
ESP_LOGI(TAG, "Starting webserver");
*server = start_webserver();
}
}
static void event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
{
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
esp_wifi_connect();
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
if (s_retry_num < WIFI_RETRIES) {
esp_wifi_connect();
s_retry_num++;
ESP_LOGI(TAG, "retry to connect to the AP");
} else {
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
}
ESP_LOGI(TAG,"connect to the AP fail");
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
ESP_LOGI(TAG, "got ip:%s",
ip4addr_ntoa(&event->ip_info.ip));
s_retry_num = 0;
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
}
}
void wifi_init_sta()
{
s_wifi_event_group = xEventGroupCreate();
tcpip_adapter_init();
ESP_ERROR_CHECK(esp_event_loop_create_default());
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
//tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA);
//tcpip_adapter_ip_info_t info;
//ip4_addr_t gw;
//gw.addr = ipaddr_addr("192.168.0.1");
//info.gw = gw;
//ip4_addr_t ip;
//ip.addr = ipaddr_addr("192.168.0.110");
//info.ip = ip;
//ip4_addr_t netmask;
//netmask.addr = ipaddr_addr("255.255.255.0");
//info.netmask = netmask;
//tcpip_adapter_sta_start(0, &info);
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL));
wifi_config_t wifi_config = {
.sta = {
.ssid = WIFI_SSID,
.password = WIFI_PASS
},
};
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
ESP_ERROR_CHECK(esp_wifi_start() );
ESP_LOGI(TAG, "wifi_init_sta finished.");
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum
* number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
pdFALSE,
pdFALSE,
portMAX_DELAY);
//tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &info);
/* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually
* happened. */
if (bits & WIFI_CONNECTED_BIT) {
ESP_LOGI(TAG, "connected to ap SSID:%s password:%s",
WIFI_SSID, WIFI_PASS);
} else if (bits & WIFI_FAIL_BIT) {
ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s",
WIFI_SSID, WIFI_PASS);
} else {
ESP_LOGE(TAG, "UNEXPECTED EVENT");
}
ESP_ERROR_CHECK(esp_event_handler_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler));
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler));
vEventGroupDelete(s_wifi_event_group);
}
void i2c_setup()
{
printf("Setting up I²C driver on port 1... ");
i2c_config_t config;
config.mode = I2C_MODE_MASTER;
config.sda_io_num = 33;
config.sda_pullup_en = GPIO_PULLUP_ENABLE;
config.scl_io_num = 32;
config.scl_pullup_en = GPIO_PULLUP_ENABLE;
config.master.clk_speed = 100000;
i2c_param_config(I2C_NUM_0, &config);
printf("Set driver parameters... ");
esp_err_t err = i2c_driver_install(I2C_NUM_0, I2C_MODE_MASTER, 0, 0, 0);
if (err == ESP_OK)
printf("Driver installed!\n");
else if (err == ESP_ERR_INVALID_ARG)
printf("Driver install failed, invalid arguments!\n");
else
printf("Driver install failed!\n");
}
int8_t i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len) {
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, dev_id << 1 | I2C_MASTER_WRITE, 1);
i2c_master_write_byte(cmd, reg_addr, 1);
i2c_master_start(cmd);
i2c_master_write_byte(cmd, dev_id << 1 | I2C_MASTER_READ, 1);
if (len > 1) {
i2c_master_read(cmd, data, len - 1, I2C_MASTER_ACK);
}
i2c_master_read_byte(cmd, data + len - 1, I2C_MASTER_NACK);
i2c_master_stop(cmd);
i2c_master_cmd_begin(I2C_NUM_0, cmd, 500 / portTICK_RATE_MS);
i2c_cmd_link_delete(cmd);
return 0;
}
int8_t i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len) {
//printf("Writing to bus: dev_id=%x, reg_addr=%x, data=%p, length=%u\n", dev_id, reg_addr, data, len);
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (dev_id << 1) | I2C_MASTER_WRITE, 1);
i2c_master_write_byte(cmd, reg_addr, 1);
i2c_master_write(cmd, data, len, 1);
i2c_master_stop(cmd);
i2c_master_cmd_begin(I2C_NUM_0, cmd, 500 / portTICK_RATE_MS);
i2c_cmd_link_delete(cmd);
return 0;
}
void i2c_delay(uint32_t period) {
vTaskDelay(period / portTICK_PERIOD_MS);
}
void i2c_shutdown()
{
printf("Shutting down I²C bus... ");
esp_err_t err = i2c_driver_delete(I2C_NUM_0);
if (err == ESP_ERR_INVALID_ARG)
printf("Failed, invalid arguments!\n");
else
printf("Success!\n");
}
void read_sensor(struct bme280_dev* dev, int32_t* temp, uint32_t* pressure, uint32_t* humidity) {
uint8_t settings_sel;
uint32_t req_delay;
struct bme280_data comp_data;
dev->settings.osr_h = BME280_OVERSAMPLING_16X;
dev->settings.osr_p = BME280_OVERSAMPLING_16X;
dev->settings.osr_t = BME280_OVERSAMPLING_16X;
dev->settings.filter = BME280_FILTER_COEFF_16;
settings_sel = BME280_OSR_PRESS_SEL | BME280_OSR_TEMP_SEL | BME280_OSR_HUM_SEL | BME280_FILTER_SEL;
bme280_set_sensor_settings(settings_sel, dev);
req_delay = 12*bme280_cal_meas_delay(&(dev->settings));
/* Continuously stream sensor data */
bme280_set_sensor_mode(BME280_FORCED_MODE, dev);
/* Wait for the measurement to complete and print data @25Hz */
dev->delay_ms(req_delay / portTICK_PERIOD_MS);
bme280_get_sensor_data(BME280_ALL, &comp_data, dev);
*temp = comp_data.temperature;
*pressure = comp_data.pressure;
*humidity = comp_data.humidity;
}
void read_sensor2(struct bme280_dev* dev, int32_t* temp, uint32_t* pressure, uint32_t* humidity) {
uint8_t settings_sel;
uint32_t req_delay;
struct bme280_data comp_data;
dev->settings.osr_h = BME280_OVERSAMPLING_16X;
dev->settings.osr_p = BME280_OVERSAMPLING_16X;
dev->settings.osr_t = BME280_OVERSAMPLING_16X;
dev->settings.filter = BME280_FILTER_COEFF_16;
settings_sel = BME280_OSR_PRESS_SEL | BME280_OSR_TEMP_SEL | BME280_OSR_HUM_SEL | BME280_FILTER_SEL;
bme280_set_sensor_settings(settings_sel, dev);
/*Calculate the minimum delay required between consecutive measurement based upon the sensor enabled
* and the oversampling configuration. */
req_delay = 12*bme280_cal_meas_delay(&(dev->settings));
bme280_set_sensor_mode(BME280_FORCED_MODE, dev);
/* Wait for the measurement to complete and print data @25Hz */
dev->delay_ms(req_delay / portTICK_PERIOD_MS);
bme280_get_sensor_data(BME280_ALL, &comp_data, dev);
*temp = comp_data.temperature;
*pressure = comp_data.pressure;
*humidity = comp_data.humidity;
}
void print_data(u8g2_t* u8g2, int32_t temp_raw, uint32_t pressure_raw, uint32_t humidity_raw,
int32_t temp2_raw, uint32_t pressure2_raw, uint32_t humidity2_raw) {
// Calc temperature pre and post comma values
int32_t temp_pre = temp_raw / 100;
int32_t temp_post = (abs(temp_raw) % 100) / 10;
int32_t temp2_pre = temp2_raw / 100;
int32_t temp2_post = (abs(temp2_raw) % 100) / 10;
// Calc pressure values
uint32_t press = pressure_raw / 100;
uint32_t press2 = pressure2_raw / 100;
// Calc humidity pre and post comma values
uint32_t humid_pre = humidity_raw / 1024;
uint32_t humid_post = (humidity_raw - humid_pre*1024) * 10 / 1024;
uint32_t humid2_pre = humidity2_raw / 1024;
uint32_t humid2_post = (humidity2_raw - humid2_pre*1024) * 10 / 1024;
// Format temperatures
char temp_str[2*(sizeof(int)*8+1)+5] = ""; // ""
char temp_pre_str[sizeof(int)*8+1];
itoa(temp_pre, temp_pre_str, 10);
char temp_post_str[sizeof(int)*8+1];
itoa(temp_post, temp_post_str, 10);
char temp2_pre_str[sizeof(int)*8+1];
itoa(temp2_pre, temp2_pre_str, 10);
char temp2_post_str[sizeof(int)*8+1];
itoa(temp2_post, temp2_post_str, 10);
if (temp_pre < 10)
strcat(temp_str, " "); // Add space if first temperatur is just one digit long " "
strcat(temp_str, temp_pre_str); // " 1"
strcat(temp_str, ","); // " 1,"
strcat(temp_str, temp_post_str); // " 1,3"
strcat(temp_str, " "); // " 1,3 "
if (temp2_pre >= 0)
strcat(temp_str, " "); // Add space if there is no minus sign " 1,3 "
if (temp2_pre < 10)
strcat(temp_str, " "); // Add space if second temperatur is just one digit long " 1,3 "
strcat(temp_str, temp2_pre_str); // " 1,3 7"
strcat(temp_str, ","); // " 1,3 7,"
strcat(temp_str, temp2_post_str); // " 1,3 7,2"
strcat(temp_str, " °C"); // " 1,3 7,2 °C"
// Format temperatures
char humid_str[2*(sizeof(int)*8+1)+5] = ""; // ""
char humid_pre_str[sizeof(int)*8+1];
itoa(humid_pre, humid_pre_str, 10);
char humid_post_str[sizeof(int)*8+1];
itoa(humid_post, humid_post_str, 10);
char humid2_pre_str[sizeof(int)*8+1];
itoa(humid2_pre, humid2_pre_str, 10);
char humid2_post_str[sizeof(int)*8+1];
itoa(humid2_post, humid2_post_str, 10);
strcat(humid_str, humid_pre_str); // "12"
strcat(humid_str, ","); // "12,"
strcat(humid_str, humid_post_str); // "12,5"
strcat(humid_str, " "); // "12,5 "
strcat(humid_str, humid2_pre_str); // "12,5 45"
strcat(humid_str, ","); // "12,5 45,"
strcat(humid_str, humid2_post_str); // "12,5 45,23"
strcat(humid_str, " %"); // "12,5 45,23 %"
// Format pressure
char pressure_str[2*(sizeof(int)*8+1)+5] = ""; // ""
char press1_str[sizeof(int)*8+1];
itoa(press, press1_str, 10);
char press2_str[sizeof(int)*8+1];
itoa(press2, press2_str, 10);
if (press < 1000)
strcat(pressure_str, " ");
strcat(pressure_str, press1_str);
strcat(pressure_str, " ");
if (press2 < 1000)
strcat(pressure_str, " ");
strcat(pressure_str, press2_str);
strcat(pressure_str, " hPa");
u8g2_ClearBuffer(u8g2);
u8g2_SetFont(u8g2, u8g2_font_profont17_mf);
int8_t fontheight = u8g2_GetAscent(u8g2);
int8_t fontmargin = abs(u8g2_GetDescent(u8g2))+2;
u8g2_DrawStr(u8g2, 0, fontheight, " IN OUT ");
u8g2_DrawStr(u8g2, 0, 2*fontheight + fontmargin, temp_str);
u8g2_DrawStr(u8g2, 0, 3*fontheight + 2*fontmargin, humid_str);
u8g2_DrawStr(u8g2, 0, 4*fontheight + 3*fontmargin, pressure_str);
u8g2_SendBuffer(u8g2);
}
void app_main(void)
{
int32_t temp = 0;
int32_t temp = -12;
uint32_t pressure = 0;
uint32_t humidity = 0;
int32_t temp2 = 0;
@ -455,62 +458,48 @@ void app_main(void)
uint32_t humidity2 = 0;
// INIT SENSOR
i2c_setup();
struct bme280_dev dev;
dev.dev_id = 0x76;
dev.intf = BME280_I2C_INTF;
dev.read = i2c_read;
dev.write = i2c_write;
dev.delay_ms = i2c_delay;
bme280_init(&dev);
// i2c_setup();
// struct bme280_dev dev;
// dev.dev_id = 0x76;
// dev.intf = BME280_I2C_INTF;
// dev.read = i2c_read;
// dev.write = i2c_write;
// dev.delay_ms = i2c_delay;
// bme280_init(&dev);
// INIT SENSOR2
struct bme280_dev dev2;
dev2.dev_id = 0x77;
dev2.intf = BME280_I2C_INTF;
dev2.read = i2c_read;
dev2.write = i2c_write;
dev2.delay_ms = i2c_delay;
bme280_init(&dev2);
// INIT DISPLAY
u8g2_esp32_hal_t u8g2_esp32_hal = U8G2_ESP32_HAL_DEFAULT;
u8g2_esp32_hal.sda = 18;
u8g2_esp32_hal.scl = 19;
u8g2_esp32_hal_init(u8g2_esp32_hal);
u8g2_t u8g2;
u8g2_Setup_ssd1306_i2c_128x64_vcomh0_f(&u8g2, U8G2_R0, u8g2_esp32_i2c_byte_cb,
u8g2_esp32_gpio_and_delay_cb);
u8x8_SetI2CAddress(&u8g2.u8x8,0x3C << 1);
u8g2_InitDisplay(&u8g2); // send init sequence to the display, display is in sleep mode after this,
u8g2_SetPowerSave(&u8g2, 0); // wake up display
// struct bme280_dev dev2;
// dev2.dev_id = 0x77;
// dev2.intf = BME280_I2C_INTF;
// dev2.read = i2c_read;
// dev2.write = i2c_write;
// dev2.delay_ms = i2c_delay;
// bme280_init(&dev2);
// INIT WIFI
//Initialize NVS
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
wifi_init_sta();
// esp_err_t ret = nvs_flash_init();
// if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
// ESP_ERROR_CHECK(nvs_flash_erase());
// ret = nvs_flash_init();
// }
// ESP_ERROR_CHECK(ret);
//
// ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
// wifi_init_sta();
// INIT WEBSERVER
static httpd_handle_t server = NULL;
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &connect_handler, &server));
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_DISCONNECTED, &disconnect_handler, &server));
server = start_webserver();
// static httpd_handle_t server = NULL;
// ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &connect_handler, &server));
// ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_DISCONNECTED, &disconnect_handler, &server));
// server = start_webserver();
init_display();
while (1) {
read_sensor(&dev, &temp, &pressure, &humidity);
read_sensor(&dev2, &temp2, &pressure2, &humidity2);
printf("%i °c, %i hPa, %i %%\r\n", temp, pressure, humidity);
printf("%i °c, %i hPa, %i %%\r\n", temp2, pressure2, humidity2);
print_data(&u8g2, temp, pressure, humidity, temp2, pressure2, humidity2);
vTaskDelay(250 / portTICK_PERIOD_MS);
display_data(temp, pressure, humidity, temp2, pressure2, humidity2);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}

View File

@ -1,166 +0,0 @@
#include <stdio.h>
#include <string.h>
#include "sdkconfig.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "u8g2_esp32_hal.h"
static const char *TAG = "u8g2_hal";
static const unsigned int I2C_TIMEOUT_MS = 1000;
static i2c_cmd_handle_t handle_i2c; // I2C handle.
static u8g2_esp32_hal_t u8g2_esp32_hal; // HAL state data.
#undef ESP_ERROR_CHECK
#define ESP_ERROR_CHECK(x) do { esp_err_t rc = (x); if (rc != ESP_OK) { ESP_LOGE("err", "esp_err_t = %d", rc); assert(0 && #x);} } while(0);
/*
* Initialze the ESP32 HAL.
*/
void u8g2_esp32_hal_init(u8g2_esp32_hal_t u8g2_esp32_hal_param) {
u8g2_esp32_hal = u8g2_esp32_hal_param;
} // u8g2_esp32_hal_init
/*
* HAL callback function as prescribed by the U8G2 library. This callback is invoked
* to handle I2C communications.
*/
uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) {
//ESP_LOGD(TAG, "i2c_cb: Received a msg: %d, arg_int: %d, arg_ptr: %p", msg, arg_int, arg_ptr);
switch(msg) {
case U8X8_MSG_BYTE_SET_DC: {
if (u8g2_esp32_hal.dc != U8G2_ESP32_HAL_UNDEFINED) {
gpio_set_level(u8g2_esp32_hal.dc, arg_int);
}
break;
}
case U8X8_MSG_BYTE_INIT: {
if (u8g2_esp32_hal.sda == U8G2_ESP32_HAL_UNDEFINED ||
u8g2_esp32_hal.scl == U8G2_ESP32_HAL_UNDEFINED) {
break;
}
i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
ESP_LOGI(TAG, "sda_io_num %d", u8g2_esp32_hal.sda);
conf.sda_io_num = u8g2_esp32_hal.sda;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
ESP_LOGI(TAG, "scl_io_num %d", u8g2_esp32_hal.scl);
conf.scl_io_num = u8g2_esp32_hal.scl;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
ESP_LOGI(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ);
conf.master.clk_speed = I2C_MASTER_FREQ_HZ;
ESP_LOGI(TAG, "i2c_param_config %d", conf.mode);
ESP_ERROR_CHECK(i2c_param_config(I2C_MASTER_NUM, &conf));
ESP_LOGI(TAG, "i2c_driver_install %d", I2C_MASTER_NUM);
ESP_ERROR_CHECK(i2c_driver_install(I2C_MASTER_NUM, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0));
break;
}
case U8X8_MSG_BYTE_SEND: {
uint8_t* data_ptr = (uint8_t*)arg_ptr;
ESP_LOG_BUFFER_HEXDUMP(TAG, data_ptr, arg_int, ESP_LOG_VERBOSE);
while( arg_int > 0 ) {
ESP_ERROR_CHECK(i2c_master_write_byte(handle_i2c, *data_ptr, ACK_CHECK_EN));
data_ptr++;
arg_int--;
}
break;
}
case U8X8_MSG_BYTE_START_TRANSFER: {
uint8_t i2c_address = u8x8_GetI2CAddress(u8x8);
handle_i2c = i2c_cmd_link_create();
ESP_LOGD(TAG, "Start I2C transfer to %02X.", i2c_address>>1);
ESP_ERROR_CHECK(i2c_master_start(handle_i2c));
ESP_ERROR_CHECK(i2c_master_write_byte(handle_i2c, i2c_address | I2C_MASTER_WRITE, ACK_CHECK_EN));
break;
}
case U8X8_MSG_BYTE_END_TRANSFER: {
ESP_LOGD(TAG, "End I2C transfer.");
ESP_ERROR_CHECK(i2c_master_stop(handle_i2c));
ESP_ERROR_CHECK(i2c_master_cmd_begin(I2C_MASTER_NUM, handle_i2c, I2C_TIMEOUT_MS / portTICK_RATE_MS));
i2c_cmd_link_delete(handle_i2c);
break;
}
}
return 0;
} // u8g2_esp32_i2c_byte_cb
/*
* HAL callback function as prescribed by the U8G2 library. This callback is invoked
* to handle callbacks for GPIO and delay functions.
*/
uint8_t u8g2_esp32_gpio_and_delay_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr) {
ESP_LOGD(TAG, "gpio_and_delay_cb: Received a msg: %d, arg_int: %d, arg_ptr: %p", msg, arg_int, arg_ptr);
switch(msg) {
// Initialize the GPIO and DELAY HAL functions. If the pins for DC and RESET have been
// specified then we define those pins as GPIO outputs.
case U8X8_MSG_GPIO_AND_DELAY_INIT: {
uint64_t bitmask = 0;
if (u8g2_esp32_hal.dc != U8G2_ESP32_HAL_UNDEFINED) {
bitmask = bitmask | (1ull<<u8g2_esp32_hal.dc);
}
if (u8g2_esp32_hal.reset != U8G2_ESP32_HAL_UNDEFINED) {
bitmask = bitmask | (1ull<<u8g2_esp32_hal.reset);
}
if (u8g2_esp32_hal.cs != U8G2_ESP32_HAL_UNDEFINED) {
bitmask = bitmask | (1ull<<u8g2_esp32_hal.cs);
}
if (bitmask==0) {
break;
}
gpio_config_t gpioConfig;
gpioConfig.pin_bit_mask = bitmask;
gpioConfig.mode = GPIO_MODE_OUTPUT;
gpioConfig.pull_up_en = GPIO_PULLUP_DISABLE;
gpioConfig.pull_down_en = GPIO_PULLDOWN_ENABLE;
gpioConfig.intr_type = GPIO_INTR_DISABLE;
gpio_config(&gpioConfig);
break;
}
// Set the GPIO reset pin to the value passed in through arg_int.
case U8X8_MSG_GPIO_RESET:
if (u8g2_esp32_hal.reset != U8G2_ESP32_HAL_UNDEFINED) {
gpio_set_level(u8g2_esp32_hal.reset, arg_int);
}
break;
// Set the GPIO client select pin to the value passed in through arg_int.
case U8X8_MSG_GPIO_CS:
if (u8g2_esp32_hal.cs != U8G2_ESP32_HAL_UNDEFINED) {
gpio_set_level(u8g2_esp32_hal.cs, arg_int);
}
break;
// Set the Software I²C pin to the value passed in through arg_int.
case U8X8_MSG_GPIO_I2C_CLOCK:
if (u8g2_esp32_hal.scl != U8G2_ESP32_HAL_UNDEFINED) {
gpio_set_level(u8g2_esp32_hal.scl, arg_int);
// printf("%c",(arg_int==1?'C':'c'));
}
break;
// Set the Software I²C pin to the value passed in through arg_int.
case U8X8_MSG_GPIO_I2C_DATA:
if (u8g2_esp32_hal.sda != U8G2_ESP32_HAL_UNDEFINED) {
gpio_set_level(u8g2_esp32_hal.sda, arg_int);
// printf("%c",(arg_int==1?'D':'d'));
}
break;
// Delay for the number of milliseconds passed in through arg_int.
case U8X8_MSG_DELAY_MILLI:
vTaskDelay(arg_int/portTICK_PERIOD_MS);
break;
}
return 0;
} // u8g2_esp32_gpio_and_delay_cb

View File

@ -1,39 +0,0 @@
/*
* u8g2_esp32_hal.h
*
* Created on: Feb 12, 2017
* Author: kolban
*/
#include "driver/gpio.h"
#include "driver/i2c.h"
#ifndef U8G2_ESP32_HAL_H_
#define U8G2_ESP32_HAL_H_
#include "u8g2.h"
#define U8G2_ESP32_HAL_UNDEFINED (-1)
#define I2C_MASTER_NUM I2C_NUM_1 // I2C port number for master dev
#define I2C_MASTER_TX_BUF_DISABLE 0 // I2C master do not need buffer
#define I2C_MASTER_RX_BUF_DISABLE 0 // I2C master do not need buffer
#define I2C_MASTER_FREQ_HZ 1000000 // I2C master clock frequency
#define ACK_CHECK_EN 0x1 // I2C master will check ack from slave
#define ACK_CHECK_DIS 0x0 // I2C master will not check ack from slave
typedef struct {
gpio_num_t clk;
gpio_num_t mosi;
gpio_num_t sda; // data for I²C
gpio_num_t scl; // clock for I²C
gpio_num_t cs;
gpio_num_t reset;
gpio_num_t dc;
} u8g2_esp32_hal_t ;
#define U8G2_ESP32_HAL_DEFAULT {U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED }
void u8g2_esp32_hal_init(u8g2_esp32_hal_t u8g2_esp32_hal_param);
uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
uint8_t u8g2_esp32_gpio_and_delay_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
#endif /* U8G2_ESP32_HAL_H_ */

538
sdkconfig.old Normal file
View File

@ -0,0 +1,538 @@
#
# Automatically generated file. DO NOT EDIT.
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
#
CONFIG_IDF_TARGET_ESP32=y
CONFIG_IDF_TARGET="esp32"
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000
#
# SDK tool configuration
#
CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-"
CONFIG_APP_COMPILE_TIME_DATE=y
# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set
# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set
CONFIG_BOOTLOADER_LOG_LEVEL=3
# CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
# CONFIG_BOOTLOADER_FACTORY_RESET is not set
# CONFIG_BOOTLOADER_APP_TEST is not set
CONFIG_BOOTLOADER_WDT_ENABLE=y
# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set
CONFIG_BOOTLOADER_WDT_TIME_MS=9000
# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set
# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set
# CONFIG_SECURE_BOOT_ENABLED is not set
# CONFIG_SECURE_FLASH_ENC_ENABLED is not set
CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set
CONFIG_ESPTOOLPY_FLASHMODE="dio"
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
CONFIG_ESPTOOLPY_FLASHSIZE="2MB"
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
CONFIG_ESPTOOLPY_BEFORE_RESET=y
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
CONFIG_ESPTOOLPY_BEFORE="default_reset"
CONFIG_ESPTOOLPY_AFTER_RESET=y
# CONFIG_ESPTOOLPY_AFTER_NORESET is not set
CONFIG_ESPTOOLPY_AFTER="hard_reset"
# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set
# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set
# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set
# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set
# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set
CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
CONFIG_PARTITION_TABLE_SINGLE_APP=y
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
# CONFIG_PARTITION_TABLE_CUSTOM is not set
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
CONFIG_ESP_WIFI_SSID="myssid2"
CONFIG_ESP_WIFI_PASSWORD="mypassword"
CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y
# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set
# CONFIG_COMPILER_CXX_EXCEPTIONS is not set
CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y
# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set
# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set
# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set
# CONFIG_COMPILER_STACK_CHECK is not set
# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set
# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set
# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set
CONFIG_ESP32_APPTRACE_DEST_NONE=y
# CONFIG_ESP32_APPTRACE_ENABLE is not set
CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
# CONFIG_BT_ENABLED is not set
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0
CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=0
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0
CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
CONFIG_BT_RESERVE_DRAM=0
# CONFIG_BLE_MESH is not set
# CONFIG_ADC_FORCE_XPD_FSM is not set
CONFIG_ADC_DISABLE_DAC=y
# CONFIG_SPI_MASTER_IN_IRAM is not set
CONFIG_SPI_MASTER_ISR_IN_IRAM=y
# CONFIG_SPI_SLAVE_IN_IRAM is not set
CONFIG_SPI_SLAVE_ISR_IN_IRAM=y
# CONFIG_EFUSE_CUSTOM_TABLE is not set
# CONFIG_EFUSE_VIRTUAL is not set
# CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set
CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y
# CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set
CONFIG_EFUSE_MAX_BLK_LEN=192
# CONFIG_ESP_TLS_SERVER is not set
CONFIG_ESP32_REV_MIN_0=y
# CONFIG_ESP32_REV_MIN_1 is not set
# CONFIG_ESP32_REV_MIN_2 is not set
# CONFIG_ESP32_REV_MIN_3 is not set
CONFIG_ESP32_REV_MIN=0
CONFIG_ESP32_DPORT_WORKAROUND=y
# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set
CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y
# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160
# CONFIG_ESP32_SPIRAM_SUPPORT is not set
# CONFIG_ESP32_MEMMAP_TRACEMEM is not set
# CONFIG_ESP32_MEMMAP_TRACEMEM_TWOBANKS is not set
# CONFIG_ESP32_TRAX is not set
CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0
# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set
CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y
CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4
# CONFIG_ESP32_ULP_COPROC_ENABLED is not set
CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0
# CONFIG_ESP32_PANIC_PRINT_HALT is not set
CONFIG_ESP32_PANIC_PRINT_REBOOT=y
# CONFIG_ESP32_PANIC_SILENT_REBOOT is not set
# CONFIG_ESP32_PANIC_GDBSTUB is not set
CONFIG_ESP32_DEBUG_OCDAWARE=y
CONFIG_ESP32_DEBUG_STUBS_ENABLE=y
CONFIG_ESP32_BROWNOUT_DET=y
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y
# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set
# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set
# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set
# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set
# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set
# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set
# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set
CONFIG_ESP32_BROWNOUT_DET_LVL=0
CONFIG_ESP32_REDUCE_PHY_TX_POWER=y
CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y
# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set
# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set
# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set
CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y
# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set
# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set
# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set
CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024
CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000
CONFIG_ESP32_XTAL_FREQ_40=y
# CONFIG_ESP32_XTAL_FREQ_26 is not set
# CONFIG_ESP32_XTAL_FREQ_AUTO is not set
CONFIG_ESP32_XTAL_FREQ=40
# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set
# CONFIG_ESP32_NO_BLOBS is not set
# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set
# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set
CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5
# CONFIG_PM_ENABLE is not set
CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y
CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y
CONFIG_ADC_CAL_LUT_ENABLE=y
# CONFIG_ESP_TIMER_PROFILING is not set
CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304
CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584
CONFIG_ESP_IPC_TASK_STACK_SIZE=1024
CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584
CONFIG_ESP_CONSOLE_UART_DEFAULT=y
# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set
# CONFIG_ESP_CONSOLE_UART_NONE is not set
CONFIG_ESP_CONSOLE_UART_NUM=0
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
CONFIG_ESP_INT_WDT=y
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
CONFIG_ESP_INT_WDT_CHECK_CPU1=y
CONFIG_ESP_TASK_WDT=y
# CONFIG_ESP_TASK_WDT_PANIC is not set
CONFIG_ESP_TASK_WDT_TIMEOUT_S=5
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
CONFIG_ETH_USE_ESP32_EMAC=y
CONFIG_ETH_PHY_INTERFACE_RMII=y
# CONFIG_ETH_PHY_INTERFACE_MII is not set
CONFIG_ETH_RMII_CLK_INPUT=y
# CONFIG_ETH_RMII_CLK_OUTPUT is not set
CONFIG_ETH_RMII_CLK_IN_GPIO=0
CONFIG_ETH_DMA_BUFFER_SIZE=512
CONFIG_ETH_DMA_RX_BUFFER_NUM=10
CONFIG_ETH_DMA_TX_BUFFER_NUM=10
CONFIG_ETH_USE_SPI_ETHERNET=y
CONFIG_ETH_SPI_ETHERNET_DM9051=y
# CONFIG_ESP_EVENT_LOOP_PROFILING is not set
CONFIG_ESP_EVENT_POST_FROM_ISR=y
CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
CONFIG_HTTPD_MAX_REQ_HDR_LEN=512
CONFIG_HTTPD_MAX_URI_LEN=512
CONFIG_HTTPD_ERR_RESP_NO_DELAY=y
CONFIG_HTTPD_PURGE_BUF_LEN=32
# CONFIG_HTTPD_LOG_PURGE_DATA is not set
# CONFIG_OTA_ALLOW_HTTP is not set
# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32
# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y
CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32
# CONFIG_ESP32_WIFI_CSI_ENABLED is not set
CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
CONFIG_ESP32_WIFI_TX_BA_WIN=6
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
CONFIG_ESP32_WIFI_RX_BA_WIN=6
CONFIG_ESP32_WIFI_NVS_ENABLED=y
CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32
# CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE is not set
CONFIG_ESP32_WIFI_IRAM_OPT=y
CONFIG_ESP32_WIFI_RX_IRAM_OPT=y
CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y
# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set
CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20
CONFIG_ESP32_PHY_MAX_TX_POWER=20
# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set
# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set
CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y
# CONFIG_ESP32_ENABLE_COREDUMP is not set
# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set
CONFIG_FATFS_CODEPAGE_437=y
# CONFIG_FATFS_CODEPAGE_720 is not set
# CONFIG_FATFS_CODEPAGE_737 is not set
# CONFIG_FATFS_CODEPAGE_771 is not set
# CONFIG_FATFS_CODEPAGE_775 is not set
# CONFIG_FATFS_CODEPAGE_850 is not set
# CONFIG_FATFS_CODEPAGE_852 is not set
# CONFIG_FATFS_CODEPAGE_855 is not set
# CONFIG_FATFS_CODEPAGE_857 is not set
# CONFIG_FATFS_CODEPAGE_860 is not set
# CONFIG_FATFS_CODEPAGE_861 is not set
# CONFIG_FATFS_CODEPAGE_862 is not set
# CONFIG_FATFS_CODEPAGE_863 is not set
# CONFIG_FATFS_CODEPAGE_864 is not set
# CONFIG_FATFS_CODEPAGE_865 is not set
# CONFIG_FATFS_CODEPAGE_866 is not set
# CONFIG_FATFS_CODEPAGE_869 is not set
# CONFIG_FATFS_CODEPAGE_932 is not set
# CONFIG_FATFS_CODEPAGE_936 is not set
# CONFIG_FATFS_CODEPAGE_949 is not set
# CONFIG_FATFS_CODEPAGE_950 is not set
CONFIG_FATFS_CODEPAGE=437
CONFIG_FATFS_LFN_NONE=y
# CONFIG_FATFS_LFN_HEAP is not set
# CONFIG_FATFS_LFN_STACK is not set
CONFIG_FATFS_FS_LOCK=0
CONFIG_FATFS_TIMEOUT_MS=10000
CONFIG_FATFS_PER_FILE_CACHE=y
CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150
CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200
CONFIG_FMB_QUEUE_LENGTH=20
CONFIG_FMB_SERIAL_TASK_STACK_SIZE=2048
CONFIG_FMB_SERIAL_BUF_SIZE=256
CONFIG_FMB_SERIAL_TASK_PRIO=10
# CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set
CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20
CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20
CONFIG_FMB_CONTROLLER_STACK_SIZE=4096
CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20
CONFIG_FMB_TIMER_PORT_ENABLED=y
CONFIG_FMB_TIMER_GROUP=0
CONFIG_FMB_TIMER_INDEX=0
# CONFIG_FREERTOS_UNICORE is not set
CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF
CONFIG_FREERTOS_CORETIMER_0=y
# CONFIG_FREERTOS_CORETIMER_1 is not set
CONFIG_FREERTOS_HZ=100
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y
# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set
# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y
# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set
CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y
CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1
CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y
# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set
# CONFIG_FREERTOS_ASSERT_DISABLE is not set
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536
CONFIG_FREERTOS_ISR_STACKSIZE=1536
# CONFIG_FREERTOS_LEGACY_HOOKS is not set
CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16
# CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION is not set
CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048
CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set
# CONFIG_FREERTOS_DEBUG_INTERNALS is not set
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set
CONFIG_HEAP_POISONING_DISABLED=y
# CONFIG_HEAP_POISONING_LIGHT is not set
# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set
CONFIG_HEAP_TRACING_OFF=y
# CONFIG_HEAP_TRACING_STANDALONE is not set
# CONFIG_HEAP_TRACING_TOHOST is not set
# CONFIG_HEAP_TRACING is not set
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_COLORS=y
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
# CONFIG_LWIP_L2_TO_L3_COPY is not set
# CONFIG_LWIP_IRAM_OPTIMIZATION is not set
CONFIG_LWIP_TIMERS_ONDEMAND=y
CONFIG_LWIP_MAX_SOCKETS=10
# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set
CONFIG_LWIP_SO_REUSE=y
CONFIG_LWIP_SO_REUSE_RXTOALL=y
# CONFIG_LWIP_SO_RCVBUF is not set
# CONFIG_LWIP_IP_FRAG is not set
# CONFIG_LWIP_IP_REASSEMBLY is not set
# CONFIG_LWIP_STATS is not set
# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set
CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
CONFIG_LWIP_GARP_TMR_INTERVAL=60
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
CONFIG_LWIP_DHCPS_LEASE_UNIT=60
CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
# CONFIG_LWIP_AUTOIP is not set
CONFIG_LWIP_NETIF_LOOPBACK=y
CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8
CONFIG_LWIP_MAX_ACTIVE_TCP=16
CONFIG_LWIP_MAX_LISTENING_TCP=16
CONFIG_LWIP_TCP_MAXRTX=12
CONFIG_LWIP_TCP_SYNMAXRTX=6
CONFIG_LWIP_TCP_MSS=1440
CONFIG_LWIP_TCP_MSL=60000
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744
CONFIG_LWIP_TCP_WND_DEFAULT=5744
CONFIG_LWIP_TCP_RECVMBOX_SIZE=6
CONFIG_LWIP_TCP_QUEUE_OOSEQ=y
# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set
CONFIG_LWIP_TCP_OVERSIZE_MSS=y
# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set
# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set
CONFIG_LWIP_MAX_UDP_PCBS=16
CONFIG_LWIP_UDP_RECVMBOX_SIZE=6
CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072
CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set
# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set
CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF
# CONFIG_LWIP_PPP_SUPPORT is not set
# CONFIG_LWIP_MULTICAST_PING is not set
# CONFIG_LWIP_BROADCAST_PING is not set
CONFIG_LWIP_MAX_RAW_PCBS=16
CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1
CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000
CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set
# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
# CONFIG_MBEDTLS_DEBUG is not set
# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set
# CONFIG_MBEDTLS_CMAC_C is not set
CONFIG_MBEDTLS_HARDWARE_AES=y
# CONFIG_MBEDTLS_HARDWARE_MPI is not set
CONFIG_MBEDTLS_HARDWARE_SHA=y
CONFIG_MBEDTLS_HAVE_TIME=y
# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set
# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set
# CONFIG_MBEDTLS_TLS_DISABLED is not set
CONFIG_MBEDTLS_TLS_SERVER=y
CONFIG_MBEDTLS_TLS_CLIENT=y
CONFIG_MBEDTLS_TLS_ENABLED=y
# CONFIG_MBEDTLS_PSK_MODES is not set
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y
CONFIG_MBEDTLS_SSL_RENEGOTIATION=y
# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set
CONFIG_MBEDTLS_SSL_PROTO_TLS1=y
CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y
CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set
CONFIG_MBEDTLS_SSL_ALPN=y
CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y
CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y
CONFIG_MBEDTLS_AES_C=y
# CONFIG_MBEDTLS_CAMELLIA_C is not set
# CONFIG_MBEDTLS_DES_C is not set
CONFIG_MBEDTLS_RC4_DISABLED=y
# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set
# CONFIG_MBEDTLS_RC4_ENABLED is not set
# CONFIG_MBEDTLS_BLOWFISH_C is not set
# CONFIG_MBEDTLS_XTEA_C is not set
CONFIG_MBEDTLS_CCM_C=y
CONFIG_MBEDTLS_GCM_C=y
# CONFIG_MBEDTLS_RIPEMD160_C is not set
CONFIG_MBEDTLS_PEM_PARSE_C=y
CONFIG_MBEDTLS_PEM_WRITE_C=y
CONFIG_MBEDTLS_X509_CRL_PARSE_C=y
CONFIG_MBEDTLS_X509_CSR_PARSE_C=y
CONFIG_MBEDTLS_ECP_C=y
CONFIG_MBEDTLS_ECDH_C=y
CONFIG_MBEDTLS_ECDSA_C=y
CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y
CONFIG_MBEDTLS_ECP_NIST_OPTIM=y
CONFIG_MDNS_MAX_SERVICES=10
CONFIG_MQTT_PROTOCOL_311=y
CONFIG_MQTT_TRANSPORT_SSL=y
CONFIG_MQTT_TRANSPORT_WEBSOCKET=y
CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y
# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set
# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set
# CONFIG_MQTT_CUSTOM_OUTBOX is not set
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y
# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set
# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set
# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set
# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set
CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y
# CONFIG_NEWLIB_NANO_FORMAT is not set
# CONFIG_OPENSSL_DEBUG is not set
# CONFIG_OPENSSL_ASSERT_DO_NOTHING is not set
CONFIG_OPENSSL_ASSERT_EXIT=y
CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
CONFIG_PTHREAD_STACK_MIN=768
CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y
# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set
# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set
CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1
CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread"
# CONFIG_SPI_FLASH_VERIFY_WRITE is not set
# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y
CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y
# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set
# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set
# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set
CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y
CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y
CONFIG_SPIFFS_BASE_ADDR=1048576
CONFIG_SPIFFS_SIZE=1048576
CONFIG_SPIFFS_LOG_BLOCK_SIZE=8192
CONFIG_SPIFFS_LOG_PAGE_SIZE=256
CONFIG_NETIF_IP_LOST_TIMER_INTERVAL=120
CONFIG_TCPIP_LWIP=y
CONFIG_UNITY_ENABLE_FLOAT=y
CONFIG_UNITY_ENABLE_DOUBLE=y
# CONFIG_UNITY_ENABLE_COLOR is not set
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
# CONFIG_UNITY_ENABLE_FIXTURE is not set
# CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set
CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y
CONFIG_VFS_SUPPORT_TERMIOS=y
CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1
CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128
# CONFIG_WL_SECTOR_SIZE_512 is not set
CONFIG_WL_SECTOR_SIZE_4096=y
CONFIG_WL_SECTOR_SIZE=4096
CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16
CONFIG_WPA_MBEDTLS_CRYPTO=y
CONFIG_TFT_PREDEFINED_DISPLAY_TYPE=0
CONFIG_TFT_PREDEFINED_DISPLAY_TYPE0=y
# CONFIG_TFT_PREDEFINED_DISPLAY_TYPE1 is not set
# CONFIG_TFT_PREDEFINED_DISPLAY_TYPE4 is not set
# CONFIG_TFT_PREDEFINED_DISPLAY_TYPE2 is not set
# CONFIG_TFT_PREDEFINED_DISPLAY_TYPE3 is not set
# CONFIG_TFT_PREDEFINED_DISPLAY_TYPE5 is not set
CONFIG_TFT_DISPLAY_CONTROLLER_MODEL=0
CONFIG_TFT_DISPLAY_CONTROLLER_ILI9341=y
# CONFIG_TFT_DISPLAY_CONTROLLER_ILI9488 is not set
# CONFIG_TFT_DISPLAY_CONTROLLER_ST7789V is not set
# CONFIG_TFT_DISPLAY_CONTROLLER_ST7735 is not set
# CONFIG_TFT_DISPLAY_CONTROLLER_ST7735R is not set
# CONFIG_TFT_DISPLAY_CONTROLLER_ST7735B is not set
CONFIG_TFT_DISPLAY_WIDTH=240
CONFIG_TFT_DISPLAY_HEIGHT=320
# CONFIG_TFT_RGB_BGR is not set
CONFIG_TFT_TOUCH_CONTROLLER=0
CONFIG_TFT_TOUCH_CONTROLLER0=y
# CONFIG_TFT_TOUCH_CONTROLLER1 is not set
# CONFIG_TFT_TOUCH_CONTROLLER2 is not set
# CONFIG_TFT_INVERT_ROTATION1 is not set
CONFIG_TFT_PIN_NUM_MOSI=23
CONFIG_TFT_PIN_NUM_MISO=19
CONFIG_TFT_PIN_NUM_CLK=18
CONFIG_TFT_PIN_NUM_CS=5
CONFIG_TFT_PIN_NUM_DC=26
CONFIG_TFT_PIN_NUM_TCS=25
CONFIG_TFT_PIN_NUM_RST=0
CONFIG_TFT_PIN_NUM_BCKL=0
# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set