PER Firmware
Loading...
Searching...
No Matches
sd_card.h
Go to the documentation of this file.
1
10#ifndef SD_CARD_H
11#define SD_CARD_H
12
13#include "external/fatfs/ff.h"
15
16typedef enum {
17 SD_STATE_IDLE = 0,
18 SD_STATE_MOUNTED = 1,
19 SD_STATE_ACTIVE = 2,
20} sd_state_t;
21
22typedef enum {
23 SD_ERROR_NONE = 0,
24 SD_ERROR_MOUNT = 1,
25 SD_ERROR_FOPEN = 2,
26 SD_ERROR_FCLOSE = 3,
27 SD_ERROR_WRITE = 4,
28 SD_ERROR_DETEC = 5,
29 SD_ERROR_SYNC = 6,
30} sd_error_t;
31
32typedef struct {
33 // SD Card
34 sd_state_t sd_state;
35 FATFS fat_fs;
36 uint32_t sd_error_ct;
37 sd_error_t sd_last_err;
38 FRESULT sd_last_err_res;
39 uint32_t sd_last_error_time;
40 osThreadId_t sd_task_handle;
41
42 FIL log_fp;
43 uint32_t log_start_ms;
44 uint32_t last_write_ms;
45 uint32_t last_file_ms;
47 bool log_enable_tcp;
49extern SD_manager_t sd_manager;
50
51bool daq_request_sd_mount(void);
52void sd_shutdown(void);
53void sd_update_periodic(void);
54
55#endif // SD_CARD_H
Wrapper macros for FreeRTOS constructs (tasks, queues, semaphores) to simplify static memory allocati...
Definition sd_card.h:32
bool log_enable_sw
Debounced switch state.
Definition sd_card.h:46