main.c 775 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <stdio.h>
  2. #include "sdkconfig.h"
  3. #include "freertos/FreeRTOS.h"
  4. #include "freertos/task.h"
  5. #include "esp_system.h"
  6. #include "esp_spi_flash.h"
  7. #include "freertos/queue.h"
  8. #include "esp_attr.h"
  9. #include "esp_log.h"
  10. #include "config.h"
  11. #include "wifi.h"
  12. #include "serial.h"
  13. #include "displayAndSend.h"
  14. #include "pcnt_functions.h"
  15. // Chip info:
  16. // This is esp32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external flash
  17. void app_main(void)
  18. {
  19. ESP_LOGI("MAIN", "HomeEnergyMeter ESP32");
  20. #ifdef WIFI_ENABLED
  21. initWifi(); // Init WIFI
  22. #endif
  23. #ifdef MQTT_ENABLED
  24. mqtt_init();
  25. #endif
  26. #ifdef CCFG_PCNT
  27. initPCNT();
  28. #endif
  29. #ifdef SERIAL_ENABLED
  30. initSerial();
  31. #endif
  32. initDisplayAndSend();
  33. vTaskDelete(NULL);
  34. }