// Generator version : v3.1 // Generation time : 2024.12.17 14:33:44 // DBC filename : DMK-RP-01_CAN_V0.1.dbc #include "canmatrix.h" // DBC file version #if (VER_CANMATRIX_MAJ != (0U)) || (VER_CANMATRIX_MIN != (0U)) #error The CANMATRIX dbc source files have different versions #endif #ifdef CANMATRIX_USE_DIAG_MONITORS // Function prototypes to be called each time CAN frame is unpacked // FMon function may detect RC, CRC or DLC violation #include "canmatrix-fmon.h" #endif // CANMATRIX_USE_DIAG_MONITORS // This macro guard for the case when you need to enable // using diag monitors but there is no necessity in proper // SysTick provider. For providing one you need define macro // before this line - in dbccodeconf.h #ifndef GetSystemTick #define GetSystemTick() (0u) #endif // This macro guard is for the case when you want to build // app with enabled optoin auto CSM, but don't yet have // proper getframehash implementation #ifndef GetFrameHash #define GetFrameHash(a,b,c,d,e) (0u) #endif // This function performs extension of sign for the signals // whose bit width value is not aligned to one of power of 2 or less than 8. // The types 'bitext_t' and 'ubitext_t' define the biggest bit width which // can be correctly handled. You need to select type which can contain // n+1 bits where n is the largest signed signal width. For example if // the most wide signed signal has a width of 31 bits you need to set // bitext_t as int32_t and ubitext_t as uint32_t // Defined these typedefs in @dbccodeconf.h or locally in 'dbcdrvname'-config.h static bitext_t __ext_sig__(ubitext_t val, uint8_t bits) { ubitext_t const m = (ubitext_t) (1u << (bits - 1u)); return ((val ^ m) - m); } uint32_t Unpack_Panel_Key_CANmatrix(Panel_Key_t* _m, const uint8_t* _d, uint8_t dlc_) { (void)dlc_; _m->KEY_ZY_D = (uint8_t) ( (_d[0] & (0x01U)) ); _m->KEY_ZY_U = (uint8_t) ( ((_d[0] >> 1U) & (0x01U)) ); _m->KEY_TT_R = (uint8_t) ( ((_d[0] >> 2U) & (0x01U)) ); _m->KEY_TT_F = (uint8_t) ( ((_d[0] >> 3U) & (0x01U)) ); _m->KEY_KB_R = (uint8_t) ( ((_d[0] >> 4U) & (0x01U)) ); _m->KEY_KB_F = (uint8_t) ( ((_d[0] >> 5U) & (0x01U)) ); _m->KEY_HG_R = (uint8_t) ( ((_d[0] >> 6U) & (0x01U)) ); _m->KEY_HG_F = (uint8_t) ( ((_d[0] >> 7U) & (0x01U)) ); _m->KEY_YT_D = (uint8_t) ( (_d[1] & (0x01U)) ); _m->KEY_YT_U = (uint8_t) ( ((_d[1] >> 1U) & (0x01U)) ); _m->KEY_TZ_D = (uint8_t) ( ((_d[1] >> 2U) & (0x01U)) ); _m->KEY_TZ_U = (uint8_t) ( ((_d[1] >> 3U) & (0x01U)) ); _m->KEY_ZY_FAN = (uint8_t) ( (_d[2] & (0x01U)) ); _m->KEY_ZY_HEAT = (uint8_t) ( ((_d[2] >> 1U) & (0x01U)) ); _m->KEY_ZY_MSSG = (uint8_t) ( ((_d[2] >> 4U) & (0x01U)) ); _m->KEY_MEMORY_3 = (uint8_t) ( (_d[3] & (0x01U)) ); _m->KEY_MEMORY_2 = (uint8_t) ( ((_d[3] >> 1U) & (0x01U)) ); _m->KEY_MEMORY_1 = (uint8_t) ( ((_d[3] >> 2U) & (0x01U)) ); _m->KEY_MEMORY_SET = (uint8_t) ( ((_d[3] >> 3U) & (0x01U)) ); _m->KEY_ZY_FLAT = (uint8_t) ( (_d[4] & (0x01U)) ); _m->KEY_RESET = (uint8_t) ( ((_d[4] >> 1U) & (0x01U)) ); #ifdef CANMATRIX_USE_DIAG_MONITORS _m->mon1.dlc_error = (dlc_ < Panel_Key_DLC); _m->mon1.last_cycle = GetSystemTick(); _m->mon1.frame_cnt++; FMon_Panel_Key_canmatrix(&_m->mon1, Panel_Key_CANID); #endif // CANMATRIX_USE_DIAG_MONITORS return Panel_Key_CANID; } #ifdef CANMATRIX_USE_CANSTRUCT uint32_t Pack_Panel_Key_CANmatrix(Panel_Key_t* _m, __CoderDbcCanFrame_t__* cframe) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(Panel_Key_DLC); cframe->Data[i++] = CANMATRIX_INITIAL_BYTE_VALUE); cframe->Data[0] |= (uint8_t) ( (_m->KEY_ZY_D & (0x01U)) | ((_m->KEY_ZY_U & (0x01U)) << 1U) | ((_m->KEY_TT_R & (0x01U)) << 2U) | ((_m->KEY_TT_F & (0x01U)) << 3U) | ((_m->KEY_KB_R & (0x01U)) << 4U) | ((_m->KEY_KB_F & (0x01U)) << 5U) | ((_m->KEY_HG_R & (0x01U)) << 6U) | ((_m->KEY_HG_F & (0x01U)) << 7U) ); cframe->Data[1] |= (uint8_t) ( (_m->KEY_YT_D & (0x01U)) | ((_m->KEY_YT_U & (0x01U)) << 1U) | ((_m->KEY_TZ_D & (0x01U)) << 2U) | ((_m->KEY_TZ_U & (0x01U)) << 3U) ); cframe->Data[2] |= (uint8_t) ( (_m->KEY_ZY_FAN & (0x01U)) | ((_m->KEY_ZY_HEAT & (0x01U)) << 1U) | ((_m->KEY_ZY_MSSG & (0x01U)) << 4U) ); cframe->Data[3] |= (uint8_t) ( (_m->KEY_MEMORY_3 & (0x01U)) | ((_m->KEY_MEMORY_2 & (0x01U)) << 1U) | ((_m->KEY_MEMORY_1 & (0x01U)) << 2U) | ((_m->KEY_MEMORY_SET & (0x01U)) << 3U) ); cframe->Data[4] |= (uint8_t) ( (_m->KEY_ZY_FLAT & (0x01U)) | ((_m->KEY_RESET & (0x01U)) << 1U) ); cframe->MsgId = (uint32_t) Panel_Key_CANID; cframe->DLC = (uint8_t) Panel_Key_DLC; cframe->IDE = (uint8_t) Panel_Key_IDE; return Panel_Key_CANID; } #else uint32_t Pack_Panel_Key_CANmatrix(Panel_Key_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(Panel_Key_DLC); _d[i++] = CANMATRIX_INITIAL_BYTE_VALUE); _d[0] |= (uint8_t) ( (_m->KEY_ZY_D & (0x01U)) | ((_m->KEY_ZY_U & (0x01U)) << 1U) | ((_m->KEY_TT_R & (0x01U)) << 2U) | ((_m->KEY_TT_F & (0x01U)) << 3U) | ((_m->KEY_KB_R & (0x01U)) << 4U) | ((_m->KEY_KB_F & (0x01U)) << 5U) | ((_m->KEY_HG_R & (0x01U)) << 6U) | ((_m->KEY_HG_F & (0x01U)) << 7U) ); _d[1] |= (uint8_t) ( (_m->KEY_YT_D & (0x01U)) | ((_m->KEY_YT_U & (0x01U)) << 1U) | ((_m->KEY_TZ_D & (0x01U)) << 2U) | ((_m->KEY_TZ_U & (0x01U)) << 3U) ); _d[2] |= (uint8_t) ( (_m->KEY_ZY_FAN & (0x01U)) | ((_m->KEY_ZY_HEAT & (0x01U)) << 1U) | ((_m->KEY_ZY_MSSG & (0x01U)) << 4U) ); _d[3] |= (uint8_t) ( (_m->KEY_MEMORY_3 & (0x01U)) | ((_m->KEY_MEMORY_2 & (0x01U)) << 1U) | ((_m->KEY_MEMORY_1 & (0x01U)) << 2U) | ((_m->KEY_MEMORY_SET & (0x01U)) << 3U) ); _d[4] |= (uint8_t) ( (_m->KEY_ZY_FLAT & (0x01U)) | ((_m->KEY_RESET & (0x01U)) << 1U) ); *_len = (uint8_t) Panel_Key_DLC; *_ide = (uint8_t) Panel_Key_IDE; return Panel_Key_CANID; } #endif // CANMATRIX_USE_CANSTRUCT uint32_t Unpack_SCM_STATE_CANmatrix(SCM_STATE_t* _m, const uint8_t* _d, uint8_t dlc_) { (void)dlc_; _m->MOTOR_HG_STATE = (uint8_t) ( (_d[0] & (0x03U)) ); _m->MOTOR_KB_STATE = (uint8_t) ( ((_d[0] >> 2U) & (0x03U)) ); _m->MOTOR_TT_STATE = (uint8_t) ( ((_d[0] >> 4U) & (0x03U)) ); _m->MOTOR_TZ_STATE = (uint8_t) ( ((_d[0] >> 6U) & (0x03U)) ); _m->MOTOR_YT_STATE = (uint8_t) ( (_d[1] & (0x03U)) ); _m->MOTOR_ZY_STATE = (uint8_t) ( ((_d[1] >> 2U) & (0x03U)) ); _m->ZY_FAN_STATE = (uint8_t) ( (_d[2] & (0x03U)) ); _m->ZY_HEAT_STATE = (uint8_t) ( ((_d[2] >> 2U) & (0x03U)) ); _m->ZY_MSSG_STATE = (uint8_t) ( ((_d[2] >> 4U) & (0x03U)) ); _m->test1 = (uint8_t) ( (_d[3] & (0xFFU)) ); _m->test2 = (uint8_t) ( (_d[4] & (0xFFU)) ); _m->test3 = (uint8_t) ( (_d[5] & (0xFFU)) ); _m->test4 = (uint8_t) ( (_d[6] & (0xFFU)) ); _m->test5 = (uint8_t) ( (_d[7] & (0xFFU)) ); #ifdef CANMATRIX_USE_DIAG_MONITORS _m->mon1.dlc_error = (dlc_ < SCM_STATE_DLC); _m->mon1.last_cycle = GetSystemTick(); _m->mon1.frame_cnt++; FMon_SCM_STATE_canmatrix(&_m->mon1, SCM_STATE_CANID); #endif // CANMATRIX_USE_DIAG_MONITORS return SCM_STATE_CANID; } #ifdef CANMATRIX_USE_CANSTRUCT uint32_t Pack_SCM_STATE_CANmatrix(SCM_STATE_t* _m, __CoderDbcCanFrame_t__* cframe) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_STATE_DLC); cframe->Data[i++] = CANMATRIX_INITIAL_BYTE_VALUE); cframe->Data[0] |= (uint8_t) ( (_m->MOTOR_HG_STATE & (0x03U)) | ((_m->MOTOR_KB_STATE & (0x03U)) << 2U) | ((_m->MOTOR_TT_STATE & (0x03U)) << 4U) | ((_m->MOTOR_TZ_STATE & (0x03U)) << 6U) ); cframe->Data[1] |= (uint8_t) ( (_m->MOTOR_YT_STATE & (0x03U)) | ((_m->MOTOR_ZY_STATE & (0x03U)) << 2U) ); cframe->Data[2] |= (uint8_t) ( (_m->ZY_FAN_STATE & (0x03U)) | ((_m->ZY_HEAT_STATE & (0x03U)) << 2U) | ((_m->ZY_MSSG_STATE & (0x03U)) << 4U) ); cframe->Data[3] |= (uint8_t) ( (_m->test1 & (0xFFU)) ); cframe->Data[4] |= (uint8_t) ( (_m->test2 & (0xFFU)) ); cframe->Data[5] |= (uint8_t) ( (_m->test3 & (0xFFU)) ); cframe->Data[6] |= (uint8_t) ( (_m->test4 & (0xFFU)) ); cframe->Data[7] |= (uint8_t) ( (_m->test5 & (0xFFU)) ); cframe->MsgId = (uint32_t) SCM_STATE_CANID; cframe->DLC = (uint8_t) SCM_STATE_DLC; cframe->IDE = (uint8_t) SCM_STATE_IDE; return SCM_STATE_CANID; } #else uint32_t Pack_SCM_STATE_CANmatrix(SCM_STATE_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_STATE_DLC); _d[i++] = CANMATRIX_INITIAL_BYTE_VALUE); _d[0] |= (uint8_t) ( (_m->MOTOR_HG_STATE & (0x03U)) | ((_m->MOTOR_KB_STATE & (0x03U)) << 2U) | ((_m->MOTOR_TT_STATE & (0x03U)) << 4U) | ((_m->MOTOR_TZ_STATE & (0x03U)) << 6U) ); _d[1] |= (uint8_t) ( (_m->MOTOR_YT_STATE & (0x03U)) | ((_m->MOTOR_ZY_STATE & (0x03U)) << 2U) ); _d[2] |= (uint8_t) ( (_m->ZY_FAN_STATE & (0x03U)) | ((_m->ZY_HEAT_STATE & (0x03U)) << 2U) | ((_m->ZY_MSSG_STATE & (0x03U)) << 4U) ); _d[3] |= (uint8_t) ( (_m->test1 & (0xFFU)) ); _d[4] |= (uint8_t) ( (_m->test2 & (0xFFU)) ); _d[5] |= (uint8_t) ( (_m->test3 & (0xFFU)) ); _d[6] |= (uint8_t) ( (_m->test4 & (0xFFU)) ); _d[7] |= (uint8_t) ( (_m->test5 & (0xFFU)) ); *_len = (uint8_t) SCM_STATE_DLC; *_ide = (uint8_t) SCM_STATE_IDE; return SCM_STATE_CANID; } #endif // CANMATRIX_USE_CANSTRUCT uint32_t Unpack_SCM_DEBUG1_CANmatrix(SCM_DEBUG1_t* _m, const uint8_t* _d, uint8_t dlc_) { (void)dlc_; _m->DEBUG_MOTOR_HG_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) ); _m->DEBUG_MOTOR_HG_STATUS = (uint8_t) ( (_d[1] & (0x03U)) ); _m->DEBUG_MOTOR_HG_HALLIO = (uint8_t) ( ((_d[1] >> 2U) & (0x01U)) ); _m->DEBUG_MOTOR_HG_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) ); _m->DEBUG_MOTOR_HG_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) ); _m->DEBUG_MOTOR_HG_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) ); #ifdef CANMATRIX_USE_DIAG_MONITORS _m->mon1.dlc_error = (dlc_ < SCM_DEBUG1_DLC); _m->mon1.last_cycle = GetSystemTick(); _m->mon1.frame_cnt++; FMon_SCM_DEBUG1_canmatrix(&_m->mon1, SCM_DEBUG1_CANID); #endif // CANMATRIX_USE_DIAG_MONITORS return SCM_DEBUG1_CANID; } #ifdef CANMATRIX_USE_CANSTRUCT uint32_t Pack_SCM_DEBUG1_CANmatrix(SCM_DEBUG1_t* _m, __CoderDbcCanFrame_t__* cframe) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG1_DLC); cframe->Data[i++] = CANMATRIX_INITIAL_BYTE_VALUE); cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_CURRENT & (0xFFU)) ); cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_HG_HALLIO & (0x01U)) << 2U) ); cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_LOC & (0xFFU)) ); cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_LOC >> 8U) & (0xFFU)) ); cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STOP_1 & (0xFFU)) ); cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_STOP_1 >> 8U) & (0xFFU)) ); cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STOP_2 & (0xFFU)) ); cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_STOP_2 >> 8U) & (0xFFU)) ); cframe->MsgId = (uint32_t) SCM_DEBUG1_CANID; cframe->DLC = (uint8_t) SCM_DEBUG1_DLC; cframe->IDE = (uint8_t) SCM_DEBUG1_IDE; return SCM_DEBUG1_CANID; } #else uint32_t Pack_SCM_DEBUG1_CANmatrix(SCM_DEBUG1_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG1_DLC); _d[i++] = CANMATRIX_INITIAL_BYTE_VALUE); _d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_CURRENT & (0xFFU)) ); _d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_HG_HALLIO & (0x01U)) << 2U) ); _d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_LOC & (0xFFU)) ); _d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_LOC >> 8U) & (0xFFU)) ); _d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STOP_1 & (0xFFU)) ); _d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_STOP_1 >> 8U) & (0xFFU)) ); _d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STOP_2 & (0xFFU)) ); _d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_STOP_2 >> 8U) & (0xFFU)) ); *_len = (uint8_t) SCM_DEBUG1_DLC; *_ide = (uint8_t) SCM_DEBUG1_IDE; return SCM_DEBUG1_CANID; } #endif // CANMATRIX_USE_CANSTRUCT uint32_t Unpack_SCM_DEBUG2_CANmatrix(SCM_DEBUG2_t* _m, const uint8_t* _d, uint8_t dlc_) { (void)dlc_; _m->DEBUG_MOTOR_KB_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) ); _m->DEBUG_MOTOR_KB_STATUS = (uint8_t) ( (_d[1] & (0x03U)) ); _m->DEBUG_MOTOR_KB_HALLIO = (uint8_t) ( ((_d[1] >> 2U) & (0x01U)) ); _m->DEBUG_MOTOR_KB_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) ); _m->DEBUG_MOTOR_KB_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) ); _m->DEBUG_MOTOR_KB_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) ); #ifdef CANMATRIX_USE_DIAG_MONITORS _m->mon1.dlc_error = (dlc_ < SCM_DEBUG2_DLC); _m->mon1.last_cycle = GetSystemTick(); _m->mon1.frame_cnt++; FMon_SCM_DEBUG2_canmatrix(&_m->mon1, SCM_DEBUG2_CANID); #endif // CANMATRIX_USE_DIAG_MONITORS return SCM_DEBUG2_CANID; } #ifdef CANMATRIX_USE_CANSTRUCT uint32_t Pack_SCM_DEBUG2_CANmatrix(SCM_DEBUG2_t* _m, __CoderDbcCanFrame_t__* cframe) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG2_DLC); cframe->Data[i++] = CANMATRIX_INITIAL_BYTE_VALUE); cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_CURRENT & (0xFFU)) ); cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_KB_HALLIO & (0x01U)) << 2U) ); cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_LOC & (0xFFU)) ); cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_LOC >> 8U) & (0xFFU)) ); cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STOP_1 & (0xFFU)) ); cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_STOP_1 >> 8U) & (0xFFU)) ); cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STOP_2 & (0xFFU)) ); cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_STOP_2 >> 8U) & (0xFFU)) ); cframe->MsgId = (uint32_t) SCM_DEBUG2_CANID; cframe->DLC = (uint8_t) SCM_DEBUG2_DLC; cframe->IDE = (uint8_t) SCM_DEBUG2_IDE; return SCM_DEBUG2_CANID; } #else uint32_t Pack_SCM_DEBUG2_CANmatrix(SCM_DEBUG2_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG2_DLC); _d[i++] = CANMATRIX_INITIAL_BYTE_VALUE); _d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_CURRENT & (0xFFU)) ); _d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_KB_HALLIO & (0x01U)) << 2U) ); _d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_LOC & (0xFFU)) ); _d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_LOC >> 8U) & (0xFFU)) ); _d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STOP_1 & (0xFFU)) ); _d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_STOP_1 >> 8U) & (0xFFU)) ); _d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STOP_2 & (0xFFU)) ); _d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_STOP_2 >> 8U) & (0xFFU)) ); *_len = (uint8_t) SCM_DEBUG2_DLC; *_ide = (uint8_t) SCM_DEBUG2_IDE; return SCM_DEBUG2_CANID; } #endif // CANMATRIX_USE_CANSTRUCT uint32_t Unpack_SCM_DEBUG3_CANmatrix(SCM_DEBUG3_t* _m, const uint8_t* _d, uint8_t dlc_) { (void)dlc_; _m->DEBUG_MOTOR_TT_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) ); _m->DEBUG_MOTOR_TT_STATUS = (uint8_t) ( (_d[1] & (0x03U)) ); _m->DEBUG_MOTOR_TT_HALLIO = (uint8_t) ( ((_d[1] >> 2U) & (0x01U)) ); _m->DEBUG_MOTOR_TT_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) ); _m->DEBUG_MOTOR_TT_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) ); _m->DEBUG_MOTOR_TT_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) ); #ifdef CANMATRIX_USE_DIAG_MONITORS _m->mon1.dlc_error = (dlc_ < SCM_DEBUG3_DLC); _m->mon1.last_cycle = GetSystemTick(); _m->mon1.frame_cnt++; FMon_SCM_DEBUG3_canmatrix(&_m->mon1, SCM_DEBUG3_CANID); #endif // CANMATRIX_USE_DIAG_MONITORS return SCM_DEBUG3_CANID; } #ifdef CANMATRIX_USE_CANSTRUCT uint32_t Pack_SCM_DEBUG3_CANmatrix(SCM_DEBUG3_t* _m, __CoderDbcCanFrame_t__* cframe) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG3_DLC); cframe->Data[i++] = CANMATRIX_INITIAL_BYTE_VALUE); cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_CURRENT & (0xFFU)) ); cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_TT_HALLIO & (0x01U)) << 2U) ); cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_LOC & (0xFFU)) ); cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_LOC >> 8U) & (0xFFU)) ); cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STOP_1 & (0xFFU)) ); cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_STOP_1 >> 8U) & (0xFFU)) ); cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STOP_2 & (0xFFU)) ); cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_STOP_2 >> 8U) & (0xFFU)) ); cframe->MsgId = (uint32_t) SCM_DEBUG3_CANID; cframe->DLC = (uint8_t) SCM_DEBUG3_DLC; cframe->IDE = (uint8_t) SCM_DEBUG3_IDE; return SCM_DEBUG3_CANID; } #else uint32_t Pack_SCM_DEBUG3_CANmatrix(SCM_DEBUG3_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG3_DLC); _d[i++] = CANMATRIX_INITIAL_BYTE_VALUE); _d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_CURRENT & (0xFFU)) ); _d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_TT_HALLIO & (0x01U)) << 2U) ); _d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_LOC & (0xFFU)) ); _d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_LOC >> 8U) & (0xFFU)) ); _d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STOP_1 & (0xFFU)) ); _d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_STOP_1 >> 8U) & (0xFFU)) ); _d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STOP_2 & (0xFFU)) ); _d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_STOP_2 >> 8U) & (0xFFU)) ); *_len = (uint8_t) SCM_DEBUG3_DLC; *_ide = (uint8_t) SCM_DEBUG3_IDE; return SCM_DEBUG3_CANID; } #endif // CANMATRIX_USE_CANSTRUCT uint32_t Unpack_SCM_DEBUG4_CANmatrix(SCM_DEBUG4_t* _m, const uint8_t* _d, uint8_t dlc_) { (void)dlc_; _m->DEBUG_MOTOR_ZY_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) ); _m->DEBUG_MOTOR_ZY_STATUS = (uint8_t) ( (_d[1] & (0x03U)) ); _m->DEBUG_MOTOR_ZY_HALLIO = (uint8_t) ( ((_d[1] >> 2U) & (0x01U)) ); _m->DEBUG_MOTOR_ZY_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) ); _m->DEBUG_MOTOR_ZY_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) ); _m->DEBUG_MOTOR_ZY_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) ); #ifdef CANMATRIX_USE_DIAG_MONITORS _m->mon1.dlc_error = (dlc_ < SCM_DEBUG4_DLC); _m->mon1.last_cycle = GetSystemTick(); _m->mon1.frame_cnt++; FMon_SCM_DEBUG4_canmatrix(&_m->mon1, SCM_DEBUG4_CANID); #endif // CANMATRIX_USE_DIAG_MONITORS return SCM_DEBUG4_CANID; } #ifdef CANMATRIX_USE_CANSTRUCT uint32_t Pack_SCM_DEBUG4_CANmatrix(SCM_DEBUG4_t* _m, __CoderDbcCanFrame_t__* cframe) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG4_DLC); cframe->Data[i++] = CANMATRIX_INITIAL_BYTE_VALUE); cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_CURRENT & (0xFFU)) ); cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_ZY_HALLIO & (0x01U)) << 2U) ); cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_LOC & (0xFFU)) ); cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_LOC >> 8U) & (0xFFU)) ); cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STOP_1 & (0xFFU)) ); cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_STOP_1 >> 8U) & (0xFFU)) ); cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STOP_2 & (0xFFU)) ); cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_STOP_2 >> 8U) & (0xFFU)) ); cframe->MsgId = (uint32_t) SCM_DEBUG4_CANID; cframe->DLC = (uint8_t) SCM_DEBUG4_DLC; cframe->IDE = (uint8_t) SCM_DEBUG4_IDE; return SCM_DEBUG4_CANID; } #else uint32_t Pack_SCM_DEBUG4_CANmatrix(SCM_DEBUG4_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG4_DLC); _d[i++] = CANMATRIX_INITIAL_BYTE_VALUE); _d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_CURRENT & (0xFFU)) ); _d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_ZY_HALLIO & (0x01U)) << 2U) ); _d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_LOC & (0xFFU)) ); _d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_LOC >> 8U) & (0xFFU)) ); _d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STOP_1 & (0xFFU)) ); _d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_STOP_1 >> 8U) & (0xFFU)) ); _d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STOP_2 & (0xFFU)) ); _d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_STOP_2 >> 8U) & (0xFFU)) ); *_len = (uint8_t) SCM_DEBUG4_DLC; *_ide = (uint8_t) SCM_DEBUG4_IDE; return SCM_DEBUG4_CANID; } #endif // CANMATRIX_USE_CANSTRUCT uint32_t Unpack_SCM_DEBUG5_CANmatrix(SCM_DEBUG5_t* _m, const uint8_t* _d, uint8_t dlc_) { (void)dlc_; _m->DEBUG_MOTOR_TZ_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) ); _m->DEBUG_MOTOR_TZ_STATUS = (uint8_t) ( (_d[1] & (0x03U)) ); _m->DEBUG_MOTOR_TZ_HALLIO = (uint8_t) ( ((_d[1] >> 2U) & (0x01U)) ); _m->DEBUG_MOTOR_TZ_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) ); _m->DEBUG_MOTOR_TZ_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) ); _m->DEBUG_MOTOR_TZ_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) ); #ifdef CANMATRIX_USE_DIAG_MONITORS _m->mon1.dlc_error = (dlc_ < SCM_DEBUG5_DLC); _m->mon1.last_cycle = GetSystemTick(); _m->mon1.frame_cnt++; FMon_SCM_DEBUG5_canmatrix(&_m->mon1, SCM_DEBUG5_CANID); #endif // CANMATRIX_USE_DIAG_MONITORS return SCM_DEBUG5_CANID; } #ifdef CANMATRIX_USE_CANSTRUCT uint32_t Pack_SCM_DEBUG5_CANmatrix(SCM_DEBUG5_t* _m, __CoderDbcCanFrame_t__* cframe) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG5_DLC); cframe->Data[i++] = CANMATRIX_INITIAL_BYTE_VALUE); cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_CURRENT & (0xFFU)) ); cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_TZ_HALLIO & (0x01U)) << 2U) ); cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_LOC & (0xFFU)) ); cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_LOC >> 8U) & (0xFFU)) ); cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STOP_1 & (0xFFU)) ); cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_STOP_1 >> 8U) & (0xFFU)) ); cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STOP_2 & (0xFFU)) ); cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_STOP_2 >> 8U) & (0xFFU)) ); cframe->MsgId = (uint32_t) SCM_DEBUG5_CANID; cframe->DLC = (uint8_t) SCM_DEBUG5_DLC; cframe->IDE = (uint8_t) SCM_DEBUG5_IDE; return SCM_DEBUG5_CANID; } #else uint32_t Pack_SCM_DEBUG5_CANmatrix(SCM_DEBUG5_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG5_DLC); _d[i++] = CANMATRIX_INITIAL_BYTE_VALUE); _d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_CURRENT & (0xFFU)) ); _d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_TZ_HALLIO & (0x01U)) << 2U) ); _d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_LOC & (0xFFU)) ); _d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_LOC >> 8U) & (0xFFU)) ); _d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STOP_1 & (0xFFU)) ); _d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_STOP_1 >> 8U) & (0xFFU)) ); _d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STOP_2 & (0xFFU)) ); _d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_STOP_2 >> 8U) & (0xFFU)) ); *_len = (uint8_t) SCM_DEBUG5_DLC; *_ide = (uint8_t) SCM_DEBUG5_IDE; return SCM_DEBUG5_CANID; } #endif // CANMATRIX_USE_CANSTRUCT uint32_t Unpack_SCM_DEBUG6_CANmatrix(SCM_DEBUG6_t* _m, const uint8_t* _d, uint8_t dlc_) { (void)dlc_; _m->DEBUG_MOTOR_YT_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) ); _m->DEBUG_MOTOR_YT_STATUS = (uint8_t) ( (_d[1] & (0x03U)) ); _m->DEBUG_MOTOR_YT_HALLIO = (uint8_t) ( ((_d[1] >> 2U) & (0x01U)) ); _m->DEBUG_MOTOR_YT_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) ); _m->DEBUG_MOTOR_YT_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) ); _m->DEBUG_MOTOR_YT_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) ); #ifdef CANMATRIX_USE_DIAG_MONITORS _m->mon1.dlc_error = (dlc_ < SCM_DEBUG6_DLC); _m->mon1.last_cycle = GetSystemTick(); _m->mon1.frame_cnt++; FMon_SCM_DEBUG6_canmatrix(&_m->mon1, SCM_DEBUG6_CANID); #endif // CANMATRIX_USE_DIAG_MONITORS return SCM_DEBUG6_CANID; } #ifdef CANMATRIX_USE_CANSTRUCT uint32_t Pack_SCM_DEBUG6_CANmatrix(SCM_DEBUG6_t* _m, __CoderDbcCanFrame_t__* cframe) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG6_DLC); cframe->Data[i++] = CANMATRIX_INITIAL_BYTE_VALUE); cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_CURRENT & (0xFFU)) ); cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_YT_HALLIO & (0x01U)) << 2U) ); cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_LOC & (0xFFU)) ); cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_LOC >> 8U) & (0xFFU)) ); cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STOP_1 & (0xFFU)) ); cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_STOP_1 >> 8U) & (0xFFU)) ); cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STOP_2 & (0xFFU)) ); cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_STOP_2 >> 8U) & (0xFFU)) ); cframe->MsgId = (uint32_t) SCM_DEBUG6_CANID; cframe->DLC = (uint8_t) SCM_DEBUG6_DLC; cframe->IDE = (uint8_t) SCM_DEBUG6_IDE; return SCM_DEBUG6_CANID; } #else uint32_t Pack_SCM_DEBUG6_CANmatrix(SCM_DEBUG6_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide) { uint8_t i; for (i = 0u; i < CANMATRIX_VALIDATE_DLC(SCM_DEBUG6_DLC); _d[i++] = CANMATRIX_INITIAL_BYTE_VALUE); _d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_CURRENT & (0xFFU)) ); _d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STATUS & (0x03U)) | ((_m->DEBUG_MOTOR_YT_HALLIO & (0x01U)) << 2U) ); _d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_LOC & (0xFFU)) ); _d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_LOC >> 8U) & (0xFFU)) ); _d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STOP_1 & (0xFFU)) ); _d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_STOP_1 >> 8U) & (0xFFU)) ); _d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STOP_2 & (0xFFU)) ); _d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_STOP_2 >> 8U) & (0xFFU)) ); *_len = (uint8_t) SCM_DEBUG6_DLC; *_ide = (uint8_t) SCM_DEBUG6_IDE; return SCM_DEBUG6_CANID; } #endif // CANMATRIX_USE_CANSTRUCT