-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDataSaverSDSerial.h
More file actions
43 lines (34 loc) · 1.46 KB
/
DataSaverSDSerial.h
File metadata and controls
43 lines (34 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef DATA_SAVER_SD_SERIAL_H
#define DATA_SAVER_SD_SERIAL_H
#include <array>
#include <cstdlib>
#include "ArduinoHAL.h"
#include "data_handling/DataPoint.h"
#include "data_handling/DataSaver.h"
/**
* @brief IDataSaver implementation that streams CSV packets over UART.
* @note When to use: log data to an external serial data logger when file
* systems (SD/SPI flash) are unavailable or you need live passthrough.
*/
class DataSaverSDSerial: public IDataSaver {
// Given data points, will write the data over uart to a serial data logger
public:
/**
* @brief Create a saver that streams CSV over UART to an external data logger.
* @param SD_serial Hardware serial interface connected to the logger.
* @note When to use: quick logging to a serial-equipped recorder when
* file systems are unavailable.
*/
DataSaverSDSerial(HardwareSerial &sdSerial);
using IDataSaver::saveDataPoint; // Allow the use of the other saveDataPoint overload
/**
* @brief Write a timestamped value to the serial logger.
* @param dataPoint Data point to transmit.
* @param name 8-bit channel identifier transmitted alongside data.
* @note When to use: continuous logging after the external logger is ready.
*/
virtual int saveDataPoint(const DataPoint& dataPoint, uint8_t name) override;
private:
HardwareSerial &sdSerial_;
};
#endif