|
ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
|
MicroSD interface for the esp32. More...
Functions | |
| uint32_t | ControllerMicroSDSave (const uint8_t *data, const uint16_t num_bytes) |
| Save data to the microSD card. Appends data to already-created files, otherwise creates a new file. | |
| uint32_t | ControllerMicroSDUserConfig (UserConfiguration *uc, const char *filename) |
| Send the UserConfig to the ESP32 and saves a file on the microSD with the UserConfig contents. | |
| uint32_t | ControllerMicroSDLog (const char *msg, const char *base) |
| Append a line of plain text to the log file on the microSD card. | |
MicroSD interface for the esp32.
The MicroSDCommand message is used to control the microSD card connected to the esp32 module's SPI.
| uint32_t ControllerMicroSDLog | ( | const char * | msg, |
| const char * | base | ||
| ) |
Append a line of plain text to the log file on the microSD card.
Unlike ControllerMicroSDSave(), the payload is not a Measurement, so no UserConfig has to be sent first to open a data file. The esp32 appends the line to a fixed log file.
Intended to back a microlog output handler, see ulog_output_add().
| msg | Null terminated string. Truncated to fit MicroSDCommand.log. |
| base | Base filename that boot index and extension get appended. |
Definition at line 155 of file microsd.c.
References CONTROLLER_SUCCESS, ControllerRx(), ControllerTransaction(), ControllerTx(), Buffer::data, DecodeEsp32Command(), EncodeMicroSDCommand(), Buffer::len, and Buffer::size.
| uint32_t ControllerMicroSDSave | ( | const uint8_t * | data, |
| const uint16_t | num_bytes | ||
| ) |
Save data to the microSD card. Appends data to already-created files, otherwise creates a new file.
| data | An array of data bytes. This data must be a protobuf-encoded (serialized) Measurement. |
| num_bytes | The number of bytes to be written. |
Definition at line 12 of file microsd.c.
References CONTROLLER_SUCCESS, ControllerRx(), ControllerTransaction(), ControllerTx(), data, Buffer::data, DecodeEsp32Command(), DecodeMeasurement(), EncodeMicroSDCommand(), Buffer::len, and Buffer::size.
Referenced by measure_sensor().
| uint32_t ControllerMicroSDUserConfig | ( | UserConfiguration * | uc, |
| const char * | filename | ||
| ) |
Send the UserConfig to the ESP32 and saves a file on the microSD with the UserConfig contents.
| uc | UserConfig to be encoded and sent. |
| filename | Filename (limited to 256 characters) |
Definition at line 80 of file microsd.c.
References CONTROLLER_SUCCESS, ControllerRx(), ControllerTransaction(), ControllerTx(), Buffer::data, DecodeEsp32Command(), EncodeMicroSDCommand(), epoch(), filename, Buffer::len, and Buffer::size.