-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from hytech-racing/ThermistorCAN
Added thermistors
- Loading branch information
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
#include <string.h> | ||
#include <stdint.h> | ||
|
||
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include <string.h> | ||
#include <stdint.h> | ||
|
||
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
|
||
#include <string.h> | ||
#include <stdint.h> | ||
|
||
#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) |