wheel/main/station_example_main.c
2024-01-24 12:00:45 +08:00

55 lines
1.3 KiB
C

/* WiFi station Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "driver/ledc.h"
#include "lwip/err.h"
#include "lwip/sys.h"
#include "adc_measure.h"
static const char *TAG = "wheel";
extern void can_init(void);
extern void ModBusTCPSlave_init(void);
extern void lis3dsh_fifo_stream(void);
extern void bdc_control_main(void);
extern void bdc_motor_init_all(void);
extern void wifi_init_sta(void);
void app_main(void)
{
// 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);
wifi_init_sta();
ModBusTCPSlave_init();
bdc_motor_init_all();
adc_measure_init();
while (1)
{
vTaskDelay(pdMS_TO_TICKS(100));
}
}