From 98ecffac4826784de5aa9d5f9d45cb4259441590 Mon Sep 17 00:00:00 2001 From: CarlWachter Date: Sun, 10 Dec 2023 13:29:48 +0100 Subject: [PATCH] Formtatting of messages added --- App/Src/test.cpp | 4 ++-- Core/Src/main.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/App/Src/test.cpp b/App/Src/test.cpp index 2a2e857..3aa6a25 100644 --- a/App/Src/test.cpp +++ b/App/Src/test.cpp @@ -52,14 +52,14 @@ } - void unpackValues(uint8_t packedByte, uint8_t* type_id, uint8_t* sensor_ID, uint8_t* value, uint8_t* include) { + extern "C" void unpackValues(uint8_t packedByte, uint8_t* type_id, uint8_t* sensor_ID, uint8_t* value, uint8_t* include) { *type_id = (packedByte >> 6) & 0x03; // Extracting two bits for type_id *sensor_ID = (packedByte >> 3) & 0x07; // Extracting three bits for sensorID *include = (packedByte >> 2) & 0x01; // Extracting the flag for included value *value = (packedByte >> 1) & 0x01; // Extracting one bit for value } - uint8_t packValues(uint8_t type_id, uint8_t sensor_ID, uint8_t value, uint8_t include) { + extern "C" uint8_t packValues(uint8_t type_id, uint8_t sensor_ID, uint8_t value, uint8_t include) { uint8_t packedByte = 0; // Shifting and ORing the values diff --git a/Core/Src/main.c b/Core/Src/main.c index 3551411..8086b22 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -327,9 +327,9 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan1) HAL_CAN_GetRxMessage(hcan1, CAN_RX_FIFO0, &rxHeader, canRX); - /*uint8_t type_id, sensor_ID, value, include; + uint8_t type_id, sensor_ID, value, include; - unpackValues(canRX, *type_id, *sensor_ID, *value, *include); + unpackValues(canRX[0], &type_id, &sensor_ID, &value, &include); if (type_id == 0 && sensor_ID == 1){ if (value == 0){ @@ -337,7 +337,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan1) }else{ HAL_GPIO_WritePin(GPIOD,GPIO_PIN_8, GPIO_PIN_SET); } - }*/ + } }