SD CARD
SD/MMC-Card Reader | |
---|---|
Status | Stable
|
menuconfig | I/O->SD/MMC-Card Reader |
Pinning | yes |
Ecmd | yes |
Control6 | yes |
Depends on | ECMD |
Code | https://github.com/ethersex/ethersex/tree/master/hardware/storage/sd_reader |
The module is based on Roland Riegel's MMC/SD/SDHC card library complemented by the connection to the Ethersex Virtual File System.
Contents
Connection
Configuration
| | I/O ---> | | ... │ │ Storage ---> │ │ ... | | [*] SD/MMC-Card Reader ---> | | ... | | [ ] SDHC support | | | | [*] VFAT LFN support | | | | [ ] Read-only mode | | | | [*] Use read-timeout | | | | [*] Ping-read SD card every 10s | | | | --- ECMD Support | | | | [*] info | | | | [*] dir | | | | [*] mkdir | | | | [*] rm | | | | --- Debugging Flags | | | | [*] FAT | | | | [*] RAW | | | | [*] VFS | | | | General Setup ---> | | ... | | [*] VFS (Virtual File System) support ---> | | ... | | [*] SD/MMC-Card Filesystem | |
ECMD
IRMP implements an ECMD interface. See ECMD reference.
Control6
The following example writes the date, time and temperature by VFS_LOG_ALLOCA (VFS_LOG requires UIP) in the file "temp.log" as soon as the temperature has changed by more than a degree to the last measurement. For date and time CLOCK_SUPPORT must be enabled.
#include <stdlib.h> int16_t Temperatur; int16_t Temperatur_alt; CONTROL_START THREAD(read_temp) Temperatur = ONEWIRE_GET(10d85594010800eb); ON abs(Temperatur-Temperatur_alt)>10 DO uint8_t sign = Temperatur<0; div_t res = div(abs(Temperatur),10); VFS_LOG_ALLOCA("temp.log", 50, "%2d.%2d.%4d %2d:%02d %S%d.%d", CLOCK_DAY, CLOCK_MONTH, CLOCK_YEAR, CLOCK_HOUR, CLOCK_MIN, sign?PSTR("-"):PSTR(""),res.quot,res.rem) Temperatur_alt = Temperatur; END WAIT(15); THREAD_END(read_temp) ON STARTUP DO Temperatur = Temperatur_alt = 0; THREAD_START(read_temp); END CONTROL_END