mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/CAN-Demo.git
synced 2025-08-05 21:59:42 +00:00
[untested] Rudeimentary demo for EGSE on TACOS
This commit is contained in:
@@ -26,10 +26,9 @@
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
//#include <sta/devices/stm32/can.hpp>
|
||||
extern void testCan(CAN_HandleTypeDef * handle);
|
||||
extern void testCanMsg(CAN_HandleTypeDef * handle, uint8_t payload[8]);
|
||||
extern void unpackValues(uint8_t packedByte, uint8_t* type_id, uint8_t* sensor_ID, uint8_t* value, uint8_t* include);
|
||||
extern uint8_t packValues(uint8_t type_id, uint8_t sensor_ID, uint8_t value, uint8_t include);
|
||||
//extern void testCan(CAN_HandleTypeDef * handle);
|
||||
//extern void testCanMsg(CAN_HandleTypeDef * handle, uint8_t payload[8]);
|
||||
//extern uint8_t packValues(uint8_t type_id, uint8_t sensor_ID, uint8_t value, uint8_t include);
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -208,15 +207,19 @@ void SystemClock_Config(void)
|
||||
|
||||
/* USER CODE BEGIN 4 */
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan1)
|
||||
{
|
||||
|
||||
HAL_GPIO_TogglePin(GPIOD,GPIO_PIN_8);
|
||||
received = 1;
|
||||
|
||||
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[0], &type_id, &sensor_ID, &value, &include);
|
||||
|
||||
@@ -226,7 +229,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan1)
|
||||
}else{
|
||||
HAL_GPIO_WritePin(GPIOD,GPIO_PIN_8, GPIO_PIN_SET);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user