43 lines
1.4 KiB
C
43 lines
1.4 KiB
C
//
|
|
// Created by enik on 03.04.23.
|
|
//
|
|
|
|
#ifndef BMS_V3_CAN_MESSENGER_H
|
|
#define BMS_V3_CAN_MESSENGER_H
|
|
|
|
#include <stdbool.h>
|
|
#include "../Core/Inc/main.h"
|
|
|
|
/**
|
|
* @brief CAN BMS ID description enum
|
|
*/
|
|
typedef enum CAN_BMS_ID {
|
|
CAN_BMS_HEARTBEAT = 0x500U, ///< [BMS->Charger][RTR] Heartbeat
|
|
CAN_BMS_STATUS = 0x501U, ///< [BMS->Charger][L:7] Status packet
|
|
CAN_BMS_THRESH_REQ = 0x502U, ///< [Charger->BMS][RTR] Threshold request
|
|
CAN_BMS_VOLT_THRESH = 0x503U, ///< [BMS->Charger][L:8] Voltage threshold
|
|
CAN_BMS_VOLT_ALARM = 0x504U, ///< [BMS->Charger][L:8] Voltage alarm
|
|
CAN_BMS_CURRENT = 0x505U, ///< [BMS->Charger][L:6] Current control
|
|
CAN_BMS_ACT_REQ = 0x506U, ///< [Charger->BMS][RTR] Active values request
|
|
CAN_BMS_ACT_VAL = 0x507U, ///< [BMS->Charger][L:6] Active values
|
|
} CAN_BMS_ID;
|
|
|
|
void can_msgr_init();
|
|
|
|
void can_set_dummy_soc(void);
|
|
bool get_dummy_soc(void);
|
|
|
|
void transmitCan1Packet();
|
|
int getIndexBySoc();
|
|
int getIndexByTemperature();
|
|
void transmitCan2Packet();
|
|
void addCanPacketToQueue(uint16_t id, uint8_t len, uint8_t *data, uint8_t *queue, uint16_t *queueSize);
|
|
//void transmitCanPacketFromQueue(uint8_t* queue, uint16_t* queueSize, CAN_HandleTypeDef* hcan);
|
|
|
|
void transmitCanPacketFromQueueCan1(void);
|
|
void transmitCanPacketFromQueueCan2(void);
|
|
|
|
void can2_receive_from_irq(CAN_RxHeaderTypeDef *hdr, uint8_t* data);
|
|
|
|
#endif //BMS_V3_CAN_MESSENGER_H
|