Contiki 2.5
|
Files | |
file | flash-microSD.c |
MicroSD Card interface implementation | |
file | flash-microSD.h |
MicroSD Card interface definitions | |
Macros | |
#define | MICRO_SD_CS 5 |
Functions | |
uint8_t | microSD_init (void) |
Powers on and initialize the microSD / SD-Card. More... | |
uint8_t | microSD_read_block (uint32_t addr, uint8_t *buffer) |
This function will read one block (512Byte) of the SD-Card. More... | |
uint8_t | microSD_write_block (uint32_t addr, uint8_t *buffer) |
This function will write one block (512Byte) of the SD-Card. More... | |
uint8_t | microSD_write_cmd (uint8_t *cmd) |
This function sends a command via SPI to the SD-Card. More... | |
Huge memory space is always nice to have, because you don't have to decide which data has to be stored, just store everything! Furthermore you can buffer your data, whenever wireless connection breaks down. An easy and modular way is a SD card. For smaller applications (like sensor nodes), the tiny version "microSD" would be the best choice. Both, the "big" SD-Cards and the microSD-Cards can be interfaced by SPI and use the same Instruction set, so this interface can be used for both SD-Card types.
#define MICRO_SD_CS 5 |
SPI device order. The chip select number where the microSD-Card is connected to the BCD-decimal decoder
Definition at line 68 of file flash-microSD.h.
Referenced by microSD_init(), microSD_read_block(), microSD_write_block(), and microSD_write_cmd().
uint8_t microSD_init | ( | void | ) |
Powers on and initialize the microSD / SD-Card.
Definition at line 45 of file flash-microSD.c.
References MICRO_SD_CS, microSD_write_cmd(), MSPI_BAUD_MAX, mspi_chip_release(), mspi_chip_select(), mspi_init(), MSPI_MODE_0, and mspi_transceive().
uint8_t microSD_read_block | ( | uint32_t | addr, |
uint8_t * | buffer | ||
) |
This function will read one block (512Byte) of the SD-Card.
addr | Block address |
*buffer | Pointer to a block buffer |
Definition at line 95 of file flash-microSD.c.
References MICRO_SD_CS, microSD_write_cmd(), mspi_chip_release(), and mspi_transceive().
uint8_t microSD_write_block | ( | uint32_t | addr, |
uint8_t * | buffer | ||
) |
This function will write one block (512Byte) of the SD-Card.
addr | Block address |
*buffer | Pointer to a block buffer |
Definition at line 137 of file flash-microSD.c.
References MICRO_SD_CS, microSD_write_cmd(), mspi_chip_release(), and mspi_transceive().
uint8_t microSD_write_cmd | ( | uint8_t * | cmd | ) |
This function sends a command via SPI to the SD-Card.
An SPI command consists off 6 bytes
*cmd | Pointer to the command array |
Definition at line 191 of file flash-microSD.c.
References MICRO_SD_CS, mspi_chip_release(), mspi_chip_select(), and mspi_transceive().
Referenced by microSD_init(), microSD_read_block(), and microSD_write_block().