Files
cute-handshake-capture/handshake-capture-c6/SD_Card.h
drjones 8121137b68 handshake-capture-c6 v1.0.4: persist captured BSSIDs, PCAP EAPOL recount
- /cap_bssids.txt append on save; handshakeLoadPersistedBssids after SD mount
- Boot order: SD then load file then first WiFi scan (reds match SD)
- Pre-save walk of in-memory PCAP counting EAPOL-Key frames
- SD_AppendLine / SD_ForEachLine; drop g_sd_ready clear on write fail
- README + MUST_DO updates

Made-with: Cursor
2026-03-23 09:35:18 -07:00

24 lines
870 B
C

#pragma once
#include <Arduino.h>
#include <SD.h>
#include <SPI.h>
#define SD_CS 4
extern uint16_t SDCard_Size;
bool SD_Init();
/**
* True only after the last SD_Init() completed successfully (SD.begin + valid cardType).
* Use this to gate capture — do NOT rely on SD.cardType() alone after WiFi on ESP32-C6:
* with LCD+SD sharing SPI, cardType() can spuriously read CARD_NONE and falsely show "insert SD".
*/
bool SD_IsReady();
bool SD_WriteFileAtomic(const char* path, const uint8_t* data, size_t len);
/** Append one line (caller supplies \\n if desired). Uses same SPI lock as other SD ops. */
bool SD_AppendLine(const char* path, const char* line);
typedef void (*SD_LineCallback)(const char* line, void* user);
/** Read text file line-by-line; missing file is OK (returns true). */
bool SD_ForEachLine(const char* path, SD_LineCallback cb, void* user);