diff --git a/Libraries/HyTech_CAN/MCU_thermistors.h b/Libraries/HyTech_CAN/MCU_thermistors.h new file mode 100644 index 00000000..6afd28cd --- /dev/null +++ b/Libraries/HyTech_CAN/MCU_thermistors.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +#pragma pack(push,1) + +// @Parseclass +class MCU_thermistors { +public: + MCU_thermistors() = default; + MCU_thermistors(const uint8_t buf[8]) { load(buf); } + + inline void load(const uint8_t buf[]) { memcpy(this, buf, sizeof(*this)); } + inline void write(uint8_t buf[]) const { memcpy(buf, this, sizeof(*this)); } + + // Getters + inline uint16_t get_thermistor1() const { return thermistor1; } + inline uint16_t get_thermistor2() const { return thermistor2; } + + // Setters + inline void set_thermistor1(const uint16_t value) { this->thermistor1 = value; } + inline void set_thermistor2(const uint16_t value) { this->thermistor2 = value; } + +private: + uint16_t thermistor1; //front left thermistor + uint16_t thermistor2; //front right thermistor +}; + +#pragma pack(pop) diff --git a/Libraries/HyTech_CAN/SAB_thermistors_1.h b/Libraries/HyTech_CAN/SAB_thermistors_1.h new file mode 100644 index 00000000..cbaa67cd --- /dev/null +++ b/Libraries/HyTech_CAN/SAB_thermistors_1.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include + +#pragma pack(push,1) + +// @Parseclass +class SAB_thermistors_1 { +public: + SAB_thermistors_1() = default; + SAB_thermistors_1(const uint8_t buf[8]) { load(buf); } + + inline void load(const uint8_t buf[]) { memcpy(this, buf, sizeof(*this)); } + inline void write(uint8_t buf[]) const { memcpy(buf, this, sizeof(*this)); } + + // Getters + inline uint16_t get_thermistor3() const { return thermistor3; } + inline uint16_t get_thermistor4() const { return thermistor4; } + inline uint16_t get_thermistor5() const { return thermistor5; } + inline uint16_t get_thermistor6() const { return thermistor6; } + + // Setters + inline void set_thermistor3(const uint16_t value) { this->thermistor3 = value; } + inline void set_thermistor4(const uint16_t value) { this->thermistor4 = value; } + inline void set_thermistor5(const uint16_t value) { this->thermistor5 = value; } + inline void set_thermistor6(const uint16_t value) { this->thermistor6 = value; } + +private: + //no free bytes + uint16_t thermistor3; //center front left thermistor + uint16_t thermistor4; //center front right thermistor + uint16_t thermistor5; //center rear left thermistor + uint16_t thermistor6; //center rear right thermistor +}; + +#pragma pack(pop) diff --git a/Libraries/HyTech_CAN/SAB_thermistors_2.h b/Libraries/HyTech_CAN/SAB_thermistors_2.h new file mode 100644 index 00000000..89995f24 --- /dev/null +++ b/Libraries/HyTech_CAN/SAB_thermistors_2.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include + +#pragma pack(push,1) + +// @Parseclass +class SAB_thermistors_2 { +public: + SAB_thermistors_2() = default; + SAB_thermistors_2(const uint8_t buf[8]) { load(buf); } + + inline void load(const uint8_t buf[]) { memcpy(this, buf, sizeof(*this)); } + inline void write(uint8_t buf[]) const { memcpy(buf, this, sizeof(*this)); } + + // Getters + inline uint16_t get_thermistor7() const { return thermistor7; } + inline uint16_t get_thermistor8() const { return thermistor8; } + inline uint16_t get_thermistor9() const { return thermistor9; } + + // Setters + inline void set_thermistor7(const uint16_t value) { this->thermistor7 = value; } + inline void set_thermistor8(const uint16_t value) { this->thermistor8 = value; } + inline void set_thermistor9(const uint16_t value) { this->thermistor9 = value; } + +private: + //no free bytes + uint16_t thermistor7; //rear forward thermistor (on left side) + uint16_t thermistor8; //rear left thermistor + uint16_t thermistor9; //rear right thermistor +}; + +#pragma pack(pop)