Contain SD card module with related structures and functions. More...
Macros | |
#define | FILE_NAME "TEST.TXT" |
#define | TEST_STRING "SD card test string." |
#define | SDC_CS_PIN (22UL) |
SDCard chip select (CS) pin. More... | |
#define | SDC_MOSI_PIN (23UL) |
SDCard serial data in (DI) pin. More... | |
#define | SDC_MISO_PIN (24UL) |
SDCard serial data out (DO) pin. More... | |
#define | SDC_SCK_PIN (25UL) |
SDCard serial clock (SCK) pin. More... | |
Functions | |
void | SDcardInit (void) |
Initialize SD card and mount disk. More... | |
void | openMissionLogDirectory () |
More... | |
uint32_t | findLatestMissionLog () |
More... | |
void | createMissionLog () |
More... | |
void | printMissionLogContent (uint8_t returnMsg[], uint16_t *returnLength) |
More... | |
uint32_t | openFileToRead (uint8_t filename[]) |
More... | |
void | lseek (uint32_t index) |
More... | |
void | writeToOpenFile (void *text, uint8_t length, uint32_t *bytes_written) |
More... | |
void | readFromOpenFile (void *text, uint8_t length, uint32_t *bytes_read) |
More... | |
void | closeFile () |
More... | |
void | writeFile (uint8_t filename[], uint8_t text[], uint8_t length, uint32_t *bytes_written) |
More... | |
void | readFile (uint8_t filename[], uint8_t text[], uint8_t length, uint8_t *p_nrBytesRead) |
More... | |
void | unMount () |
More... | |
void | writeMissionLog () |
More... | |
void | deleteLogFile (uint32_t filename, uint8_t returnMsg[], uint16_t *returnLength) |
More... | |
void | deleteAllLogFiles (uint16_t *returnLength, uint8_t returnMsg[]) |
More... | |
uint32_t | countMissionLog () |
More... | |
void | queueLogFilesforTransfer (uint32_t queue[], uint32_t *totalSize) |
More... | |
NRF_BLOCK_DEV_SDC_DEFINE (m_block_dev_sdc, NRF_BLOCK_DEV_SDC_CONFIG(SDC_SECTOR_SIZE,),) | |
void | readFile (uint8_t *, uint8_t *, uint8_t, uint8_t *) |
open file and read from it. More... | |
void | writeFile (uint8_t *, uint8_t *, uint8_t, uint32_t *) |
open file and read from it. More... | |
void | printMissionLogContent (uint8_t *, uint16_t *) |
print content of mission Log directory, as a list of log files, to BLE menu. More... | |
uint32_t | openFileToRead (uint8_t *) |
Open a file with read permission. More... | |
void | deleteLogFile (uint32_t, uint8_t *, uint16_t *) |
Delete one log file. More... | |
void | deleteAllLogFiles (uint16_t *, uint8_t *) |
Delete one log file. More... | |
void | queueLogFilesforTransfer (uint32_t *, uint32_t *) |
Create a queue for trasnfering all log files over BLE. More... | |
Variables | |
missionLog_t | missionLog |
Create mission log instance. More... | |
FRESULT | f_err_code |
DSTATUS | disk_state = STA_NOINIT |
Contain SD card module with related structures and functions.
#define FILE_NAME "TEST.TXT" |
#define SDC_CS_PIN (22UL) |
SDCard chip select (CS) pin.
#define SDC_MISO_PIN (24UL) |
SDCard serial data out (DO) pin.
#define SDC_MOSI_PIN (23UL) |
SDCard serial data in (DI) pin.
#define SDC_SCK_PIN (25UL) |
SDCard serial clock (SCK) pin.
#define TEST_STRING "SD card test string." |
void closeFile | ( | ) |
Close open file.
uint32_t countMissionLog | ( | void | ) |
count the number of log files stored on SD card
<Highest integer number is the latest created Log file
void createMissionLog | ( | ) |
Create log file named one integer higher than the last log file.
<Open missionLog directory
<and count the number of Log files.
<Create a new Log filename as one integer value higher than the previous Log file.
<update latest create log file
<Number of log files increased by one
Delete one log file.
From menu a integer value can be typed in to delete a specific log file
[out] | returnLength | pointer that points to address where length of returnMsg is stored |
[out] | returnMsg | string array to report status after delete operation finished |
Delete one log file.
From menu a integer value can be typed in to delete a specific log file
[in] | filename | integer value for the file to be deleted |
[out] | returnMsg | string array to report status after delete operation finished |
[out] | returnLength | pointer that points to address where length of returnMsg is stored |
uint32_t findLatestMissionLog | ( | ) |
Open missionLog directory and find the highest integer name which is the last created log file - name[integer].txt.
<Highest integer number is the latest created Log file
void lseek | ( | uint32_t | ) |
find a specific line in an open file
[in] | index | Line number to be accessed |
NRF_BLOCK_DEV_SDC_DEFINE | ( | m_block_dev_sdc | , |
NRF_BLOCK_DEV_SDC_CONFIG(SDC_SECTOR_SIZE,) | |||
) |
Open a file with read permission.
[in] | filename | String array containing filename to open |
void openMissionLogDirectory | ( | ) |
Open missionLog directory, and count the number of missionLog files, named [integer].txt.
print content of mission Log directory, as a list of log files, to BLE menu.
[out] | returnMsg | string array containing filename |
[out] | returnLength | pointer to which the length of returnMsg is stored |
Create a queue for trasnfering all log files over BLE.
in order to transfer all log files a queue must be created, initialy intended to sort the queue and transfer new files first though this step is skipped.
[out] | queue | array holding the queue for file transmission |
[out] | totalSize | The total number og bytes that will be transfered is counted and stored in variable pointed to by totalSize pointer. |
open file and read from it.
read data from an already opened file
[out] | text | bytes read from file is stored in address pointed to by text |
[in] | length | Length of text string to be written |
[out] | bytes_read | return pointer to report how many bytes was read |
void SDcardInit | ( | ) |
Initialize SD card and mount disk.
<Highest integer number is the latest created Log file
void unMount | ( | ) |
Unmount SD card.
open file and read from it.
void writeMissionLog | ( | void | ) |
write the mission log structure to a mission log file
Create a string array where each value to be written to file is stored. Then write the string to log file.
write data to an already opened file
[in] | text | text to be written to file |
[in] | length | Length of text string to be written |
[out] | bytes_written | return pointer to report how many bytes was written |
DSTATUS disk_state = STA_NOINIT |
FRESULT f_err_code |
missionLog_t missionLog |
Create mission log instance.