forked from ejoerns/contiki-inga
-
Notifications
You must be signed in to change notification settings - Fork 13
microSD Card Reader
ejoerns edited this page Nov 15, 2013
·
5 revisions
INGA provides a microSD card reader that can be used to store sensor data, share configuration data or setup encryption keys.
The sd card can be powered on and off completely to save energy.
The diskio
abstraction layer provides simple blockwise access to the card.
Based on this, support for the common FAT16/32
file system and the Contiki file system COFFEE
is implemented.
To use the sd card you have to power it on first of all.
SDCARD_POWER_ON();
Note: In INGA version 1.4 it is not possible to access both the accelerometer and the SD card interface simultaneously. The microSD card needs to be powered off to be able to read accelerometer measurements.
Then you can use the diskio layer to check if a card is available and detect available partitions.
// detect available devices
diskio_detect_devices();
// get pointer to device list
struct diskio_device_info *info = diskio_devices();
// search for the first partition
for (i = 0; i < DISKIO_MAX_DEVICES; i++) {
// break if we have found an SD card partition
if ((info + i)->type == (DISKIO_DEVICE_TYPE_SD_CARD | DISKIO_DEVICE_TYPE_PARTITION)) {
info += i;
break;
}
}