pile_com_stm32/main/main.c

36 lines
729 B
C
Raw Normal View History

2023-07-20 10:17:11 +08:00
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "nvs_flash.h"
2024-03-30 18:47:02 +08:00
#include "esp_log.h"
2023-07-20 10:17:11 +08:00
2024-03-30 18:47:02 +08:00
#include "config.h"
#include "uart0_modbus_slave.h"
#include "flow.h"
#include "bl0939.h"
#include "depth.h"
2023-07-20 10:17:11 +08:00
static const char *TAG = "main";
uint32_t rtc_clk_apb_freq;
2024-03-30 18:47:02 +08:00
extern void pcnt_rotary_encoder_init_(void);
2023-07-20 10:17:11 +08:00
void app_main(void)
{
2023-07-20 13:51:10 +08:00
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND)
{
2023-07-20 10:17:11 +08:00
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
2023-07-20 13:51:10 +08:00
}
ESP_ERROR_CHECK(ret);
2023-11-15 22:06:47 +08:00
2024-03-30 18:47:02 +08:00
config_init();
2023-07-20 13:51:10 +08:00
uart0_modbus_slave_init();
2024-03-30 18:47:02 +08:00
flow_init();
BL0939_init();
// pcnt_rotary_encoder_init_();
DEPTH_init();
2023-07-20 10:17:11 +08:00
}
2023-07-20 13:51:10 +08:00