mirror of
https://github.com/adrigongv23/G26---Telemetry-Software.git
synced 2026-08-25 11:33:17 +02:00
Archivos iniciales añadidos
This commit is contained in:
parent
7b2267494e
commit
dd67d2afdd
8 changed files with 805 additions and 0 deletions
49
Firmware/G26-Telemetria/include/can.hpp
Normal file
49
Firmware/G26-Telemetria/include/can.hpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef CAN_HPP
|
||||
#define CAN_HPP
|
||||
|
||||
#define RX_PIN 13
|
||||
#define TX_PIN 38
|
||||
#define POLLING_RATE_MS 1000
|
||||
#define TRANSMIT_RATE_MS 1000
|
||||
|
||||
#include "driver/twai.h"
|
||||
#include "common_libraries.hpp"
|
||||
#include "data_processor.hpp"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
class CAN {
|
||||
public:
|
||||
CAN(): _mutex(xSemaphoreCreateMutex()), _listen_task_handle(NULL), _should_stop_listening(false) {}
|
||||
~CAN();
|
||||
void start();
|
||||
void listen();
|
||||
void start_listening_task();
|
||||
void stop_listening_task();
|
||||
void send_frame(twai_message_t message);
|
||||
twai_message_t createBoolMessage(bool b0, bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7);
|
||||
|
||||
void set_data_proccessor(DataProcessor *data_processor) {
|
||||
_data_processor = data_processor;
|
||||
}
|
||||
|
||||
SemaphoreHandle_t get_mutex() {
|
||||
return _mutex;
|
||||
}
|
||||
|
||||
static void listenTask(void *arg) {
|
||||
CAN *controller = static_cast<CAN*>(arg);
|
||||
controller->listen();
|
||||
}
|
||||
|
||||
private:
|
||||
twai_message_t _rx_message;
|
||||
DataProcessor *_data_processor;
|
||||
SemaphoreHandle_t _mutex;
|
||||
TaskHandle_t _listen_task_handle;
|
||||
volatile bool _should_stop_listening;
|
||||
int test = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
22
Firmware/G26-Telemetria/include/common_libraries.hpp
Normal file
22
Firmware/G26-Telemetria/include/common_libraries.hpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef COMMON_LIBRARIES_HPP
|
||||
#define COMMON_LIBRARIES_HPP
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "time.h"
|
||||
#include <ArduinoJson.h>
|
||||
#include <vector>
|
||||
|
||||
//Librerías WiFi y HTTP ---
|
||||
#include <WiFi.h>
|
||||
#include <HTTPClient.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
|
||||
// --- CONFIGURACIÓN WIFI Y FIREBASE ---
|
||||
#define WIFI_SSID "test"
|
||||
#define WIFI_PASSWORD "12345678"
|
||||
|
||||
#define FIREBASE_HOST "https://iot-formula-gades-default-rtdb.europe-west1.firebasedatabase.app"
|
||||
// La ruta dentro de la base de datos donde guardaremos la temperatura
|
||||
#define FIREBASE_PATH "/telemetria/temperatura.json"
|
||||
|
||||
#endif
|
||||
33
Firmware/G26-Telemetria/include/data_processor.hpp
Normal file
33
Firmware/G26-Telemetria/include/data_processor.hpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef DATAPROCESSOR_HPP
|
||||
#define DATAPROCESSOR_HPP
|
||||
|
||||
#include "common_libraries.hpp"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
|
||||
class DataProcessor {
|
||||
public:
|
||||
DataProcessor() = default;
|
||||
|
||||
//Variable publica para el CAN
|
||||
volatile int current_ect_value = 0;
|
||||
|
||||
//Métodos de recepción de CAN
|
||||
|
||||
void send_serial_frame_0(int rpmh, int rpml, int tpsh, int tpsl, int ecth, int ectl, int gear);
|
||||
//void send_serial_frame_1(int lfws, int rfws, int lrws, int rrws, int maph, int mapl, int ect);
|
||||
//void send_serial_frame_2(int lambh, int lambl, int lamth, int lamtl, int bvolth, int bvoltl, int iat);
|
||||
//void send_serial_frame_3(int aux1, int aux2, int aux3, int aux4, int aux5, int aux6, int aux7);
|
||||
//void send_serial_frame_4(int aux1, int aux2, int aux3, int aux4, int aux5, int aux6, int aux7);
|
||||
|
||||
|
||||
//Métodos extras
|
||||
void send_serial(byte type, unsigned int value);
|
||||
|
||||
char* process(std::vector<float> data);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue