CLS Lib for interaction with the CLS network
This commit is contained in:
@@ -6,13 +6,6 @@
|
||||
osTimerId_t CLS_HeatbeatTimerId; // Timer ID
|
||||
|
||||
|
||||
static const CLSAddress address = {
|
||||
.code = CLS_CODE_STATUS,
|
||||
.device = CLS_DEVICE,
|
||||
.channel = CLS_CH_STA_HEATBEAT,
|
||||
};
|
||||
|
||||
|
||||
static uint8_t cls_hartbeat_counter = 0;
|
||||
static FDCAN_TxHeaderTypeDef cls_hartbeat_header = {
|
||||
.IdType = FDCAN_STANDARD_ID,
|
||||
@@ -25,12 +18,20 @@ static FDCAN_TxHeaderTypeDef cls_hartbeat_header = {
|
||||
.TxEventFifoControl = FDCAN_NO_TX_EVENTS,
|
||||
.MessageMarker = 0xCC,
|
||||
};
|
||||
|
||||
uint8_t TxData[8];
|
||||
FDCAN_TxHeaderTypeDef TxHeader;
|
||||
|
||||
void CLS_Heatbeat(void *argument) {
|
||||
// Code to be executed every 500ms
|
||||
cls_hartbeat_counter++;
|
||||
HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &cls_hartbeat_header, &cls_hartbeat_counter);
|
||||
if (HAL_FDCAN_GetTxFifoFreeLevel(&hfdcan1) > 1){
|
||||
HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &cls_hartbeat_header, &cls_hartbeat_counter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CLS_Init(void) {
|
||||
osTimerAttr_t timerAttr;
|
||||
timerAttr.name = "CLS_Heatbeat";
|
||||
|
||||
Reference in New Issue
Block a user