Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
logging.h
Go to the documentation of this file.
1#ifndef LOGGING_H
2#define LOGGING_H
3
4#include <SD.h>
5#include <FlexCAN_T4.h>
6#include <SPI.h>
7
8#define PIN_SPI_CLK 45
9#define PIN_SPI_MOSI 43
10#define PIN_SPI_MISO 42
11#define PIN_SD_CS 44
12// If you have connected other SPI device then
13// put here number of pin for disable its.
14// Provide -1 if you don't have other devices.
15#define PIN_OTHER_DEVICE_CS -1
16// Change this value if you have problems with SD card
17// Available values: SPI_QUARTER_SPEED //SPI_HALF_SPEED
18// It is enum from SdFat
19#define SD_CARD_SPEED SPI_FULL_SPEED
20
21#define BMS_ID 0x666
22#define BAMO_RESPONSE_ID 0x181
23#define LOGGING_PERIOD 10
24
25
27{
28 int year;
29 int month;
30 int day;
31 int hour;
32 int minute;
33 int second;
34 uint32_t millisecond;
35};
36
37
38class Logging {
39
40 public:
41 void write_to_file(int current, int voltage, int mintmp, int maxtmp, int avgtmp, int apps1, int apps2, int brake, int rpm, int I_actual, int powerStageTmp, int motorTmp, int Torque, int motor_voltage, int battery_voltage);
42 void setup_log();
43
44 private:
45
46};
47
48#endif
int voltage
Definition main.cpp:60
int I_actual
Definition main.cpp:70
int avgtmp
Definition main.cpp:63
int apps2
Definition main.cpp:65
int battery_voltage
Definition main.cpp:78
int motor_voltage
Definition main.cpp:77
int brake
Definition main.cpp:66
int current
Definition main.cpp:59
int mintmp
Definition main.cpp:61
int maxtmp
Definition main.cpp:62
int apps1
Definition main.cpp:64
int rpm
Definition display.cpp:11
void write_to_file(int current, int voltage, int mintmp, int maxtmp, int avgtmp, int apps1, int apps2, int brake, int rpm, int I_actual, int powerStageTmp, int motorTmp, int Torque, int motor_voltage, int battery_voltage)
Definition logging.cpp:90
void setup_log()
Definition logging.cpp:56
Definition logging.h:27
int day
Definition logging.h:30
int month
Definition logging.h:29
int second
Definition logging.h:33
uint32_t millisecond
Definition logging.h:34
int minute
Definition logging.h:32
int year
Definition logging.h:28
int hour
Definition logging.h:31