Минорные изменения
This commit is contained in:
@@ -278,10 +278,10 @@ PROTOCAN_INIT_StatusTypeDef PROTOCAN_INIT(CAN_HandleTypeDef *tmp_hcan,
|
||||
RTC_HandleTypeDef *tmp_hrtc,
|
||||
TIM_HandleTypeDef *tmp_tim);
|
||||
void PROTOCAN_DEINIT(uint8_t stage);
|
||||
void ProtoCanPulseCallback(TIM_HandleTypeDef *htim);
|
||||
void ProtoCanRxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan);
|
||||
void PROTOCAN_FILTERS(void);
|
||||
void PROTOCAN_LOOP(void);
|
||||
void ProtoCanPulseCallback(TIM_HandleTypeDef *htim);
|
||||
void ProtoCanRxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan);
|
||||
|
||||
HAL_StatusTypeDef PROTOCAN_AnalogProcessing(struct RXMsg _rxMsg);
|
||||
HAL_StatusTypeDef ProtoCanMsgToAnalogUniversal(struct RXMsg _rxMsg);
|
||||
|
||||
@@ -637,12 +637,17 @@ void PROTOCAN_GeneralAddressSpace_Answer(struct RXMsg _rxMsg)
|
||||
data[1] = 'A';
|
||||
data[2] = 'S';
|
||||
data[3] = '-';
|
||||
for(int i = 0; i < 4; i++) {
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
unsigned sym = (_rxMsg.eID.Fields.MsgBody>>(12-(i*4)))&0xF;
|
||||
if(sym >= 10)
|
||||
{
|
||||
data[4+i] = sym%10+'A';
|
||||
}
|
||||
else
|
||||
{
|
||||
data[4+i] = sym+'0';
|
||||
}
|
||||
}
|
||||
HAL_CAN_AddTxMessage(_HCAN, &TxHeader, data, &TxMailBox);
|
||||
}
|
||||
@@ -931,7 +936,8 @@ void ProtoCanPulseCallback(TIM_HandleTypeDef *htim)
|
||||
PulseStage++;
|
||||
unsigned int debugID;
|
||||
debugID = currentID.BitAll;
|
||||
if(PulseStage > 0xFF){
|
||||
if(PulseStage > 0xFF)
|
||||
{
|
||||
PulseStage = 0;
|
||||
}
|
||||
data[0] = PulseStage;
|
||||
@@ -987,10 +993,10 @@ void PROTOCAN_CONFIG_FILTER(uint8_t filterBank, uint32_t idFilter, uint32_t idMa
|
||||
canFilterConfig.SlaveStartFilterBank = 14;
|
||||
|
||||
// Разбиваем 32-битный ID и маску для фильтрации на High и Low 16 бит
|
||||
canFilterConfig.FilterIdHigh = (uint16_t)( ((idFilter) >> 13) ); // верхние 16 бит
|
||||
canFilterConfig.FilterIdLow = (uint16_t)( (((idFilter) << 3) ) | CAN_IDE_32 ); // низкие 16 бит,
|
||||
canFilterConfig.FilterMaskIdHigh = (uint16_t)(((idMask) >> 13) );
|
||||
canFilterConfig.FilterMaskIdLow = (uint16_t)( (((idMask) << 3) ) | CAN_IDE_32 );
|
||||
canFilterConfig.FilterIdHigh = (uint16_t)(((idFilter) >> 13)); // верхние 16 бит
|
||||
canFilterConfig.FilterIdLow = (uint16_t)((((idFilter) << 3)) | CAN_IDE_32); // низкие 16 бит,
|
||||
canFilterConfig.FilterMaskIdHigh = (uint16_t)(((idMask) >> 13));
|
||||
canFilterConfig.FilterMaskIdLow = (uint16_t)((((idMask) << 3)) | CAN_IDE_32);
|
||||
|
||||
if(HAL_CAN_ConfigFilter(_HCAN, &canFilterConfig) != HAL_OK)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user