Send error codes to interface chip

This commit is contained in:
jazzpi
2022-07-25 20:05:47 +02:00
parent 8cf15685b8
commit eaf86ff0ce
5 changed files with 10 additions and 27 deletions

View File

@ -11,6 +11,8 @@
#include "stm32g4xx_hal_fdcan.h"
#include <string.h>
// 3 should be programmed with CAN id 2
// const uint16_t slave_CAN_id_to_slave_index[7] = {
// 255, 255, 0, 255, 255, 255, 1}; // TODO: Make this pretty pls
@ -68,16 +70,9 @@ uint8_t CAN_Receive(FDCAN_HandleTypeDef* hcan) {
} else if (rxFrame.FrameID == SLAVE_EMERGENCY_ADDRESS) {
AMSErrorHandle errorframe = {0};
errorframe.errorcode = SlavesErrorFrameError;
errorframe.errorarg[0] = rxFrame.data[0];
errorframe.errorarg[1] = rxFrame.data[1];
errorframe.errorarg[2] = rxFrame.data[2];
errorframe.errorarg[3] = rxFrame.data[3];
errorframe.errorarg[4] = rxFrame.data[4];
errorframe.errorarg[5] = rxFrame.data[5];
errorframe.errorarg[6] = rxFrame.data[6];
errorframe.errorarg[7] = rxFrame.data[7];
memcpy(errorframe.errorarg, rxFrame.data, 7);
AMS_Error_Handler(errorframe);
AMS_Error_Handler(&errorframe);
}
}