1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include <stdio.h>
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "driver/gpio.h"
- #include "esp_log.h"
- #include <stdbool.h>
- #include "sdkconfig.h"
- #include "config.h"
- #include "wifi.h"
- #include "mqtt.h"
- #include "readTemps.h"
- esp_chip_info_t chip_info;
- static void configure_led(void)
- {
- ESP_LOGI("LED", "Example configured to blink GPIO LED!");
- gpio_reset_pin(BLINK_GPIO);
- /* Set the GPIO as a push/pull output */
- gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
- }
- void getChipInfo(void) {
- esp_chip_info_t chip_info;
- esp_chip_info(&chip_info);
- ESP_LOGI("MAIN", "Model: %d = %s", chip_info.model,chip_info.model == CHIP_ESP32 ? "ESP32" : "Unknown");
- ESP_LOGI("MAIN", "Features: WiFi%s%s, %d cores",
- (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
- (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "",
- chip_info.cores);
- ESP_LOGI("MAIN", "Revision: %d", chip_info.revision);
- }
- void app_main(void)
- {
- getChipInfo();
- #ifdef WIFI_ENABLED
- initWifi(); // Init WIFI
- #endif
- #ifdef MQTT_ENABLED
- mqtt_init();
- #endif
- #ifdef ENABLE_DS18B20
- initTempReadings();
- #endif
- /* Configure the peripheral according to the LED type */
- configure_led();
-
- while(1) {
- gpio_set_level(BLINK_GPIO, 1); // Turn the LED on (1 is high)
- vTaskDelay(500 / portTICK_PERIOD_MS);
- gpio_set_level(BLINK_GPIO, 0); // Turn the LED off (0 is low)
- vTaskDelay(500 / portTICK_PERIOD_MS);
- }
- }
|