IZAR Flight Controller 1.0.0
IZAR Flight Controller running with an ESP32.
sd.h File Reference
#include <esp_log.h>
#include <freertos/FreeRTOS.h>
Include dependency graph for sd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TAG_SD   "SD"
#define SD_ERR_BASE   0x200

Enumerations

enum  sd_err_t {
  SD_ERR_SPI_INIT = 0x200 + 1 , SD_ERR_MOUNT_FAIL = 0x200 + 2 , SD_ERR_FILE_OPEN = 0x200 + 3 , SD_ERR_WRITE_FAIL = 0x200 + 4 ,
  SD_ERR_FILE_CLOSED = 0x200 + 5
}

Functions

esp_err_t init_sd_card (FILE **logFile)
esp_err_t write_to_file (FILE *file, const char *message, const char *endl)
char * sd_err_to_name (esp_err_t err)

Macro Definition Documentation

◆ SD_ERR_BASE

#define SD_ERR_BASE   0x200

◆ TAG_SD

#define TAG_SD   "SD"

Enumeration Type Documentation

◆ sd_err_t

enum sd_err_t
Enumerator
SD_ERR_SPI_INIT 

spi_bus_initialize() failed

SD_ERR_MOUNT_FAIL 

esp_vfs_fat_sdspi_mount() failed

SD_ERR_FILE_OPEN 

fopen() returned NULL

SD_ERR_WRITE_FAIL 

fwrite() or flush failed

SD_ERR_FILE_CLOSED 

file is closed

Function Documentation

◆ init_sd_card()

esp_err_t init_sd_card ( FILE ** logFile)

Initialize SD card reader.

< host supports SPI protocol

< host deinit function called with the slot argument

< SD/MMC Default speed (limited by clock divider)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

Here is the caller graph for this function:

◆ sd_err_to_name()

char * sd_err_to_name ( esp_err_t err)

< esp_err_t value indicating success (no error)

◆ write_to_file()

esp_err_t write_to_file ( FILE * file,
const char * message,
const char * endl )

Writes the message to the file and saves it.

< esp_err_t value indicating success (no error)

Here is the caller graph for this function: