FluxDC/components/FluxSD/FluxSD.h

104 lines
1.8 KiB
C
Raw Normal View History

/**
* @file FluxSD.h
* @brief SD卡头文件
*
*
*
* @author wang xiang en
* @date 2025-04-18
* @version
* @copyright (C)2025, YUWELL MEDTECH Co.ltd
2025-03-07 19:07:31 +08:00
*/
2025-03-15 09:37:07 +08:00
#ifndef _FLUX_SD_H
#define _FLUX_SD_H
2025-03-07 19:07:31 +08:00
#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)
/* 定义挂载点 */
2025-03-07 19:07:31 +08:00
#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)
2025-03-07 19:07:31 +08:00
/**
* @brief SD卡Pin配置
*
*/
2025-03-07 19:07:31 +08:00
typedef struct {
const char** names;
const int* pins;
} pin_configuration_t;
/**
* @brief SD卡引脚检查
*
* SD卡引脚配置进行检查SD使用
*
* @param[out] config
* @param[in] pin_count
*/
2025-03-07 19:07:31 +08:00
void check_sd_card_pins(pin_configuration_t *config, const int pin_count);
/**
* @brief SD卡初始化
*
*/
2025-03-07 19:07:31 +08:00
void flux_sd_init(void);
2025-03-15 09:37:07 +08:00
/**
* @brief
*
*
*
*/
esp_err_t s_example_write_log(char *data);
2025-03-07 19:07:31 +08:00
#ifdef __cplusplus
}
#endif
2025-03-15 09:37:07 +08:00
#endif