MCU
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ThermistorInterface Class Reference

#include <ThermistorInterface.h>

Collaboration diagram for ThermistorInterface:
Collaboration graph

Public Member Functions

 ThermistorInterface (CANBufferType *msg_output_queue)
 
void update_front_thermistor_readings ()
 
template<typename U >
void enqueue_CAN_front_thermistors (U *structure, uint32_t(*pack_function)(U *, uint8_t *, uint8_t *, uint8_t *))
 
void tick (const AnalogConversion_s &raw_therm_fl, const AnalogConversion_s &raw_therm_fr)
 

Private Member Functions

float convert (int raw)
 

Private Attributes

Thermistors< MCU15_NUM_THERMISTORS_front_thermistors
 
float therm_fl
 
float therm_fr
 
CANBufferType_msg_queue
 

Detailed Description

Definition at line 16 of file ThermistorInterface.h.

Constructor & Destructor Documentation

◆ ThermistorInterface()

ThermistorInterface::ThermistorInterface ( CANBufferType msg_output_queue)

Definition at line 6 of file ThermistorInterface.cpp.

7{
8 _msg_queue = msg_output_queue;
9
10}
CANBufferType * _msg_queue

Member Function Documentation

◆ convert()

float ThermistorInterface::convert ( int  raw)
private

◆ enqueue_CAN_front_thermistors()

template<typename U >
void ThermistorInterface::enqueue_CAN_front_thermistors ( U *  structure,
uint32_t(*)(U *, uint8_t *, uint8_t *, uint8_t *)  pack_function 
)

Definition at line 24 of file ThermistorInterface.cpp.

25{
26 CAN_message_t can_msg;
27 can_msg.id = pack_function(structure, can_msg.buf, &can_msg.len, (uint8_t*) &can_msg.flags.extended);
28 uint8_t buf[sizeof(CAN_message_t)] = {};
29 memmove(buf, &can_msg, sizeof(CAN_message_t));
30 _msg_queue->push_back(buf, sizeof(CAN_message_t));
31}

◆ tick()

void ThermistorInterface::tick ( const AnalogConversion_s &  raw_therm_fl,
const AnalogConversion_s &  raw_therm_fr 
)

Definition at line 33 of file ThermistorInterface.cpp.

35{
36
37 auto fl_channel = _front_thermistors.get(MCU15_THERM_FL_CHANNEL);
38 auto fr_channel = _front_thermistors.get(MCU15_THERM_FR_CHANNEL);
39
40 therm_fl = fl_channel.convert((uint16_t)raw_therm_fl.raw);
41 therm_fr = fr_channel.convert((uint16_t)raw_therm_fr.raw);
43}
const int MCU15_THERM_FR_CHANNEL
const int MCU15_THERM_FL_CHANNEL
Thermistors< MCU15_NUM_THERMISTORS > _front_thermistors

◆ update_front_thermistor_readings()

void ThermistorInterface::update_front_thermistor_readings ( )

Definition at line 13 of file ThermistorInterface.cpp.

14{
15 FRONT_THERMISTORS_t front_thermistors;
16 //scale by 500 for easy packing
17 front_thermistors.thermistor_motor_fl_ro = HYTECH_thermistor_motor_fl_ro_toS(therm_fl);
18 front_thermistors.thermistor_motor_fr_ro = HYTECH_thermistor_motor_fr_ro_toS(therm_fr);
19
20 enqueue_CAN_front_thermistors<FRONT_THERMISTORS_t>(&front_thermistors, &Pack_FRONT_THERMISTORS_hytech);
21}

Member Data Documentation

◆ _front_thermistors

Thermistors<MCU15_NUM_THERMISTORS> ThermistorInterface::_front_thermistors
private

Definition at line 19 of file ThermistorInterface.h.

◆ _msg_queue

CANBufferType* ThermistorInterface::_msg_queue
private

Definition at line 24 of file ThermistorInterface.h.

◆ therm_fl

float ThermistorInterface::therm_fl
private

Definition at line 21 of file ThermistorInterface.h.

◆ therm_fr

float ThermistorInterface::therm_fr
private

Definition at line 22 of file ThermistorInterface.h.


The documentation for this class was generated from the following files: