Asynchronous Secure Digital card (SDC) and MultiMedia card (MMC) library. More...
Data Structures |
|
| struct | sdc_evt_t |
|
SDC event structure.
More...
|
|
| struct | sdc_type_t |
|
SDC type information structure.
More...
|
|
| struct | app_sdc_config_t |
|
SDC configuration structure.
More...
|
|
| struct | app_sdc_info_t |
|
SDC information structure.
More...
|
|
Macros |
|
| #define | SDC_SECTOR_SIZE 512 |
|
Size of a single SD card block in bytes.
|
|
| #define | APP_SDCARD_CONFIG (MOSI_PIN, MISO_PIN, SCK_PIN, CS_PIN) |
Typedefs |
|
| typedef void(* | sdc_event_handler_t )( sdc_evt_t const *p_event) |
|
SDC event handler type.
|
|
Enumerations |
|
| enum |
sdc_result_t
{
SDC_SUCCESS = 0, SDC_ERROR_NOT_RESPONDING , SDC_ERROR_TIMEOUT , SDC_ERROR_NOT_SUPPORTED , SDC_ERROR_COMMUNICATION , SDC_ERROR_DATA , SDC_ERROR_INTERNAL } |
|
SDC operation result.
More...
|
|
| enum |
sdc_evt_type_t
{
SDC_EVT_INIT = 0, SDC_EVT_READ , SDC_EVT_WRITE } |
|
SDC event type.
More...
|
|
| enum |
sdc_version_t
{
SDC_TYPE_UNKNOWN = 0, SDC_TYPE_MMCV3 , SDC_TYPE_SDV1 , SDC_TYPE_SDV2 } |
|
SDC type and version.
More...
|
|
Functions |
|
| ret_code_t | app_sdc_init ( app_sdc_config_t const *const p_config, sdc_event_handler_t event_handler) |
|
Function for initializing the card.
More...
|
|
| ret_code_t | app_sdc_uninit (void) |
|
Function for uninitializing the card.
More...
|
|
| bool | app_sdc_busy_check (void) |
|
Function for retrieving the card busy state.
More...
|
|
| ret_code_t | app_sdc_block_read (uint8_t *p_buf, uint32_t block_address, uint16_t block_count) |
|
Function for reading the data blocks from the card.
More...
|
|
| ret_code_t | app_sdc_block_write (uint8_t const *p_buf, uint32_t block_address, uint16_t block_count) |
|
Function for writing the data blocks to the card.
More...
|
|
| app_sdc_info_t const * | app_sdc_info_get (void) |
|
Function for retrieving the card information structure.
More...
|
|
Detailed Description
Asynchronous Secure Digital card (SDC) and MultiMedia card (MMC) library.
Macro Definition Documentation
| #define APP_SDCARD_CONFIG | ( | MOSI_PIN, | |
| MISO_PIN, | |||
| SCK_PIN, | |||
| CS_PIN | |||
| ) |
Value:
{ \
.mosi_pin = MOSI_PIN, \
.miso_pin = MISO_PIN, \
.sck_pin = SCK_PIN, \
.cs_pin = CS_PIN \
}
Enumeration Type Documentation
| enum sdc_evt_type_t |
| enum sdc_result_t |
SDC operation result.
| enum sdc_version_t |
Function Documentation
| ret_code_t app_sdc_block_read | ( | uint8_t * | p_buf , |
| uint32_t | block_address , | ||
| uint16_t | block_count | ||
| ) |
Function for reading the data blocks from the card.
- Parameters
-
[out] p_buf Pointer to the data buffer. Must not be null. [in] block_address Number of the first block to be read. [in] block_count Number of blocks to read. Must be greater than 0.
- Return values
-
NRF_SUCCESS If block read operation was started succesfully. NRF_ERROR_INVALID_STATE If the card is not initialized. NRF_ERROR_BUSY If there is already an operation active. NRF_ERROR_INVALID_PARAM If invalid parameters were specified.
| ret_code_t app_sdc_block_write | ( | uint8_t const * | p_buf , |
| uint32_t | block_address , | ||
| uint16_t | block_count | ||
| ) |
Function for writing the data blocks to the card.
- Parameters
-
[out] p_buf Pointer to the data to be written. Must not be null. [in] block_address Number of the first block to write. [in] block_count Number of blocks to write. Must be greater than 0.
- Return values
-
NRF_SUCCESS If block write operation was started succesfully. NRF_ERROR_INVALID_STATE If the card is not initialized. NRF_ERROR_BUSY If there is already an operation active. NRF_ERROR_INVALID_PARAM If invalid parameters were specified.
| bool app_sdc_busy_check | ( | void | ) |
Function for retrieving the card busy state.
- Return values
-
true If there is an operation in progress. false If the card is in idle state.
| app_sdc_info_t const* app_sdc_info_get | ( | void | ) |
Function for retrieving the card information structure.
- Returns
- Pointer to the card information structure or NULL if card is not initialized.
| ret_code_t app_sdc_init | ( | app_sdc_config_t const *const | p_config , |
| sdc_event_handler_t | event_handler | ||
| ) |
Function for initializing the card.
- Parameters
-
[in] p_config Pointer to the SDC configuration structure. [in] event_handler Pointer to the event handler function.
- Return values
-
NRF_SUCCESS If initialization process was started succesfully. NRF_ERROR_INVALID_STATE If the card is already initialized or the initialization is in progress. NRF_ERROR_INVALID_PARAM If invalid parameters were specified.
| ret_code_t app_sdc_uninit | ( | void | ) |
Function for uninitializing the card.
- Return values
-
NRF_SUCCESS If card was uninitialized succesfully. NRF_ERROR_INVALID_STATE If the card is not initialized. NRF_ERROR_BUSY If there is an operation in progress.