添加ota功能函数

This commit is contained in:
OPTOC
2025-09-09 18:07:30 +08:00
parent 25b994cb65
commit fb05542e80
4 changed files with 129 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
#pragma once
#include "esp_ota_ops.h"
#include "esp_system.h"
#include "esp_log.h"
#include "sys_log.h"
#define OTA_TAG_0 "ota_0"
#define OTA_TAG_1 "ota_1"
typedef struct
{
const esp_partition_t *running;
const esp_partition_t *update;
esp_ota_handle_t ota_handle;
int total_size;
}ota_u_t;
/**
* @brief OTA初始化
*
* @param otau
*/
void otau_init(ota_u_t* otau);
/**
* @brief OTA写入
*
* @param otau
* @param data
* @param size
* @return uint8_t
*/
uint8_t otau_write(ota_u_t* otau, void* data, uint32_t size);
/**
* @brief OTA结束
*
* @param otau
* @return uint8_t
*/
uint8_t otau_end(ota_u_t* otau);