FluxDC/components/FluxSD/FluxSD.h

96 lines
1.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file FluxSD.h
* @brief SD卡头文件
*
* 用于存储测试日志
*
* @author wang xiang en
* @date 2025-04-18
* @version 版本号
* @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd
*/
#ifndef _FLUX_SD_H
#define _FLUX_SD_H
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
#include <sys/unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include <inttypes.h>
#include <unistd.h>
#include "driver/gpio.h"
#include "esp_cpu.h"
#include "esp_log.h"
#include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
#include "driver/sdmmc_host.h"
/* 定义块大小 */
#define EXAMPLE_MAX_CHAR_SIZE (64)
/* 定义挂载点 */
#define MOUNT_POINT "/sdcard"
/* 选择是否进行测试数据记录 */
#define LOG_RECORD_ENABLE 1
/* SD卡读写引脚编号 */
#define CONFIG_EXAMPLE_PIN_CLK (14)
#define CONFIG_EXAMPLE_PIN_CMD (21)
#define CONFIG_EXAMPLE_PIN_D0 (13)
#define CONFIG_EXAMPLE_PIN_D1 (12)
#define CONFIG_EXAMPLE_PIN_D2 (48)
#define CONFIG_EXAMPLE_PIN_D3 (47)
/* 导出SD存储信息 */
extern uint64_t total_bytes;
extern uint64_t free_bytes;
extern float free_percent;
/**
* @brief 选择引脚
*
*/
#define GPIO_INPUT_PIN_SEL(pin) (1ULL<<pin)
/**
* @brief SD卡Pin配置
*
*/
typedef struct {
const char** names;
const int* pins;
} pin_configuration_t;
/**
* @brief SD卡初始化
*
*/
void flux_sd_init(void);
/**
* @brief 日志记录
*
* 用于记录测试过程日志
*
*/
esp_err_t s_example_write_log(char *data);
#ifdef __cplusplus
}
#endif
#endif