mv-bms/Core/Src/can.c
2024-05-24 15:21:29 +02:00

28 lines
661 B
C

/*
* can.c
* Created on: Mai 23, 2024
* Author: Hamza
*/
#include "can.h"
#include "AMS_HighLevel.h"
#include "TMP1075.h"
#include "can-halal.h"
#include <stdint.h>
void can_init(CAN_HandleTypeDef* hcan) { ftcan_init(hcan); }
/*
This function sends the status of the mvbms, the battery and of powerground.
once every 1s in states: INACTIVE, PRECHARGE, DISCHARGE, CHARGING, ERROR.
once every 0.5s in states: READY, ACTIVE.
with format of:
*/
void can_handle_send_status() {
static uint8_t data[8];
data[0] = state. (sm_get_state_code() << 5); //save 5 bit since codes are from 0-6
//ftcan_transmit(id, data, sizeof(data));
}