4985fee7c2
2. 简单封装了LVGL渲染类,已经封装好了gif渲染功能 3. 修复了硬件厂商提供的驱动的Bug 4. 初步定义了宠物基类的抽象信息
71 lines
1.7 KiB
C
71 lines
1.7 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "esp_log.h"
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "esp_wifi.h"
|
|
#include "nvs_flash.h"
|
|
#include "esp_log.h"
|
|
#include <stdio.h>
|
|
#include <string.h> // For memcpy
|
|
#include "esp_system.h"
|
|
#include "esp_bt.h"
|
|
#include "esp_gap_ble_api.h"
|
|
#include "esp_bt_main.h"
|
|
|
|
// WiFi AP信息结构体
|
|
typedef struct {
|
|
char ssid[33]; // SSID名称 (最大32字符 + 1个空字符)
|
|
uint8_t bssid[6]; // MAC地址
|
|
int8_t rssi; // 信号强度
|
|
wifi_auth_mode_t authmode; // 认证模式
|
|
} wifi_ap_info_t;
|
|
|
|
// BLE设备信息结构体
|
|
typedef struct {
|
|
char name[100]; // 设备名称
|
|
uint8_t address[6]; // MAC地址
|
|
int8_t rssi; // 信号强度
|
|
} ble_device_info_t;
|
|
|
|
extern uint16_t BLE_NUM;
|
|
extern uint16_t WIFI_NUM;
|
|
extern bool Scan_finish;
|
|
|
|
esp_err_t Wireless_Init(void);
|
|
esp_err_t WIFI_Init(void *arg);
|
|
uint16_t WIFI_Scan(void);
|
|
void BLE_Init(void *arg);
|
|
uint16_t BLE_Scan(void);
|
|
|
|
// 下面的函数为新增的函数
|
|
// Code By Misaki
|
|
|
|
/**
|
|
* @brief 自动连接指定 Wi-Fi,带重试
|
|
* @param ssid 目标热点名称
|
|
* @param password 密码
|
|
* @param max_retry 最大重连次数(0 表示仅尝试一次)
|
|
* @return true 成功连接
|
|
* false 达到重试上限仍未连上
|
|
*/
|
|
bool WiFi_AutoConnect(const char *ssid, const char *password, uint8_t max_retry);
|
|
|
|
/**
|
|
* @brief 断开当前 STA 连接
|
|
*/
|
|
esp_err_t WiFi_Disconnect(void);
|
|
|
|
// 接口函数
|
|
uint16_t wireless_get_wifi_ap_list(wifi_ap_info_t *ap_list, uint16_t max_aps);
|
|
uint16_t wireless_get_ble_device_list(ble_device_info_t *device_list, uint16_t max_devices);
|
|
void wireless_print_wifi_aps(void);
|
|
void wireless_print_ble_devices(void);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |