Files
sunflower-girl/sound_picture_app/SD_Card.h

52 lines
1.4 KiB
C

#pragma once
#include "Arduino.h"
#include <cstring>
#include "FS.h"
#include "FFat.h"
#define MAX_MEMORIES 50
#define MAX_NAME_LEN 64
#define MAX_FILE_LEN 64
// A single named memory: photo + audio pair
struct Memory {
int id;
char name[MAX_NAME_LEN];
char photo[MAX_FILE_LEN]; // filename only, lives in /photos/
char audio[MAX_FILE_LEN]; // filename only, lives in /audio/
};
// Global memory list & settings
extern Memory g_memories[MAX_MEMORIES];
extern int g_memoryCount;
extern int g_currentIndex;
extern uint8_t g_volume;
extern uint16_t SDCard_Size;
extern uint16_t Flash_Size;
// Tribute Alarm Settings
extern bool g_tributeAlarmEnabled;
extern int g_tributeAlarmHour;
extern int g_tributeAlarmMinute;
extern int g_timezoneOffset;
extern bool g_timeSynchronized;
extern int g_favoriteMemoryId;
// SD init
void SD_Init();
void Flash_test();
// Config load / save
bool Config_Load();
bool Config_Save();
// Memory CRUD
int Config_Add_Memory(const char* name, const char* photo, const char* audio);
bool Config_Delete_Memory(int id);
// Low-level helpers (kept for legacy use)
bool File_Search(const char* directory, const char* fileName);
uint16_t Folder_retrieval(const char* directory, const char* fileExtension,
char File_Name[][100], uint16_t maxFiles);
void remove_file_extension(char* file_name);