63 lines
1.3 KiB
C++
63 lines
1.3 KiB
C++
#define ever (;;)
|
|
|
|
#include <cstdio>
|
|
|
|
#include "posix_io.h"
|
|
#include "uart_rp2350.h"
|
|
#include "lib/rtlf.h"
|
|
#include "lib/sd_reader.h"
|
|
|
|
[[noreturn]]
|
|
int main() {
|
|
uart_rp2350 uart;
|
|
|
|
posix_io::inst.register_stdin(uart);
|
|
posix_io::inst.register_stdout(uart);
|
|
posix_io::inst.register_stderr(uart);
|
|
|
|
printf("Mount SD-Card\n");
|
|
|
|
SD_Reader reader;
|
|
|
|
printf("Creating file\n");
|
|
|
|
RTLF_Context* rtlf_ctx = rtlf_open_write("test.rtl", 2, "Nürburgring");
|
|
|
|
printf("Writing to file\n");
|
|
|
|
RTLF_Data_Record data_record_1 = {
|
|
.timestamp = 1672531200,
|
|
.gps_long = -122.4194,
|
|
.gps_lat = 37.7749,
|
|
.facing_x = 0.866,
|
|
.facing_y = 0.5,
|
|
.facing_z = 0.0,
|
|
.acceleration_x = 1.2,
|
|
.acceleration_y = 0.0,
|
|
.acceleration_z = -9.81,
|
|
.speed = 15.5
|
|
};
|
|
|
|
RTLF_Data_Record data_record_2 = {
|
|
.timestamp = 1672983570,
|
|
.gps_long = -122.4594,
|
|
.gps_lat = 37.7449,
|
|
.facing_x = 0.746,
|
|
.facing_y = 0.44,
|
|
.facing_z = 0.0,
|
|
.acceleration_x = 1.3,
|
|
.acceleration_y = 0.0,
|
|
.acceleration_z = -9.81,
|
|
.speed = 15.9
|
|
};
|
|
|
|
rtlf_write_record(rtlf_ctx, &data_record_1);
|
|
rtlf_write_record(rtlf_ctx, &data_record_2);
|
|
|
|
printf("Close connection\n");
|
|
|
|
rtlf_close(rtlf_ctx);
|
|
|
|
printf("Done\n");
|
|
}
|