更新信号矩阵
This commit is contained in:
parent
adad6693a9
commit
6fea42e60f
4
cva_asw_m0146/.vscode/settings.json
vendored
4
cva_asw_m0146/.vscode/settings.json
vendored
@ -27,7 +27,9 @@
|
|||||||
"scm_matrix-binutil.h": "c",
|
"scm_matrix-binutil.h": "c",
|
||||||
"matrix.h": "c",
|
"matrix.h": "c",
|
||||||
"key.h": "c",
|
"key.h": "c",
|
||||||
"dbccodeconf.h": "c"
|
"dbccodeconf.h": "c",
|
||||||
|
"canmatrix.h": "c",
|
||||||
|
"scm_canmatrix-binutil.h": "c"
|
||||||
},
|
},
|
||||||
"C_Cpp.default.compilerPath": "",
|
"C_Cpp.default.compilerPath": "",
|
||||||
"MicroPython.executeButton": [
|
"MicroPython.executeButton": [
|
||||||
|
@ -361,11 +361,11 @@
|
|||||||
<state>$PROJ_DIR$\src\RTT</state>
|
<state>$PROJ_DIR$\src\RTT</state>
|
||||||
<state>$PROJ_DIR$\SDK\platform\devices\CVM014x\drivers\clock</state>
|
<state>$PROJ_DIR$\SDK\platform\devices\CVM014x\drivers\clock</state>
|
||||||
<state>$PROJ_DIR$\SDK\platform\devices\CVM014x\drivers\cpu\irq</state>
|
<state>$PROJ_DIR$\SDK\platform\devices\CVM014x\drivers\cpu\irq</state>
|
||||||
<state>$PROJ_DIR$\src\Matrix\inc</state>
|
<state>$PROJ_DIR$\src\CANmatrix\inc</state>
|
||||||
<state>$PROJ_DIR$\src\Matrix\butl</state>
|
<state>$PROJ_DIR$\src\CANmatrix\butl</state>
|
||||||
<state>$PROJ_DIR$\src\Matrix\conf</state>
|
<state>$PROJ_DIR$\src\CANmatrix\conf</state>
|
||||||
<state>$PROJ_DIR$\src\Matrix\lib</state>
|
<state>$PROJ_DIR$\src\CANmatrix\lib</state>
|
||||||
<state>$PROJ_DIR$\src\Matrix\usr</state>
|
<state>$PROJ_DIR$\src\CANmatrix\usr</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>CCStdIncCheck</name>
|
<name>CCStdIncCheck</name>
|
||||||
@ -2211,6 +2211,39 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<group>
|
<group>
|
||||||
<name>src</name>
|
<name>src</name>
|
||||||
|
<group>
|
||||||
|
<name>CANmatrix</name>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\inc\can_message.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\conf\canmatrix-config.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\usr\canmatrix-fmon.c</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\lib\canmatrix-fmon.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\lib\canmatrix.c</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\lib\canmatrix.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\inc\canmonitorutil.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\conf\dbccodeconf.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\butl\scm_canmatrix-binutil.c</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\butl\scm_canmatrix-binutil.h</name>
|
||||||
|
</file>
|
||||||
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<name>drivers</name>
|
<name>drivers</name>
|
||||||
<group>
|
<group>
|
||||||
@ -2645,39 +2678,6 @@
|
|||||||
<name>$PROJ_DIR$\linker\app_m0146_flash.icf</name>
|
<name>$PROJ_DIR$\linker\app_m0146_flash.icf</name>
|
||||||
</file>
|
</file>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
|
||||||
<name>matrix</name>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\inc\can_message.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\inc\canmonitorutil.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\conf\dbccodeconf.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\conf\matrix-config.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\usr\matrix-fmon.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\lib\matrix-fmon.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\lib\matrix.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\lib\matrix.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\butl\scm_matrix-binutil.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\butl\scm_matrix-binutil.h</name>
|
|
||||||
</file>
|
|
||||||
</group>
|
|
||||||
<group>
|
<group>
|
||||||
<name>middleware</name>
|
<name>middleware</name>
|
||||||
<group>
|
<group>
|
||||||
@ -3005,12 +3005,18 @@
|
|||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\src\canuser.c</name>
|
<name>$PROJ_DIR$\src\canuser.c</name>
|
||||||
</file>
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\event.c</name>
|
||||||
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\src\extern.c</name>
|
<name>$PROJ_DIR$\src\extern.c</name>
|
||||||
</file>
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\src\hwctrl.c</name>
|
<name>$PROJ_DIR$\src\hwctrl.c</name>
|
||||||
</file>
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\key.c</name>
|
||||||
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\src\main.c</name>
|
<name>$PROJ_DIR$\src\main.c</name>
|
||||||
</file>
|
</file>
|
||||||
|
@ -2853,6 +2853,39 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<group>
|
<group>
|
||||||
<name>src</name>
|
<name>src</name>
|
||||||
|
<group>
|
||||||
|
<name>CANmatrix</name>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\inc\can_message.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\conf\canmatrix-config.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\usr\canmatrix-fmon.c</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\lib\canmatrix-fmon.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\lib\canmatrix.c</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\lib\canmatrix.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\inc\canmonitorutil.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\conf\dbccodeconf.h</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\butl\scm_canmatrix-binutil.c</name>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\CANmatrix\butl\scm_canmatrix-binutil.h</name>
|
||||||
|
</file>
|
||||||
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<name>drivers</name>
|
<name>drivers</name>
|
||||||
<group>
|
<group>
|
||||||
@ -3279,39 +3312,6 @@
|
|||||||
<name>$PROJ_DIR$\linker\app_m0146_flash.icf</name>
|
<name>$PROJ_DIR$\linker\app_m0146_flash.icf</name>
|
||||||
</file>
|
</file>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
|
||||||
<name>matrix</name>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\inc\can_message.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\inc\canmonitorutil.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\conf\dbccodeconf.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\conf\matrix-config.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\usr\matrix-fmon.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\lib\matrix-fmon.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\lib\matrix.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\lib\matrix.h</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\butl\scm_matrix-binutil.c</name>
|
|
||||||
</file>
|
|
||||||
<file>
|
|
||||||
<name>$PROJ_DIR$\src\Matrix\butl\scm_matrix-binutil.h</name>
|
|
||||||
</file>
|
|
||||||
</group>
|
|
||||||
<group>
|
<group>
|
||||||
<name>middleware</name>
|
<name>middleware</name>
|
||||||
<group>
|
<group>
|
||||||
@ -3639,12 +3639,18 @@
|
|||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\src\canuser.c</name>
|
<name>$PROJ_DIR$\src\canuser.c</name>
|
||||||
</file>
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\event.c</name>
|
||||||
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\src\extern.c</name>
|
<name>$PROJ_DIR$\src\extern.c</name>
|
||||||
</file>
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\src\hwctrl.c</name>
|
<name>$PROJ_DIR$\src\hwctrl.c</name>
|
||||||
</file>
|
</file>
|
||||||
|
<file>
|
||||||
|
<name>$PROJ_DIR$\src\key.c</name>
|
||||||
|
</file>
|
||||||
<file>
|
<file>
|
||||||
<name>$PROJ_DIR$\src\main.c</name>
|
<name>$PROJ_DIR$\src\main.c</name>
|
||||||
</file>
|
</file>
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
<MemConfigValue>E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf</MemConfigValue>
|
<MemConfigValue>E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf</MemConfigValue>
|
||||||
</PlDriver>
|
</PlDriver>
|
||||||
<ArmDriver>
|
<ArmDriver>
|
||||||
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
|
||||||
<EnableCache>0</EnableCache>
|
<EnableCache>0</EnableCache>
|
||||||
|
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
||||||
</ArmDriver>
|
</ArmDriver>
|
||||||
<DebugChecksum>
|
<DebugChecksum>
|
||||||
<Checksum>3190234441</Checksum>
|
<Checksum>3190234441</Checksum>
|
||||||
|
File diff suppressed because one or more lines are too long
28
cva_asw_m0146/src/CANmatrix/butl/scm_canmatrix-binutil.c
Normal file
28
cva_asw_m0146/src/CANmatrix/butl/scm_canmatrix-binutil.c
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Generator version : v3.1
|
||||||
|
// Generation time : 2024.12.07 08:59:44
|
||||||
|
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
||||||
|
#include "scm_canmatrix-binutil.h"
|
||||||
|
|
||||||
|
// DBC file version
|
||||||
|
#if (VER_CANMATRIX_MAJ != (0U)) || (VER_CANMATRIX_MIN != (0U))
|
||||||
|
#error The SCM_CANMATRIX binutil source file has inconsistency with core dbc lib!
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __DEF_SCM_CANMATRIX__
|
||||||
|
|
||||||
|
scm_canmatrix_rx_t scm_canmatrix_rx;
|
||||||
|
|
||||||
|
scm_canmatrix_tx_t scm_canmatrix_tx;
|
||||||
|
|
||||||
|
#endif // __DEF_SCM_CANMATRIX__
|
||||||
|
|
||||||
|
uint32_t scm_canmatrix_Receive(scm_canmatrix_rx_t* _m, const uint8_t* _d, uint32_t _id, uint8_t dlc_)
|
||||||
|
{
|
||||||
|
uint32_t recid = 0;
|
||||||
|
if (_id == 0x201U) {
|
||||||
|
recid = Unpack_Panel_Key_CANmatrix(&(_m->Panel_Key), _d, dlc_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return recid;
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
// Generator version : v3.1
|
// Generator version : v3.1
|
||||||
// Generation time : 2024.11.18 11:42:14
|
// Generation time : 2024.12.07 08:59:44
|
||||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -9,12 +9,12 @@ extern "C" {
|
|||||||
|
|
||||||
#include "dbccodeconf.h"
|
#include "dbccodeconf.h"
|
||||||
|
|
||||||
#include "matrix.h"
|
#include "canmatrix.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Panel_Key_t Panel_Key;
|
Panel_Key_t Panel_Key;
|
||||||
} scm_matrix_rx_t;
|
} scm_canmatrix_rx_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -25,17 +25,17 @@ typedef struct
|
|||||||
SCM_DEBUG4_t SCM_DEBUG4;
|
SCM_DEBUG4_t SCM_DEBUG4;
|
||||||
SCM_DEBUG5_t SCM_DEBUG5;
|
SCM_DEBUG5_t SCM_DEBUG5;
|
||||||
SCM_DEBUG6_t SCM_DEBUG6;
|
SCM_DEBUG6_t SCM_DEBUG6;
|
||||||
} scm_matrix_tx_t;
|
} scm_canmatrix_tx_t;
|
||||||
|
|
||||||
uint32_t scm_matrix_Receive(scm_matrix_rx_t* m, const uint8_t* d, uint32_t msgid, uint8_t dlc);
|
uint32_t scm_canmatrix_Receive(scm_canmatrix_rx_t* m, const uint8_t* d, uint32_t msgid, uint8_t dlc);
|
||||||
|
|
||||||
#ifdef __DEF_SCM_MATRIX__
|
#ifdef __DEF_SCM_CANMATRIX__
|
||||||
|
|
||||||
extern scm_matrix_rx_t scm_matrix_rx;
|
extern scm_canmatrix_rx_t scm_canmatrix_rx;
|
||||||
|
|
||||||
extern scm_matrix_tx_t scm_matrix_tx;
|
extern scm_canmatrix_tx_t scm_canmatrix_tx;
|
||||||
|
|
||||||
#endif // __DEF_SCM_MATRIX__
|
#endif // __DEF_SCM_CANMATRIX__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
// Generator version : v3.1
|
// Generator version : v3.1
|
||||||
// Generation time : 2024.11.18 11:42:14
|
// Generation time : 2024.12.07 08:59:44
|
||||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
Note(!): bit-feild was not tested properly. */
|
Note(!): bit-feild was not tested properly. */
|
||||||
|
|
||||||
#define MATRIX_USE_BITS_SIGNAL
|
#define CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- *
|
/* ------------------------------------------------------------------------- *
|
||||||
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
This struct definition have to be placed (or be included) in dbccodeconf.h */
|
This struct definition have to be placed (or be included) in dbccodeconf.h */
|
||||||
|
|
||||||
#define MATRIX_USE_CANSTRUCT
|
#define CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- *
|
/* ------------------------------------------------------------------------- *
|
||||||
@ -50,7 +50,7 @@
|
|||||||
3. In unpack function '_phys' signal will be written by '_ro' signal.
|
3. In unpack function '_phys' signal will be written by '_ro' signal.
|
||||||
User have to use '_phys' signal to read physical value. */
|
User have to use '_phys' signal to read physical value. */
|
||||||
|
|
||||||
/* #define MATRIX_USE_SIGFLOAT */
|
/* #define CANMATRIX_USE_SIGFLOAT */
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- *
|
/* ------------------------------------------------------------------------- *
|
||||||
@ -69,20 +69,20 @@
|
|||||||
which is empty by default and have to be filled by user if
|
which is empty by default and have to be filled by user if
|
||||||
tests for DLC, rolling, checksum are necessary */
|
tests for DLC, rolling, checksum are necessary */
|
||||||
|
|
||||||
/* #define MATRIX_USE_DIAG_MONITORS */
|
/* #define CANMATRIX_USE_DIAG_MONITORS */
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- *
|
/* ------------------------------------------------------------------------- *
|
||||||
When monitor using is enabled (MATRIX_USE_DIAG_MONITORS) and define below
|
When monitor using is enabled (CANMATRIX_USE_DIAG_MONITORS) and define below
|
||||||
uncommented, additional signal will be added to message struct. ***_expt:
|
uncommented, additional signal will be added to message struct. ***_expt:
|
||||||
expected rolling counter, to perform monitoring rolling counter sequence
|
expected rolling counter, to perform monitoring rolling counter sequence
|
||||||
automatically (result may be tested in dedicated Fmon_*** function) */
|
automatically (result may be tested in dedicated Fmon_*** function) */
|
||||||
|
|
||||||
/* #define MATRIX_AUTO_ROLL */
|
/* #define CANMATRIX_AUTO_ROLL */
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- *
|
/* ------------------------------------------------------------------------- *
|
||||||
When monitor using is enabled (MATRIX_USE_DIAG_MONITORS) and define below
|
When monitor using is enabled (CANMATRIX_USE_DIAG_MONITORS) and define below
|
||||||
uncommented, frame checksum signal may be handled automatically.
|
uncommented, frame checksum signal may be handled automatically.
|
||||||
|
|
||||||
The signal which may be marked as checksum signal must have substring
|
The signal which may be marked as checksum signal must have substring
|
||||||
@ -108,7 +108,7 @@
|
|||||||
In unpack function checksum signal is checked with calculated.
|
In unpack function checksum signal is checked with calculated.
|
||||||
(result may be tested in dedicated Fmon_*** function). */
|
(result may be tested in dedicated Fmon_*** function). */
|
||||||
|
|
||||||
/* #define MATRIX_AUTO_CSM */
|
/* #define CANMATRIX_AUTO_CSM */
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- *
|
/* ------------------------------------------------------------------------- *
|
||||||
@ -128,4 +128,4 @@
|
|||||||
no necessity to replace source code)
|
no necessity to replace source code)
|
||||||
|
|
||||||
For using MONO way uncomment line below */
|
For using MONO way uncomment line below */
|
||||||
/* #define MATRIX_USE_MONO_FMON */
|
/* #define CANMATRIX_USE_MONO_FMON */
|
@ -1,5 +1,5 @@
|
|||||||
// Generator version : v3.1
|
// Generator version : v3.1
|
||||||
// Generation time : 2024.11.18 11:42:14
|
// Generation time : 2024.12.07 08:59:44
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -13,7 +13,7 @@ typedef CAN_DATATYPE __CoderDbcCanFrame_t__;
|
|||||||
|
|
||||||
// if you need to allocate rx and tx messages structs put the allocation macro here
|
// if you need to allocate rx and tx messages structs put the allocation macro here
|
||||||
// #define __DEF_{your_driver_name}__
|
// #define __DEF_{your_driver_name}__
|
||||||
#define __DEF_SCM_MATRIX__
|
#define __DEF_SCM_CANMATRIX__
|
||||||
|
|
||||||
// defualt @__ext_sig__ help types definition
|
// defualt @__ext_sig__ help types definition
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
// Generator version : v3.1
|
// Generator version : v3.1
|
||||||
// Generation time : 2024.11.18 11:42:14
|
// Generation time : 2024.12.07 08:59:44
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
65
cva_asw_m0146/src/CANmatrix/lib/canmatrix-fmon.h
Normal file
65
cva_asw_m0146/src/CANmatrix/lib/canmatrix-fmon.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// Generator version : v3.1
|
||||||
|
// Generation time : 2024.12.07 08:59:44
|
||||||
|
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// DBC file version
|
||||||
|
#define VER_CANMATRIX_MAJ_FMON (0U)
|
||||||
|
#define VER_CANMATRIX_MIN_FMON (0U)
|
||||||
|
|
||||||
|
#include "canmatrix-config.h"
|
||||||
|
|
||||||
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
|
#include "canmonitorutil.h"
|
||||||
|
/*
|
||||||
|
This file contains the prototypes of all the functions that will be called
|
||||||
|
from each Unpack_*name* function to detect DBC related errors
|
||||||
|
It is the user responsibility to defined these functions in the
|
||||||
|
separated .c file. If it won't be done the linkage error will happen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CANMATRIX_USE_MONO_FMON
|
||||||
|
|
||||||
|
void _FMon_MONO_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
|
||||||
|
#define FMon_Panel_Key_canmatrix(x, y) _FMon_MONO_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_STATE_canmatrix(x, y) _FMon_MONO_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG1_canmatrix(x, y) _FMon_MONO_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG2_canmatrix(x, y) _FMon_MONO_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG3_canmatrix(x, y) _FMon_MONO_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG4_canmatrix(x, y) _FMon_MONO_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG5_canmatrix(x, y) _FMon_MONO_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG6_canmatrix(x, y) _FMon_MONO_canmatrix((x), (y))
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
void _FMon_Panel_Key_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
void _FMon_SCM_STATE_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
void _FMon_SCM_DEBUG1_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
void _FMon_SCM_DEBUG2_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
void _FMon_SCM_DEBUG3_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
void _FMon_SCM_DEBUG4_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
void _FMon_SCM_DEBUG5_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
void _FMon_SCM_DEBUG6_canmatrix(FrameMonitor_t* _mon, uint32_t msgid);
|
||||||
|
|
||||||
|
#define FMon_Panel_Key_canmatrix(x, y) _FMon_Panel_Key_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_STATE_canmatrix(x, y) _FMon_SCM_STATE_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG1_canmatrix(x, y) _FMon_SCM_DEBUG1_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG2_canmatrix(x, y) _FMon_SCM_DEBUG2_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG3_canmatrix(x, y) _FMon_SCM_DEBUG3_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG4_canmatrix(x, y) _FMon_SCM_DEBUG4_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG5_canmatrix(x, y) _FMon_SCM_DEBUG5_canmatrix((x), (y))
|
||||||
|
#define FMon_SCM_DEBUG6_canmatrix(x, y) _FMon_SCM_DEBUG6_canmatrix((x), (y))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,20 +1,20 @@
|
|||||||
// Generator version : v3.1
|
// Generator version : v3.1
|
||||||
// Generation time : 2024.11.18 11:42:14
|
// Generation time : 2024.12.07 13:45:35
|
||||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
// DBC filename : DMK-RP-01_CAN_V0.1_20241207.dbc
|
||||||
#include "matrix.h"
|
#include "canmatrix.h"
|
||||||
|
|
||||||
|
|
||||||
// DBC file version
|
// DBC file version
|
||||||
#if (VER_MATRIX_MAJ != (0U)) || (VER_MATRIX_MIN != (0U))
|
#if (VER_CANMATRIX_MAJ != (0U)) || (VER_CANMATRIX_MIN != (0U))
|
||||||
#error The MATRIX dbc source files have different versions
|
#error The CANMATRIX dbc source files have different versions
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
// Function prototypes to be called each time CAN frame is unpacked
|
// Function prototypes to be called each time CAN frame is unpacked
|
||||||
// FMon function may detect RC, CRC or DLC violation
|
// FMon function may detect RC, CRC or DLC violation
|
||||||
#include "matrix-fmon.h"
|
#include "canmatrix-fmon.h"
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
// This macro guard for the case when you need to enable
|
// This macro guard for the case when you need to enable
|
||||||
// using diag monitors but there is no necessity in proper
|
// using diag monitors but there is no necessity in proper
|
||||||
@ -47,7 +47,7 @@ static bitext_t __ext_sig__(ubitext_t val, uint8_t bits)
|
|||||||
return ((val ^ m) - m);
|
return ((val ^ m) - m);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Unpack_Panel_Key_Matrix(Panel_Key_t* _m, const uint8_t* _d, uint8_t dlc_)
|
uint32_t Unpack_Panel_Key_CANmatrix(Panel_Key_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||||
{
|
{
|
||||||
(void)dlc_;
|
(void)dlc_;
|
||||||
_m->KEY_ZY_D = (uint8_t) ( (_d[0] & (0x01U)) );
|
_m->KEY_ZY_D = (uint8_t) ( (_d[0] & (0x01U)) );
|
||||||
@ -72,22 +72,22 @@ uint32_t Unpack_Panel_Key_Matrix(Panel_Key_t* _m, const uint8_t* _d, uint8_t dlc
|
|||||||
_m->KEY_ZY_FLAT = (uint8_t) ( (_d[4] & (0x01U)) );
|
_m->KEY_ZY_FLAT = (uint8_t) ( (_d[4] & (0x01U)) );
|
||||||
_m->KEY_RESET = (uint8_t) ( ((_d[4] >> 1U) & (0x01U)) );
|
_m->KEY_RESET = (uint8_t) ( ((_d[4] >> 1U) & (0x01U)) );
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
_m->mon1.dlc_error = (dlc_ < Panel_Key_DLC);
|
_m->mon1.dlc_error = (dlc_ < Panel_Key_DLC);
|
||||||
_m->mon1.last_cycle = GetSystemTick();
|
_m->mon1.last_cycle = GetSystemTick();
|
||||||
_m->mon1.frame_cnt++;
|
_m->mon1.frame_cnt++;
|
||||||
|
|
||||||
FMon_Panel_Key_matrix(&_m->mon1, Panel_Key_CANID);
|
FMon_Panel_Key_canmatrix(&_m->mon1, Panel_Key_CANID);
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
return Panel_Key_CANID;
|
return Panel_Key_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Pack_Panel_Key_Matrix(Panel_Key_t* _m, __CoderDbcCanFrame_t__* cframe)
|
uint32_t Pack_Panel_Key_CANmatrix(Panel_Key_t* _m, __CoderDbcCanFrame_t__* cframe)
|
||||||
{
|
{
|
||||||
uint8_t i; for (i = 0u; i < MATRIX_VALIDATE_DLC(Panel_Key_DLC); cframe->Data[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[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[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) );
|
||||||
@ -103,9 +103,9 @@ uint32_t Pack_Panel_Key_Matrix(Panel_Key_t* _m, __CoderDbcCanFrame_t__* cframe)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t Pack_Panel_Key_Matrix(Panel_Key_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)
|
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 < MATRIX_VALIDATE_DLC(Panel_Key_DLC); _d[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[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[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) );
|
||||||
@ -118,9 +118,9 @@ uint32_t Pack_Panel_Key_Matrix(Panel_Key_t* _m, uint8_t* _d, uint8_t* _len, uint
|
|||||||
return Panel_Key_CANID;
|
return Panel_Key_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_STATE_Matrix(SCM_STATE_t* _m, const uint8_t* _d, uint8_t dlc_)
|
uint32_t Unpack_SCM_STATE_CANmatrix(SCM_STATE_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||||
{
|
{
|
||||||
(void)dlc_;
|
(void)dlc_;
|
||||||
_m->MOTOR_HG_STATE = (uint8_t) ( (_d[0] & (0x03U)) );
|
_m->MOTOR_HG_STATE = (uint8_t) ( (_d[0] & (0x03U)) );
|
||||||
@ -132,27 +132,37 @@ uint32_t Unpack_SCM_STATE_Matrix(SCM_STATE_t* _m, const uint8_t* _d, uint8_t dlc
|
|||||||
_m->ZY_FAN_STATE = (uint8_t) ( (_d[2] & (0x03U)) );
|
_m->ZY_FAN_STATE = (uint8_t) ( (_d[2] & (0x03U)) );
|
||||||
_m->ZY_HEAT_STATE = (uint8_t) ( ((_d[2] >> 2U) & (0x03U)) );
|
_m->ZY_HEAT_STATE = (uint8_t) ( ((_d[2] >> 2U) & (0x03U)) );
|
||||||
_m->ZY_MSSG_STATE = (uint8_t) ( ((_d[2] >> 4U) & (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 MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
_m->mon1.dlc_error = (dlc_ < SCM_STATE_DLC);
|
_m->mon1.dlc_error = (dlc_ < SCM_STATE_DLC);
|
||||||
_m->mon1.last_cycle = GetSystemTick();
|
_m->mon1.last_cycle = GetSystemTick();
|
||||||
_m->mon1.frame_cnt++;
|
_m->mon1.frame_cnt++;
|
||||||
|
|
||||||
FMon_SCM_STATE_matrix(&_m->mon1, SCM_STATE_CANID);
|
FMon_SCM_STATE_canmatrix(&_m->mon1, SCM_STATE_CANID);
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
return SCM_STATE_CANID;
|
return SCM_STATE_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Pack_SCM_STATE_Matrix(SCM_STATE_t* _m, __CoderDbcCanFrame_t__* cframe)
|
uint32_t Pack_SCM_STATE_CANmatrix(SCM_STATE_t* _m, __CoderDbcCanFrame_t__* cframe)
|
||||||
{
|
{
|
||||||
uint8_t i; for (i = 0u; i < MATRIX_VALIDATE_DLC(SCM_STATE_DLC); cframe->Data[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[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[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[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->MsgId = (uint32_t) SCM_STATE_CANID;
|
||||||
cframe->DLC = (uint8_t) SCM_STATE_DLC;
|
cframe->DLC = (uint8_t) SCM_STATE_DLC;
|
||||||
@ -162,22 +172,27 @@ uint32_t Pack_SCM_STATE_Matrix(SCM_STATE_t* _m, __CoderDbcCanFrame_t__* cframe)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t Pack_SCM_STATE_Matrix(SCM_STATE_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)
|
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 < MATRIX_VALIDATE_DLC(SCM_STATE_DLC); _d[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[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[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[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;
|
*_len = (uint8_t) SCM_STATE_DLC;
|
||||||
*_ide = (uint8_t) SCM_STATE_IDE;
|
*_ide = (uint8_t) SCM_STATE_IDE;
|
||||||
return SCM_STATE_CANID;
|
return SCM_STATE_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, const uint8_t* _d, uint8_t dlc_)
|
uint32_t Unpack_SCM_DEBUG1_CANmatrix(SCM_DEBUG1_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||||
{
|
{
|
||||||
(void)dlc_;
|
(void)dlc_;
|
||||||
_m->DEBUG_MOTOR_HG_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
_m->DEBUG_MOTOR_HG_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||||
@ -186,22 +201,22 @@ uint32_t Unpack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, const uint8_t* _d, uint8_t d
|
|||||||
_m->DEBUG_MOTOR_HG_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (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)) );
|
_m->DEBUG_MOTOR_HG_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG1_DLC);
|
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG1_DLC);
|
||||||
_m->mon1.last_cycle = GetSystemTick();
|
_m->mon1.last_cycle = GetSystemTick();
|
||||||
_m->mon1.frame_cnt++;
|
_m->mon1.frame_cnt++;
|
||||||
|
|
||||||
FMon_SCM_DEBUG1_matrix(&_m->mon1, SCM_DEBUG1_CANID);
|
FMon_SCM_DEBUG1_canmatrix(&_m->mon1, SCM_DEBUG1_CANID);
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
return SCM_DEBUG1_CANID;
|
return SCM_DEBUG1_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, __CoderDbcCanFrame_t__* cframe)
|
uint32_t Pack_SCM_DEBUG1_CANmatrix(SCM_DEBUG1_t* _m, __CoderDbcCanFrame_t__* cframe)
|
||||||
{
|
{
|
||||||
uint8_t i; for (i = 0u; i < MATRIX_VALIDATE_DLC(SCM_DEBUG1_DLC); cframe->Data[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_CURRENT & (0xFFU)) );
|
||||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STATUS & (0xFFU)) );
|
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STATUS & (0xFFU)) );
|
||||||
@ -220,9 +235,9 @@ uint32_t Pack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, __CoderDbcCanFrame_t__* cframe
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)
|
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 < MATRIX_VALIDATE_DLC(SCM_DEBUG1_DLC); _d[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_CURRENT & (0xFFU)) );
|
||||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STATUS & (0xFFU)) );
|
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STATUS & (0xFFU)) );
|
||||||
@ -238,9 +253,9 @@ uint32_t Pack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, uint8_t* _d, uint8_t* _len, ui
|
|||||||
return SCM_DEBUG1_CANID;
|
return SCM_DEBUG1_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, const uint8_t* _d, uint8_t dlc_)
|
uint32_t Unpack_SCM_DEBUG2_CANmatrix(SCM_DEBUG2_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||||
{
|
{
|
||||||
(void)dlc_;
|
(void)dlc_;
|
||||||
_m->DEBUG_MOTOR_KB_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
_m->DEBUG_MOTOR_KB_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||||
@ -249,22 +264,22 @@ uint32_t Unpack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, const uint8_t* _d, uint8_t d
|
|||||||
_m->DEBUG_MOTOR_KB_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (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)) );
|
_m->DEBUG_MOTOR_KB_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG2_DLC);
|
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG2_DLC);
|
||||||
_m->mon1.last_cycle = GetSystemTick();
|
_m->mon1.last_cycle = GetSystemTick();
|
||||||
_m->mon1.frame_cnt++;
|
_m->mon1.frame_cnt++;
|
||||||
|
|
||||||
FMon_SCM_DEBUG2_matrix(&_m->mon1, SCM_DEBUG2_CANID);
|
FMon_SCM_DEBUG2_canmatrix(&_m->mon1, SCM_DEBUG2_CANID);
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
return SCM_DEBUG2_CANID;
|
return SCM_DEBUG2_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, __CoderDbcCanFrame_t__* cframe)
|
uint32_t Pack_SCM_DEBUG2_CANmatrix(SCM_DEBUG2_t* _m, __CoderDbcCanFrame_t__* cframe)
|
||||||
{
|
{
|
||||||
uint8_t i; for (i = 0u; i < MATRIX_VALIDATE_DLC(SCM_DEBUG2_DLC); cframe->Data[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_CURRENT & (0xFFU)) );
|
||||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STATUS & (0xFFU)) );
|
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STATUS & (0xFFU)) );
|
||||||
@ -283,9 +298,9 @@ uint32_t Pack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, __CoderDbcCanFrame_t__* cframe
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)
|
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 < MATRIX_VALIDATE_DLC(SCM_DEBUG2_DLC); _d[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_CURRENT & (0xFFU)) );
|
||||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STATUS & (0xFFU)) );
|
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STATUS & (0xFFU)) );
|
||||||
@ -301,9 +316,9 @@ uint32_t Pack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, uint8_t* _d, uint8_t* _len, ui
|
|||||||
return SCM_DEBUG2_CANID;
|
return SCM_DEBUG2_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, const uint8_t* _d, uint8_t dlc_)
|
uint32_t Unpack_SCM_DEBUG3_CANmatrix(SCM_DEBUG3_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||||
{
|
{
|
||||||
(void)dlc_;
|
(void)dlc_;
|
||||||
_m->DEBUG_MOTOR_TT_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
_m->DEBUG_MOTOR_TT_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||||
@ -312,22 +327,22 @@ uint32_t Unpack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, const uint8_t* _d, uint8_t d
|
|||||||
_m->DEBUG_MOTOR_TT_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (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)) );
|
_m->DEBUG_MOTOR_TT_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG3_DLC);
|
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG3_DLC);
|
||||||
_m->mon1.last_cycle = GetSystemTick();
|
_m->mon1.last_cycle = GetSystemTick();
|
||||||
_m->mon1.frame_cnt++;
|
_m->mon1.frame_cnt++;
|
||||||
|
|
||||||
FMon_SCM_DEBUG3_matrix(&_m->mon1, SCM_DEBUG3_CANID);
|
FMon_SCM_DEBUG3_canmatrix(&_m->mon1, SCM_DEBUG3_CANID);
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
return SCM_DEBUG3_CANID;
|
return SCM_DEBUG3_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, __CoderDbcCanFrame_t__* cframe)
|
uint32_t Pack_SCM_DEBUG3_CANmatrix(SCM_DEBUG3_t* _m, __CoderDbcCanFrame_t__* cframe)
|
||||||
{
|
{
|
||||||
uint8_t i; for (i = 0u; i < MATRIX_VALIDATE_DLC(SCM_DEBUG3_DLC); cframe->Data[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_CURRENT & (0xFFU)) );
|
||||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STATUS & (0xFFU)) );
|
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STATUS & (0xFFU)) );
|
||||||
@ -346,9 +361,9 @@ uint32_t Pack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, __CoderDbcCanFrame_t__* cframe
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)
|
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 < MATRIX_VALIDATE_DLC(SCM_DEBUG3_DLC); _d[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_CURRENT & (0xFFU)) );
|
||||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STATUS & (0xFFU)) );
|
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STATUS & (0xFFU)) );
|
||||||
@ -364,9 +379,9 @@ uint32_t Pack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, uint8_t* _d, uint8_t* _len, ui
|
|||||||
return SCM_DEBUG3_CANID;
|
return SCM_DEBUG3_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, const uint8_t* _d, uint8_t dlc_)
|
uint32_t Unpack_SCM_DEBUG4_CANmatrix(SCM_DEBUG4_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||||
{
|
{
|
||||||
(void)dlc_;
|
(void)dlc_;
|
||||||
_m->DEBUG_MOTOR_ZY_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
_m->DEBUG_MOTOR_ZY_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||||
@ -375,22 +390,22 @@ uint32_t Unpack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, const uint8_t* _d, uint8_t d
|
|||||||
_m->DEBUG_MOTOR_ZY_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (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)) );
|
_m->DEBUG_MOTOR_ZY_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG4_DLC);
|
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG4_DLC);
|
||||||
_m->mon1.last_cycle = GetSystemTick();
|
_m->mon1.last_cycle = GetSystemTick();
|
||||||
_m->mon1.frame_cnt++;
|
_m->mon1.frame_cnt++;
|
||||||
|
|
||||||
FMon_SCM_DEBUG4_matrix(&_m->mon1, SCM_DEBUG4_CANID);
|
FMon_SCM_DEBUG4_canmatrix(&_m->mon1, SCM_DEBUG4_CANID);
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
return SCM_DEBUG4_CANID;
|
return SCM_DEBUG4_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, __CoderDbcCanFrame_t__* cframe)
|
uint32_t Pack_SCM_DEBUG4_CANmatrix(SCM_DEBUG4_t* _m, __CoderDbcCanFrame_t__* cframe)
|
||||||
{
|
{
|
||||||
uint8_t i; for (i = 0u; i < MATRIX_VALIDATE_DLC(SCM_DEBUG4_DLC); cframe->Data[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_CURRENT & (0xFFU)) );
|
||||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STATUS & (0xFFU)) );
|
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STATUS & (0xFFU)) );
|
||||||
@ -409,9 +424,9 @@ uint32_t Pack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, __CoderDbcCanFrame_t__* cframe
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)
|
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 < MATRIX_VALIDATE_DLC(SCM_DEBUG4_DLC); _d[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_CURRENT & (0xFFU)) );
|
||||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STATUS & (0xFFU)) );
|
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STATUS & (0xFFU)) );
|
||||||
@ -427,9 +442,9 @@ uint32_t Pack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, uint8_t* _d, uint8_t* _len, ui
|
|||||||
return SCM_DEBUG4_CANID;
|
return SCM_DEBUG4_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, const uint8_t* _d, uint8_t dlc_)
|
uint32_t Unpack_SCM_DEBUG5_CANmatrix(SCM_DEBUG5_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||||
{
|
{
|
||||||
(void)dlc_;
|
(void)dlc_;
|
||||||
_m->DEBUG_MOTOR_TZ_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
_m->DEBUG_MOTOR_TZ_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||||
@ -438,22 +453,22 @@ uint32_t Unpack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, const uint8_t* _d, uint8_t d
|
|||||||
_m->DEBUG_MOTOR_TZ_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (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)) );
|
_m->DEBUG_MOTOR_TZ_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG5_DLC);
|
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG5_DLC);
|
||||||
_m->mon1.last_cycle = GetSystemTick();
|
_m->mon1.last_cycle = GetSystemTick();
|
||||||
_m->mon1.frame_cnt++;
|
_m->mon1.frame_cnt++;
|
||||||
|
|
||||||
FMon_SCM_DEBUG5_matrix(&_m->mon1, SCM_DEBUG5_CANID);
|
FMon_SCM_DEBUG5_canmatrix(&_m->mon1, SCM_DEBUG5_CANID);
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
return SCM_DEBUG5_CANID;
|
return SCM_DEBUG5_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, __CoderDbcCanFrame_t__* cframe)
|
uint32_t Pack_SCM_DEBUG5_CANmatrix(SCM_DEBUG5_t* _m, __CoderDbcCanFrame_t__* cframe)
|
||||||
{
|
{
|
||||||
uint8_t i; for (i = 0u; i < MATRIX_VALIDATE_DLC(SCM_DEBUG5_DLC); cframe->Data[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_CURRENT & (0xFFU)) );
|
||||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STATUS & (0xFFU)) );
|
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STATUS & (0xFFU)) );
|
||||||
@ -472,9 +487,9 @@ uint32_t Pack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, __CoderDbcCanFrame_t__* cframe
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)
|
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 < MATRIX_VALIDATE_DLC(SCM_DEBUG5_DLC); _d[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_CURRENT & (0xFFU)) );
|
||||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STATUS & (0xFFU)) );
|
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STATUS & (0xFFU)) );
|
||||||
@ -490,9 +505,9 @@ uint32_t Pack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, uint8_t* _d, uint8_t* _len, ui
|
|||||||
return SCM_DEBUG5_CANID;
|
return SCM_DEBUG5_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, const uint8_t* _d, uint8_t dlc_)
|
uint32_t Unpack_SCM_DEBUG6_CANmatrix(SCM_DEBUG6_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||||
{
|
{
|
||||||
(void)dlc_;
|
(void)dlc_;
|
||||||
_m->DEBUG_MOTOR_YT_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
_m->DEBUG_MOTOR_YT_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||||
@ -501,22 +516,22 @@ uint32_t Unpack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, const uint8_t* _d, uint8_t d
|
|||||||
_m->DEBUG_MOTOR_YT_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (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)) );
|
_m->DEBUG_MOTOR_YT_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG6_DLC);
|
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG6_DLC);
|
||||||
_m->mon1.last_cycle = GetSystemTick();
|
_m->mon1.last_cycle = GetSystemTick();
|
||||||
_m->mon1.frame_cnt++;
|
_m->mon1.frame_cnt++;
|
||||||
|
|
||||||
FMon_SCM_DEBUG6_matrix(&_m->mon1, SCM_DEBUG6_CANID);
|
FMon_SCM_DEBUG6_canmatrix(&_m->mon1, SCM_DEBUG6_CANID);
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
return SCM_DEBUG6_CANID;
|
return SCM_DEBUG6_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, __CoderDbcCanFrame_t__* cframe)
|
uint32_t Pack_SCM_DEBUG6_CANmatrix(SCM_DEBUG6_t* _m, __CoderDbcCanFrame_t__* cframe)
|
||||||
{
|
{
|
||||||
uint8_t i; for (i = 0u; i < MATRIX_VALIDATE_DLC(SCM_DEBUG6_DLC); cframe->Data[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_CURRENT & (0xFFU)) );
|
||||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STATUS & (0xFFU)) );
|
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STATUS & (0xFFU)) );
|
||||||
@ -535,9 +550,9 @@ uint32_t Pack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, __CoderDbcCanFrame_t__* cframe
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
uint32_t Pack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)
|
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 < MATRIX_VALIDATE_DLC(SCM_DEBUG6_DLC); _d[i++] = MATRIX_INITIAL_BYTE_VALUE);
|
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[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_CURRENT & (0xFFU)) );
|
||||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STATUS & (0xFFU)) );
|
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STATUS & (0xFFU)) );
|
||||||
@ -553,5 +568,5 @@ uint32_t Pack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, uint8_t* _d, uint8_t* _len, ui
|
|||||||
return SCM_DEBUG6_CANID;
|
return SCM_DEBUG6_CANID;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
// Generator version : v3.1
|
// Generator version : v3.1
|
||||||
// Generation time : 2024.11.18 11:42:14
|
// Generation time : 2024.12.07 13:54:48
|
||||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
// DBC filename : DMK-RP-01_CAN_V0.1_20241207.dbc
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -10,36 +10,36 @@ extern "C" {
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// DBC file version
|
// DBC file version
|
||||||
#define VER_MATRIX_MAJ (0U)
|
#define VER_CANMATRIX_MAJ (0U)
|
||||||
#define VER_MATRIX_MIN (0U)
|
#define VER_CANMATRIX_MIN (0U)
|
||||||
|
|
||||||
// include current dbc-driver compilation config
|
// include current dbc-driver compilation config
|
||||||
#include "matrix-config.h"
|
#include "canmatrix-config.h"
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
// This file must define:
|
// This file must define:
|
||||||
// base monitor struct
|
// base monitor struct
|
||||||
#include "canmonitorutil.h"
|
#include "canmonitorutil.h"
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
|
|
||||||
// DLC maximum value which is used as the limit for frame's data buffer size.
|
// DLC maximum value which is used as the limit for frame's data buffer size.
|
||||||
// Client can set its own value (not sure why) in driver-config
|
// Client can set its own value (not sure why) in driver-config
|
||||||
// or can test it on some limit specified by application
|
// or can test it on some limit specified by application
|
||||||
// e.g.: static_assert(TESTDB_MAX_DLC_VALUE <= APPLICATION_FRAME_DATA_SIZE, "Max DLC value in the driver is too big")
|
// e.g.: static_assert(TESTDB_MAX_DLC_VALUE <= APPLICATION_FRAME_DATA_SIZE, "Max DLC value in the driver is too big")
|
||||||
#ifndef MATRIX_MAX_DLC_VALUE
|
#ifndef CANMATRIX_MAX_DLC_VALUE
|
||||||
// The value which was found out by generator (real max value)
|
// The value which was found out by generator (real max value)
|
||||||
#define MATRIX_MAX_DLC_VALUE 8U
|
#define CANMATRIX_MAX_DLC_VALUE 8U
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The limit is used for setting frame's data bytes
|
// The limit is used for setting frame's data bytes
|
||||||
#define MATRIX_VALIDATE_DLC(msgDlc) (((msgDlc) <= (MATRIX_MAX_DLC_VALUE)) ? (msgDlc) : (MATRIX_MAX_DLC_VALUE))
|
#define CANMATRIX_VALIDATE_DLC(msgDlc) (((msgDlc) <= (CANMATRIX_MAX_DLC_VALUE)) ? (msgDlc) : (CANMATRIX_MAX_DLC_VALUE))
|
||||||
|
|
||||||
// Initial byte value to be filles in data bytes of the frame before pack signals
|
// Initial byte value to be filles in data bytes of the frame before pack signals
|
||||||
// User can define its own custom value in driver-config file
|
// User can define its own custom value in driver-config file
|
||||||
#ifndef MATRIX_INITIAL_BYTE_VALUE
|
#ifndef CANMATRIX_INITIAL_BYTE_VALUE
|
||||||
#define MATRIX_INITIAL_BYTE_VALUE 0U
|
#define CANMATRIX_INITIAL_BYTE_VALUE 0U
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef MATRIX_USE_BITS_SIGNAL
|
#ifdef CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
// 1 : "PRESSED"
|
// 1 : "PRESSED"
|
||||||
// 0 : "NOT_PRESS"
|
// 0 : "NOT_PRESS"
|
||||||
@ -455,13 +455,13 @@ typedef struct
|
|||||||
// 0 : "NOT_PRESS"
|
// 0 : "NOT_PRESS"
|
||||||
uint8_t KEY_RESET; // Bits= 1
|
uint8_t KEY_RESET; // Bits= 1
|
||||||
|
|
||||||
#endif // MATRIX_USE_BITS_SIGNAL
|
#endif // CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
FrameMonitor_t mon1;
|
FrameMonitor_t mon1;
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
} Panel_Key_t;
|
} Panel_Key_t;
|
||||||
|
|
||||||
@ -643,7 +643,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef MATRIX_USE_BITS_SIGNAL
|
#ifdef CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
// 3 : "FAULT"
|
// 3 : "FAULT"
|
||||||
// 2 : "ACT_CCW"
|
// 2 : "ACT_CCW"
|
||||||
@ -699,6 +699,16 @@ typedef struct
|
|||||||
// 0 : "OFF"
|
// 0 : "OFF"
|
||||||
uint8_t ZY_MSSG_STATE : 2; // Bits= 2
|
uint8_t ZY_MSSG_STATE : 2; // Bits= 2
|
||||||
|
|
||||||
|
uint8_t test1; // Bits= 8
|
||||||
|
|
||||||
|
uint8_t test2; // Bits= 8
|
||||||
|
|
||||||
|
uint8_t test3; // Bits= 8
|
||||||
|
|
||||||
|
uint8_t test4; // Bits= 8
|
||||||
|
|
||||||
|
uint8_t test5; // Bits= 8
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// 3 : "FAULT"
|
// 3 : "FAULT"
|
||||||
@ -755,13 +765,23 @@ typedef struct
|
|||||||
// 0 : "OFF"
|
// 0 : "OFF"
|
||||||
uint8_t ZY_MSSG_STATE; // Bits= 2
|
uint8_t ZY_MSSG_STATE; // Bits= 2
|
||||||
|
|
||||||
#endif // MATRIX_USE_BITS_SIGNAL
|
uint8_t test1; // Bits= 8
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
uint8_t test2; // Bits= 8
|
||||||
|
|
||||||
|
uint8_t test3; // Bits= 8
|
||||||
|
|
||||||
|
uint8_t test4; // Bits= 8
|
||||||
|
|
||||||
|
uint8_t test5; // Bits= 8
|
||||||
|
|
||||||
|
#endif // CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
FrameMonitor_t mon1;
|
FrameMonitor_t mon1;
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
} SCM_STATE_t;
|
} SCM_STATE_t;
|
||||||
|
|
||||||
@ -773,7 +793,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef MATRIX_USE_BITS_SIGNAL
|
#ifdef CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
uint8_t DEBUG_MOTOR_HG_CURRENT; // Bits= 8
|
uint8_t DEBUG_MOTOR_HG_CURRENT; // Bits= 8
|
||||||
|
|
||||||
@ -797,13 +817,13 @@ typedef struct
|
|||||||
|
|
||||||
uint16_t DEBUG_MOTOR_HG_STOP_2; // Bits=16
|
uint16_t DEBUG_MOTOR_HG_STOP_2; // Bits=16
|
||||||
|
|
||||||
#endif // MATRIX_USE_BITS_SIGNAL
|
#endif // CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
FrameMonitor_t mon1;
|
FrameMonitor_t mon1;
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
} SCM_DEBUG1_t;
|
} SCM_DEBUG1_t;
|
||||||
|
|
||||||
@ -815,7 +835,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef MATRIX_USE_BITS_SIGNAL
|
#ifdef CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
uint8_t DEBUG_MOTOR_KB_CURRENT; // Bits= 8
|
uint8_t DEBUG_MOTOR_KB_CURRENT; // Bits= 8
|
||||||
|
|
||||||
@ -839,13 +859,13 @@ typedef struct
|
|||||||
|
|
||||||
uint16_t DEBUG_MOTOR_KB_STOP_2; // Bits=16
|
uint16_t DEBUG_MOTOR_KB_STOP_2; // Bits=16
|
||||||
|
|
||||||
#endif // MATRIX_USE_BITS_SIGNAL
|
#endif // CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
FrameMonitor_t mon1;
|
FrameMonitor_t mon1;
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
} SCM_DEBUG2_t;
|
} SCM_DEBUG2_t;
|
||||||
|
|
||||||
@ -857,7 +877,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef MATRIX_USE_BITS_SIGNAL
|
#ifdef CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
uint8_t DEBUG_MOTOR_TT_CURRENT; // Bits= 8
|
uint8_t DEBUG_MOTOR_TT_CURRENT; // Bits= 8
|
||||||
|
|
||||||
@ -881,13 +901,13 @@ typedef struct
|
|||||||
|
|
||||||
uint16_t DEBUG_MOTOR_TT_STOP_2; // Bits=16
|
uint16_t DEBUG_MOTOR_TT_STOP_2; // Bits=16
|
||||||
|
|
||||||
#endif // MATRIX_USE_BITS_SIGNAL
|
#endif // CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
FrameMonitor_t mon1;
|
FrameMonitor_t mon1;
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
} SCM_DEBUG3_t;
|
} SCM_DEBUG3_t;
|
||||||
|
|
||||||
@ -899,7 +919,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef MATRIX_USE_BITS_SIGNAL
|
#ifdef CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
uint8_t DEBUG_MOTOR_ZY_CURRENT; // Bits= 8
|
uint8_t DEBUG_MOTOR_ZY_CURRENT; // Bits= 8
|
||||||
|
|
||||||
@ -923,13 +943,13 @@ typedef struct
|
|||||||
|
|
||||||
uint16_t DEBUG_MOTOR_ZY_STOP_2; // Bits=16
|
uint16_t DEBUG_MOTOR_ZY_STOP_2; // Bits=16
|
||||||
|
|
||||||
#endif // MATRIX_USE_BITS_SIGNAL
|
#endif // CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
FrameMonitor_t mon1;
|
FrameMonitor_t mon1;
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
} SCM_DEBUG4_t;
|
} SCM_DEBUG4_t;
|
||||||
|
|
||||||
@ -941,7 +961,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef MATRIX_USE_BITS_SIGNAL
|
#ifdef CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
uint8_t DEBUG_MOTOR_TZ_CURRENT; // Bits= 8
|
uint8_t DEBUG_MOTOR_TZ_CURRENT; // Bits= 8
|
||||||
|
|
||||||
@ -965,13 +985,13 @@ typedef struct
|
|||||||
|
|
||||||
uint16_t DEBUG_MOTOR_TZ_STOP_2; // Bits=16
|
uint16_t DEBUG_MOTOR_TZ_STOP_2; // Bits=16
|
||||||
|
|
||||||
#endif // MATRIX_USE_BITS_SIGNAL
|
#endif // CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
FrameMonitor_t mon1;
|
FrameMonitor_t mon1;
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
} SCM_DEBUG5_t;
|
} SCM_DEBUG5_t;
|
||||||
|
|
||||||
@ -983,7 +1003,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef MATRIX_USE_BITS_SIGNAL
|
#ifdef CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
uint8_t DEBUG_MOTOR_YT_CURRENT; // Bits= 8
|
uint8_t DEBUG_MOTOR_YT_CURRENT; // Bits= 8
|
||||||
|
|
||||||
@ -1007,73 +1027,73 @@ typedef struct
|
|||||||
|
|
||||||
uint16_t DEBUG_MOTOR_YT_STOP_2; // Bits=16
|
uint16_t DEBUG_MOTOR_YT_STOP_2; // Bits=16
|
||||||
|
|
||||||
#endif // MATRIX_USE_BITS_SIGNAL
|
#endif // CANMATRIX_USE_BITS_SIGNAL
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
FrameMonitor_t mon1;
|
FrameMonitor_t mon1;
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
} SCM_DEBUG6_t;
|
} SCM_DEBUG6_t;
|
||||||
|
|
||||||
// Function signatures
|
// Function signatures
|
||||||
|
|
||||||
uint32_t Unpack_Panel_Key_Matrix(Panel_Key_t* _m, const uint8_t* _d, uint8_t dlc_);
|
uint32_t Unpack_Panel_Key_CANmatrix(Panel_Key_t* _m, const uint8_t* _d, uint8_t dlc_);
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
uint32_t Pack_Panel_Key_Matrix(Panel_Key_t* _m, __CoderDbcCanFrame_t__* cframe);
|
uint32_t Pack_Panel_Key_CANmatrix(Panel_Key_t* _m, __CoderDbcCanFrame_t__* cframe);
|
||||||
#else
|
#else
|
||||||
uint32_t Pack_Panel_Key_Matrix(Panel_Key_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
uint32_t Pack_Panel_Key_CANmatrix(Panel_Key_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_STATE_Matrix(SCM_STATE_t* _m, const uint8_t* _d, uint8_t dlc_);
|
uint32_t Unpack_SCM_STATE_CANmatrix(SCM_STATE_t* _m, const uint8_t* _d, uint8_t dlc_);
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
uint32_t Pack_SCM_STATE_Matrix(SCM_STATE_t* _m, __CoderDbcCanFrame_t__* cframe);
|
uint32_t Pack_SCM_STATE_CANmatrix(SCM_STATE_t* _m, __CoderDbcCanFrame_t__* cframe);
|
||||||
#else
|
#else
|
||||||
uint32_t Pack_SCM_STATE_Matrix(SCM_STATE_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
uint32_t Pack_SCM_STATE_CANmatrix(SCM_STATE_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, const uint8_t* _d, uint8_t dlc_);
|
uint32_t Unpack_SCM_DEBUG1_CANmatrix(SCM_DEBUG1_t* _m, const uint8_t* _d, uint8_t dlc_);
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
uint32_t Pack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, __CoderDbcCanFrame_t__* cframe);
|
uint32_t Pack_SCM_DEBUG1_CANmatrix(SCM_DEBUG1_t* _m, __CoderDbcCanFrame_t__* cframe);
|
||||||
#else
|
#else
|
||||||
uint32_t Pack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
uint32_t Pack_SCM_DEBUG1_CANmatrix(SCM_DEBUG1_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, const uint8_t* _d, uint8_t dlc_);
|
uint32_t Unpack_SCM_DEBUG2_CANmatrix(SCM_DEBUG2_t* _m, const uint8_t* _d, uint8_t dlc_);
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
uint32_t Pack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, __CoderDbcCanFrame_t__* cframe);
|
uint32_t Pack_SCM_DEBUG2_CANmatrix(SCM_DEBUG2_t* _m, __CoderDbcCanFrame_t__* cframe);
|
||||||
#else
|
#else
|
||||||
uint32_t Pack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
uint32_t Pack_SCM_DEBUG2_CANmatrix(SCM_DEBUG2_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, const uint8_t* _d, uint8_t dlc_);
|
uint32_t Unpack_SCM_DEBUG3_CANmatrix(SCM_DEBUG3_t* _m, const uint8_t* _d, uint8_t dlc_);
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
uint32_t Pack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, __CoderDbcCanFrame_t__* cframe);
|
uint32_t Pack_SCM_DEBUG3_CANmatrix(SCM_DEBUG3_t* _m, __CoderDbcCanFrame_t__* cframe);
|
||||||
#else
|
#else
|
||||||
uint32_t Pack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
uint32_t Pack_SCM_DEBUG3_CANmatrix(SCM_DEBUG3_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, const uint8_t* _d, uint8_t dlc_);
|
uint32_t Unpack_SCM_DEBUG4_CANmatrix(SCM_DEBUG4_t* _m, const uint8_t* _d, uint8_t dlc_);
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
uint32_t Pack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, __CoderDbcCanFrame_t__* cframe);
|
uint32_t Pack_SCM_DEBUG4_CANmatrix(SCM_DEBUG4_t* _m, __CoderDbcCanFrame_t__* cframe);
|
||||||
#else
|
#else
|
||||||
uint32_t Pack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
uint32_t Pack_SCM_DEBUG4_CANmatrix(SCM_DEBUG4_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, const uint8_t* _d, uint8_t dlc_);
|
uint32_t Unpack_SCM_DEBUG5_CANmatrix(SCM_DEBUG5_t* _m, const uint8_t* _d, uint8_t dlc_);
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
uint32_t Pack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, __CoderDbcCanFrame_t__* cframe);
|
uint32_t Pack_SCM_DEBUG5_CANmatrix(SCM_DEBUG5_t* _m, __CoderDbcCanFrame_t__* cframe);
|
||||||
#else
|
#else
|
||||||
uint32_t Pack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
uint32_t Pack_SCM_DEBUG5_CANmatrix(SCM_DEBUG5_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
uint32_t Unpack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, const uint8_t* _d, uint8_t dlc_);
|
uint32_t Unpack_SCM_DEBUG6_CANmatrix(SCM_DEBUG6_t* _m, const uint8_t* _d, uint8_t dlc_);
|
||||||
#ifdef MATRIX_USE_CANSTRUCT
|
#ifdef CANMATRIX_USE_CANSTRUCT
|
||||||
uint32_t Pack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, __CoderDbcCanFrame_t__* cframe);
|
uint32_t Pack_SCM_DEBUG6_CANmatrix(SCM_DEBUG6_t* _m, __CoderDbcCanFrame_t__* cframe);
|
||||||
#else
|
#else
|
||||||
uint32_t Pack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
uint32_t Pack_SCM_DEBUG6_CANmatrix(SCM_DEBUG6_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);
|
||||||
#endif // MATRIX_USE_CANSTRUCT
|
#endif // CANMATRIX_USE_CANSTRUCT
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
73
cva_asw_m0146/src/CANmatrix/usr/canmatrix-fmon.c
Normal file
73
cva_asw_m0146/src/CANmatrix/usr/canmatrix-fmon.c
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// Generator version : v3.1
|
||||||
|
// Generation time : 2024.12.07 08:59:44
|
||||||
|
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
||||||
|
#include "canmatrix-fmon.h"
|
||||||
|
|
||||||
|
#ifdef CANMATRIX_USE_DIAG_MONITORS
|
||||||
|
|
||||||
|
/*
|
||||||
|
Put the monitor function content here, keep in mind -
|
||||||
|
next generation will completely clear all manually added code (!)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CANMATRIX_USE_MONO_FMON
|
||||||
|
|
||||||
|
void _FMon_MONO_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
void _FMon_Panel_Key_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _FMon_SCM_STATE_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _FMon_SCM_DEBUG1_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _FMon_SCM_DEBUG2_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _FMon_SCM_DEBUG3_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _FMon_SCM_DEBUG4_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _FMon_SCM_DEBUG5_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _FMon_SCM_DEBUG6_canmatrix(FrameMonitor_t* _mon, uint32_t msgid)
|
||||||
|
{
|
||||||
|
(void)_mon;
|
||||||
|
(void)msgid;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // CANMATRIX_USE_MONO_FMON
|
||||||
|
|
||||||
|
#endif // CANMATRIX_USE_DIAG_MONITORS
|
@ -1,28 +0,0 @@
|
|||||||
// Generator version : v3.1
|
|
||||||
// Generation time : 2024.11.18 11:42:14
|
|
||||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
|
||||||
#include "scm_matrix-binutil.h"
|
|
||||||
|
|
||||||
// DBC file version
|
|
||||||
#if (VER_MATRIX_MAJ != (0U)) || (VER_MATRIX_MIN != (0U))
|
|
||||||
#error The SCM_MATRIX binutil source file has inconsistency with core dbc lib!
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __DEF_SCM_MATRIX__
|
|
||||||
|
|
||||||
scm_matrix_rx_t scm_matrix_rx;
|
|
||||||
|
|
||||||
scm_matrix_tx_t scm_matrix_tx;
|
|
||||||
|
|
||||||
#endif // __DEF_SCM_MATRIX__
|
|
||||||
|
|
||||||
uint32_t scm_matrix_Receive(scm_matrix_rx_t* _m, const uint8_t* _d, uint32_t _id, uint8_t dlc_)
|
|
||||||
{
|
|
||||||
uint32_t recid = 0;
|
|
||||||
if (_id == 0x201U) {
|
|
||||||
recid = Unpack_Panel_Key_Matrix(&(_m->Panel_Key), _d, dlc_);
|
|
||||||
}
|
|
||||||
|
|
||||||
return recid;
|
|
||||||
}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
|||||||
// Generator version : v3.1
|
|
||||||
// Generation time : 2024.11.18 11:42:14
|
|
||||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// DBC file version
|
|
||||||
#define VER_MATRIX_MAJ_FMON (0U)
|
|
||||||
#define VER_MATRIX_MIN_FMON (0U)
|
|
||||||
|
|
||||||
#include "matrix-config.h"
|
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
|
||||||
|
|
||||||
#include "canmonitorutil.h"
|
|
||||||
/*
|
|
||||||
This file contains the prototypes of all the functions that will be called
|
|
||||||
from each Unpack_*name* function to detect DBC related errors
|
|
||||||
It is the user responsibility to defined these functions in the
|
|
||||||
separated .c file. If it won't be done the linkage error will happen
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef MATRIX_USE_MONO_FMON
|
|
||||||
|
|
||||||
void _FMon_MONO_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
|
|
||||||
#define FMon_Panel_Key_matrix(x, y) _FMon_MONO_matrix((x), (y))
|
|
||||||
#define FMon_SCM_STATE_matrix(x, y) _FMon_MONO_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG1_matrix(x, y) _FMon_MONO_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG2_matrix(x, y) _FMon_MONO_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG3_matrix(x, y) _FMon_MONO_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG4_matrix(x, y) _FMon_MONO_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG5_matrix(x, y) _FMon_MONO_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG6_matrix(x, y) _FMon_MONO_matrix((x), (y))
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
void _FMon_Panel_Key_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
void _FMon_SCM_STATE_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
void _FMon_SCM_DEBUG1_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
void _FMon_SCM_DEBUG2_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
void _FMon_SCM_DEBUG3_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
void _FMon_SCM_DEBUG4_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
void _FMon_SCM_DEBUG5_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
void _FMon_SCM_DEBUG6_matrix(FrameMonitor_t* _mon, uint32_t msgid);
|
|
||||||
|
|
||||||
#define FMon_Panel_Key_matrix(x, y) _FMon_Panel_Key_matrix((x), (y))
|
|
||||||
#define FMon_SCM_STATE_matrix(x, y) _FMon_SCM_STATE_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG1_matrix(x, y) _FMon_SCM_DEBUG1_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG2_matrix(x, y) _FMon_SCM_DEBUG2_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG3_matrix(x, y) _FMon_SCM_DEBUG3_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG4_matrix(x, y) _FMon_SCM_DEBUG4_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG5_matrix(x, y) _FMon_SCM_DEBUG5_matrix((x), (y))
|
|
||||||
#define FMon_SCM_DEBUG6_matrix(x, y) _FMon_SCM_DEBUG6_matrix((x), (y))
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,73 +0,0 @@
|
|||||||
// Generator version : v3.1
|
|
||||||
// Generation time : 2024.11.18 11:42:14
|
|
||||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
|
||||||
#include "matrix-fmon.h"
|
|
||||||
|
|
||||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
|
||||||
|
|
||||||
/*
|
|
||||||
Put the monitor function content here, keep in mind -
|
|
||||||
next generation will completely clear all manually added code (!)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef MATRIX_USE_MONO_FMON
|
|
||||||
|
|
||||||
void _FMon_MONO_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
void _FMon_Panel_Key_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _FMon_SCM_STATE_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _FMon_SCM_DEBUG1_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _FMon_SCM_DEBUG2_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _FMon_SCM_DEBUG3_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _FMon_SCM_DEBUG4_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _FMon_SCM_DEBUG5_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _FMon_SCM_DEBUG6_matrix(FrameMonitor_t* _mon, uint32_t msgid)
|
|
||||||
{
|
|
||||||
(void)_mon;
|
|
||||||
(void)msgid;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // MATRIX_USE_MONO_FMON
|
|
||||||
|
|
||||||
#endif // MATRIX_USE_DIAG_MONITORS
|
|
@ -1,6 +1,6 @@
|
|||||||
#include "MotorCtrl.h"
|
#include "MotorCtrl.h"
|
||||||
#include "hwctrl.h"
|
#include "hwctrl.h"
|
||||||
|
#include "scm_canmatrix-binutil.h"
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the defines
|
* the defines
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@ -69,7 +69,7 @@ uint16_t HallErrorCount[6];
|
|||||||
static void MotorCtrl(void);
|
static void MotorCtrl(void);
|
||||||
static void AutoCalCtrl(void);
|
static void AutoCalCtrl(void);
|
||||||
static void MotorValueInit(void);
|
static void MotorValueInit(void);
|
||||||
|
static void CurrentDetect(void);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the local functions
|
* the local functions
|
||||||
@ -103,8 +103,8 @@ static void AutoCalCtrl(void)
|
|||||||
MotorArr1state = 1;
|
MotorArr1state = 1;
|
||||||
MotorArr2state = 1;
|
MotorArr2state = 1;
|
||||||
MotorArr3state = 1;
|
MotorArr3state = 1;
|
||||||
setMotorState(Motor1,Motor_ACT_CW);
|
setMotorState(MotorHG,Motor_ACT_CW);
|
||||||
setMotorState(Motor3,Motor_ACT_CW);
|
setMotorState(MotorTT,Motor_ACT_CW);
|
||||||
setMotorState(Motor5,Motor_ACT_CW);
|
setMotorState(Motor5,Motor_ACT_CW);
|
||||||
autocalcounter[0] = 0;
|
autocalcounter[0] = 0;
|
||||||
autocalcounter[1] = 0;
|
autocalcounter[1] = 0;
|
||||||
@ -144,17 +144,17 @@ static void AutoCalCtrl(void)
|
|||||||
{
|
{
|
||||||
case 1://Motor1 xq
|
case 1://Motor1 xq
|
||||||
autocalcounter[0]++;
|
autocalcounter[0]++;
|
||||||
if (MotorHardStop1[Motor1] != 0)
|
if (MotorHardStop1[MotorHG] != 0)
|
||||||
{
|
{
|
||||||
MotorArr1state++;
|
MotorArr1state++;
|
||||||
wait1 = 0;
|
wait1 = 0;
|
||||||
setMotorState(Motor1,Motor_ACT_NOACT);
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
if (autocalcounter[0] > 3000 || MotorErr[Motor1] != 0)
|
if (autocalcounter[0] > 3000 || MotorErr[MotorHG] != 0)
|
||||||
{
|
{
|
||||||
MotorArr1state = 4;
|
MotorArr1state = 4;
|
||||||
wait1 = 0;
|
wait1 = 0;
|
||||||
setMotorState(Motor1,Motor_ACT_NOACT);
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2://wait
|
case 2://wait
|
||||||
@ -162,23 +162,23 @@ static void AutoCalCtrl(void)
|
|||||||
if (wait1 > 50)
|
if (wait1 > 50)
|
||||||
{
|
{
|
||||||
MotorArr1state++;
|
MotorArr1state++;
|
||||||
setMotorState(Motor1,Motor_ACT_CCW);
|
setMotorState(MotorHG,Motor_ACT_CCW);
|
||||||
autocalcounter[0] = 0;
|
autocalcounter[0] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3://Motor1 xh
|
case 3://Motor1 xh
|
||||||
autocalcounter[0]++;
|
autocalcounter[0]++;
|
||||||
if (MotorHardStop2[Motor1] != 0)
|
if (MotorHardStop2[MotorHG] != 0)
|
||||||
{
|
{
|
||||||
MotorArr1state++;
|
MotorArr1state++;
|
||||||
wait1 = 0;
|
wait1 = 0;
|
||||||
setMotorState(Motor1,Motor_ACT_NOACT);
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
if (autocalcounter[0] > 3000 || MotorErr[Motor1] != 0)
|
if (autocalcounter[0] > 3000 || MotorErr[MotorHG] != 0)
|
||||||
{
|
{
|
||||||
MotorArr1state = 4;
|
MotorArr1state = 4;
|
||||||
wait1 = 0;
|
wait1 = 0;
|
||||||
setMotorState(Motor1,Motor_ACT_NOACT);
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4://wait
|
case 4://wait
|
||||||
@ -186,22 +186,22 @@ static void AutoCalCtrl(void)
|
|||||||
if (wait1 > 50)
|
if (wait1 > 50)
|
||||||
{
|
{
|
||||||
MotorArr1state++;
|
MotorArr1state++;
|
||||||
setMotorState(Motor2,Motor_ACT_CW);
|
setMotorState(MotorKB,Motor_ACT_CW);
|
||||||
autocalcounter[0] = 0;
|
autocalcounter[0] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5://Motor2 xq
|
case 5://Motor2 xq
|
||||||
autocalcounter[0]++;
|
autocalcounter[0]++;
|
||||||
if (MotorHardStop1[Motor2] != 0)
|
if (MotorHardStop1[MotorKB] != 0)
|
||||||
{
|
{
|
||||||
MotorArr1state++;
|
MotorArr1state++;
|
||||||
wait1 = 0;
|
wait1 = 0;
|
||||||
setMotorState(Motor2,Motor_ACT_NOACT);
|
setMotorState(MotorKB,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
if (autocalcounter[0] > 3000 || MotorErr[Motor2] != 0)
|
if (autocalcounter[0] > 3000 || MotorErr[MotorKB] != 0)
|
||||||
{
|
{
|
||||||
MotorArr1state = 0;
|
MotorArr1state = 0;
|
||||||
setMotorState(Motor2,Motor_ACT_NOACT);
|
setMotorState(MotorKB,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6://wait
|
case 6://wait
|
||||||
@ -209,22 +209,22 @@ static void AutoCalCtrl(void)
|
|||||||
if (wait1 > 50)
|
if (wait1 > 50)
|
||||||
{
|
{
|
||||||
MotorArr1state++;
|
MotorArr1state++;
|
||||||
setMotorState(Motor2,Motor_ACT_CCW);
|
setMotorState(MotorKB,Motor_ACT_CCW);
|
||||||
autocalcounter[0] = 0;
|
autocalcounter[0] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
autocalcounter[0]++;
|
autocalcounter[0]++;
|
||||||
if (MotorHardStop2[Motor2] != 0)
|
if (MotorHardStop2[MotorKB] != 0)
|
||||||
{
|
{
|
||||||
MotorArr1state=0;
|
MotorArr1state=0;
|
||||||
wait1 = 0;
|
wait1 = 0;
|
||||||
setMotorState(Motor2,Motor_ACT_NOACT);
|
setMotorState(MotorKB,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
if (autocalcounter[0] > 3000 || MotorErr[Motor2] != 0)
|
if (autocalcounter[0] > 3000 || MotorErr[MotorKB] != 0)
|
||||||
{
|
{
|
||||||
MotorArr1state = 0;
|
MotorArr1state = 0;
|
||||||
setMotorState(Motor2,Motor_ACT_NOACT);
|
setMotorState(MotorKB,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -236,17 +236,17 @@ static void AutoCalCtrl(void)
|
|||||||
{
|
{
|
||||||
case 1://Motor3 xq
|
case 1://Motor3 xq
|
||||||
autocalcounter[1]++;
|
autocalcounter[1]++;
|
||||||
if (MotorHardStop1[Motor3] != 0)
|
if (MotorHardStop1[MotorTT] != 0)
|
||||||
{
|
{
|
||||||
MotorArr2state++;
|
MotorArr2state++;
|
||||||
wait2 = 0;
|
wait2 = 0;
|
||||||
setMotorState(Motor3,Motor_ACT_NOACT);
|
setMotorState(MotorTT,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
if (autocalcounter[1] > 3000 || MotorErr[Motor3] != 0)
|
if (autocalcounter[1] > 3000 || MotorErr[MotorTT] != 0)
|
||||||
{
|
{
|
||||||
MotorArr2state = 4;
|
MotorArr2state = 4;
|
||||||
wait2 = 0;
|
wait2 = 0;
|
||||||
setMotorState(Motor3,Motor_ACT_NOACT);
|
setMotorState(MotorTT,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2://wait
|
case 2://wait
|
||||||
@ -254,23 +254,23 @@ static void AutoCalCtrl(void)
|
|||||||
if (wait2 > 50)
|
if (wait2 > 50)
|
||||||
{
|
{
|
||||||
MotorArr2state++;
|
MotorArr2state++;
|
||||||
setMotorState(Motor3,Motor_ACT_CCW);
|
setMotorState(MotorTT,Motor_ACT_CCW);
|
||||||
autocalcounter[1] = 0;
|
autocalcounter[1] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3://Motor3 xh
|
case 3://Motor3 xh
|
||||||
autocalcounter[1]++;
|
autocalcounter[1]++;
|
||||||
if (MotorHardStop2[Motor3] != 0)
|
if (MotorHardStop2[MotorTT] != 0)
|
||||||
{
|
{
|
||||||
MotorArr2state++;
|
MotorArr2state++;
|
||||||
wait2 = 0;
|
wait2 = 0;
|
||||||
setMotorState(Motor3,Motor_ACT_NOACT);
|
setMotorState(MotorTT,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
if (autocalcounter[1] > 3000 || MotorErr[Motor3] != 0)
|
if (autocalcounter[1] > 3000 || MotorErr[MotorTT] != 0)
|
||||||
{
|
{
|
||||||
MotorArr2state = 4;
|
MotorArr2state = 4;
|
||||||
wait2 = 0;
|
wait2 = 0;
|
||||||
setMotorState(Motor3,Motor_ACT_NOACT);
|
setMotorState(MotorTT,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4://wait
|
case 4://wait
|
||||||
@ -278,22 +278,22 @@ static void AutoCalCtrl(void)
|
|||||||
if (wait2 > 50)
|
if (wait2 > 50)
|
||||||
{
|
{
|
||||||
MotorArr2state++;
|
MotorArr2state++;
|
||||||
setMotorState(Motor4,Motor_ACT_CW);
|
setMotorState(MotorZY,Motor_ACT_CW);
|
||||||
autocalcounter[1] = 0;
|
autocalcounter[1] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5://Motor4 xq
|
case 5://Motor4 xq
|
||||||
autocalcounter[1]++;
|
autocalcounter[1]++;
|
||||||
if (MotorHardStop1[Motor4] != 0)
|
if (MotorHardStop1[MotorZY] != 0)
|
||||||
{
|
{
|
||||||
MotorArr2state++;
|
MotorArr2state++;
|
||||||
wait2 = 0;
|
wait2 = 0;
|
||||||
setMotorState(Motor4,Motor_ACT_NOACT);
|
setMotorState(MotorZY,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
if (autocalcounter[1] > 3000 || MotorErr[Motor4] != 0)
|
if (autocalcounter[1] > 3000 || MotorErr[MotorZY] != 0)
|
||||||
{
|
{
|
||||||
MotorArr2state = 0;
|
MotorArr2state = 0;
|
||||||
setMotorState(Motor4,Motor_ACT_NOACT);
|
setMotorState(MotorZY,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6://wait
|
case 6://wait
|
||||||
@ -301,22 +301,22 @@ static void AutoCalCtrl(void)
|
|||||||
if (wait2 > 50)
|
if (wait2 > 50)
|
||||||
{
|
{
|
||||||
MotorArr2state++;
|
MotorArr2state++;
|
||||||
setMotorState(Motor4,Motor_ACT_CCW);
|
setMotorState(MotorZY,Motor_ACT_CCW);
|
||||||
autocalcounter[1] = 0;
|
autocalcounter[1] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
autocalcounter[1]++;
|
autocalcounter[1]++;
|
||||||
if (MotorHardStop2[Motor4] != 0)
|
if (MotorHardStop2[MotorZY] != 0)
|
||||||
{
|
{
|
||||||
MotorArr2state=0;
|
MotorArr2state=0;
|
||||||
wait2 = 0;
|
wait2 = 0;
|
||||||
setMotorState(Motor4,Motor_ACT_NOACT);
|
setMotorState(MotorZY,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
if (autocalcounter[1] > 3000 || MotorErr[Motor4] != 0)
|
if (autocalcounter[1] > 3000 || MotorErr[MotorZY] != 0)
|
||||||
{
|
{
|
||||||
MotorArr2state = 0;
|
MotorArr2state = 0;
|
||||||
setMotorState(Motor4,Motor_ACT_NOACT);
|
setMotorState(MotorZY,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -440,10 +440,10 @@ static void MotorCtrl(void)//10ms
|
|||||||
{
|
{
|
||||||
MotorHardStop2[1] = MotorHallLoc[1];
|
MotorHardStop2[1] = MotorHallLoc[1];
|
||||||
}
|
}
|
||||||
setMotorTarget(Motor1,0);
|
setMotorTarget(MotorHG,0);
|
||||||
setMotorTarget(Motor2,0);
|
setMotorTarget(MotorKB,0);
|
||||||
MotorState[Motor1] = Motor_ACT_NOACT;
|
MotorState[MotorHG] = Motor_ACT_NOACT;
|
||||||
MotorState[Motor2] = Motor_ACT_NOACT;
|
MotorState[MotorKB] = Motor_ACT_NOACT;
|
||||||
}
|
}
|
||||||
if (OC2flag == 1)
|
if (OC2flag == 1)
|
||||||
{
|
{
|
||||||
@ -464,10 +464,10 @@ static void MotorCtrl(void)//10ms
|
|||||||
{
|
{
|
||||||
MotorHardStop2[3] = MotorHallLoc[3];
|
MotorHardStop2[3] = MotorHallLoc[3];
|
||||||
}
|
}
|
||||||
setMotorTarget(Motor3,0);
|
setMotorTarget(MotorTT,0);
|
||||||
setMotorTarget(Motor4,0);
|
setMotorTarget(MotorZY,0);
|
||||||
MotorState[Motor3] = Motor_ACT_NOACT;
|
MotorState[MotorTT] = Motor_ACT_NOACT;
|
||||||
MotorState[Motor4] = Motor_ACT_NOACT;
|
MotorState[MotorZY] = Motor_ACT_NOACT;
|
||||||
}
|
}
|
||||||
if (OC3flag == 1)
|
if (OC3flag == 1)
|
||||||
{
|
{
|
||||||
@ -538,7 +538,10 @@ static void MotorCtrl(void)//10ms
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CurrentDetect(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the global functions
|
* the global functions
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@ -551,6 +554,13 @@ void MotorCtrl_Init(McuType *obj)
|
|||||||
MotorValueInit();
|
MotorValueInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetMotorMsg(void)
|
||||||
|
{
|
||||||
|
scm_canmatrix_tx.SCM_STATE.MOTOR_HG_STATE = MotorState[MotorHG];
|
||||||
|
scm_canmatrix_tx.SCM_STATE.MOTOR_KB_STATE = MotorState[MotorKB];
|
||||||
|
scm_canmatrix_tx.SCM_STATE.MOTOR_TT_STATE = MotorState[MotorTT];
|
||||||
|
scm_canmatrix_tx.SCM_STATE.MOTOR_ZY_STATE = MotorState[MotorZY];
|
||||||
|
}
|
||||||
void MotorCtrl_Maintask(McuType *obj)//10ms task
|
void MotorCtrl_Maintask(McuType *obj)//10ms task
|
||||||
{
|
{
|
||||||
MotorCtrl();
|
MotorCtrl();
|
||||||
@ -558,6 +568,7 @@ void MotorCtrl_Maintask(McuType *obj)//10ms task
|
|||||||
{
|
{
|
||||||
hw_MotorCtrl(obj, i, MotorStateReal[i]);
|
hw_MotorCtrl(obj, i, MotorStateReal[i]);
|
||||||
}
|
}
|
||||||
|
SetMotorMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMotorState(Motor_ID_Type motorid,Motor_ACT_Type act)
|
void setMotorState(Motor_ID_Type motorid,Motor_ACT_Type act)
|
||||||
@ -591,10 +602,10 @@ void StopAutoCal(void)
|
|||||||
if (AutoCalState != AUTOCAL_STOP)
|
if (AutoCalState != AUTOCAL_STOP)
|
||||||
{
|
{
|
||||||
AutoCalState = AUTOCAL_STOP;
|
AutoCalState = AUTOCAL_STOP;
|
||||||
setMotorState(Motor1,Motor_ACT_NOACT);
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
setMotorState(Motor2,Motor_ACT_NOACT);
|
setMotorState(MotorKB,Motor_ACT_NOACT);
|
||||||
setMotorState(Motor3,Motor_ACT_NOACT);
|
setMotorState(MotorTT,Motor_ACT_NOACT);
|
||||||
setMotorState(Motor4,Motor_ACT_NOACT);
|
setMotorState(MotorZY,Motor_ACT_NOACT);
|
||||||
setMotorState(Motor5,Motor_ACT_NOACT);
|
setMotorState(Motor5,Motor_ACT_NOACT);
|
||||||
setMotorState(Motor6,Motor_ACT_NOACT);
|
setMotorState(Motor6,Motor_ACT_NOACT);
|
||||||
}
|
}
|
||||||
@ -621,21 +632,21 @@ uint16_t getOverCurrentTh(uint8_t ch)
|
|||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (MotorStateReal[Motor1]!=Motor_ACT_NOACT)
|
if (MotorStateReal[MotorHG]!=Motor_ACT_NOACT)
|
||||||
{
|
{
|
||||||
th+=50;
|
th+=50;
|
||||||
}
|
}
|
||||||
if (MotorStateReal[Motor2]!=Motor_ACT_NOACT)
|
if (MotorStateReal[MotorKB]!=Motor_ACT_NOACT)
|
||||||
{
|
{
|
||||||
th+=50;
|
th+=50;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (MotorStateReal[Motor3]!=Motor_ACT_NOACT)
|
if (MotorStateReal[MotorTT]!=Motor_ACT_NOACT)
|
||||||
{
|
{
|
||||||
th+=50;
|
th+=50;
|
||||||
}
|
}
|
||||||
if (MotorStateReal[Motor4]!=Motor_ACT_NOACT)
|
if (MotorStateReal[MotorZY]!=Motor_ACT_NOACT)
|
||||||
{
|
{
|
||||||
th+=50;
|
th+=50;
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ typedef enum
|
|||||||
} Motor_ACT_Type;
|
} Motor_ACT_Type;
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Motor1,//
|
MotorHG,//
|
||||||
Motor2,//
|
MotorKB,//
|
||||||
Motor3,//
|
MotorTT,//
|
||||||
Motor4,//
|
MotorZY,//
|
||||||
Motor5,//
|
Motor5,//
|
||||||
Motor6,//
|
Motor6,//
|
||||||
MOTOR_NUM,
|
MOTOR_NUM,
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
#include "SEGGER_RTT.h"
|
#include "SEGGER_RTT.h"
|
||||||
#include "MotorCtrl.h"
|
#include "MotorCtrl.h"
|
||||||
#include "canuser.h"
|
#include "canuser.h"
|
||||||
|
#include "key.h"
|
||||||
|
#include "scm_canmatrix-binutil.h"
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the defines
|
* the defines
|
||||||
@ -86,6 +87,12 @@ void appTask(McuType *obj)
|
|||||||
gSystick1msCnt++;
|
gSystick1msCnt++;
|
||||||
gSysTick1sCnt++;
|
gSysTick1sCnt++;
|
||||||
MsgTask(&udsObj);
|
MsgTask(&udsObj);
|
||||||
|
if (gSystick1msCnt % 5 == 0)
|
||||||
|
{
|
||||||
|
KeyScanTask();
|
||||||
|
KeyProTask();
|
||||||
|
}
|
||||||
|
|
||||||
if (gSystick1msCnt % 10 == 0)
|
if (gSystick1msCnt % 10 == 0)
|
||||||
{
|
{
|
||||||
MotorCtrl_Maintask(obj);
|
MotorCtrl_Maintask(obj);
|
||||||
@ -94,12 +101,14 @@ void appTask(McuType *obj)
|
|||||||
if (gSystick1msCnt % 50 == 0)
|
if (gSystick1msCnt % 50 == 0)
|
||||||
{
|
{
|
||||||
SBC_WD_Trigger();
|
SBC_WD_Trigger();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gSystick1msCnt % 200 == 0)
|
if(gSystick1msCnt % 1000 == 0)
|
||||||
{
|
{
|
||||||
|
//TrgMuxDrv_GenSWTrigger(&obj->trgMuxDrv, 1);
|
||||||
|
//adcResult[0] = AdcDrv_GetRn(&obj->adc0Drv, 0);
|
||||||
|
//AdcDrv_SwTrg(&obj->adc0Drv);
|
||||||
}
|
}
|
||||||
if (gSystick1msCnt >= 10000)
|
if (gSystick1msCnt >= 10000)
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "canuser.h"
|
#include "canuser.h"
|
||||||
#include "scm_matrix-binutil.h"
|
#include "scm_canmatrix-binutil.h"
|
||||||
|
#include "can_message.h"
|
||||||
|
#include "hwctrl.h"
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the typedefs
|
* the typedefs
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@ -116,6 +117,8 @@ static uint8_t rxMsgBuf1[8] = {0};
|
|||||||
static uint8_t rxMsgBuf2[8] = {0};
|
static uint8_t rxMsgBuf2[8] = {0};
|
||||||
static uint8_t debugMode;
|
static uint8_t debugMode;
|
||||||
|
|
||||||
|
CAN_MESSAGE CAN_D_scm_state;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the const
|
* the const
|
||||||
@ -154,6 +157,11 @@ static void RxMsgProcess(void)
|
|||||||
//HOST_Req1_Type* prxMsgBuf1 = (HOST_Req1_Type*)rxMsgBuf1;
|
//HOST_Req1_Type* prxMsgBuf1 = (HOST_Req1_Type*)rxMsgBuf1;
|
||||||
//debugMode = prxMsgBuf1->HOST_DebugMode;
|
//debugMode = prxMsgBuf1->HOST_DebugMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void TxMessage(CAN_MESSAGE* msg)
|
||||||
|
{
|
||||||
|
FlexCanBoot_TxMessage(msg->MsgId, msg->Data, msg->DLC);
|
||||||
|
}
|
||||||
void MsgTask(UdsType *obj)//1ms task
|
void MsgTask(UdsType *obj)//1ms task
|
||||||
{
|
{
|
||||||
static uint16_t msg_counter=0;
|
static uint16_t msg_counter=0;
|
||||||
@ -164,7 +172,13 @@ void MsgTask(UdsType *obj)//1ms task
|
|||||||
if (msg_counter >= 50)
|
if (msg_counter >= 50)
|
||||||
{
|
{
|
||||||
msg_counter = 0;
|
msg_counter = 0;
|
||||||
FlexCanBoot_TxMessage(APP_TX_ECU_STATUS_MSG_ID, txMsgBuf1, 8);
|
scm_canmatrix_tx.SCM_STATE.test1 = (uint8_t)adcResult[0];
|
||||||
|
scm_canmatrix_tx.SCM_STATE.test2 = (uint8_t)adcResult[1];
|
||||||
|
scm_canmatrix_tx.SCM_STATE.test3 = (uint8_t)adcResult[2];
|
||||||
|
scm_canmatrix_tx.SCM_STATE.test4 = (uint8_t)adcResult[3];
|
||||||
|
scm_canmatrix_tx.SCM_STATE.test5 = (uint8_t)adcResult[4];
|
||||||
|
Pack_SCM_STATE_CANmatrix(&scm_canmatrix_tx.SCM_STATE,&CAN_D_scm_state);
|
||||||
|
TxMessage(&CAN_D_scm_state);
|
||||||
if (debugMode!=0)
|
if (debugMode!=0)
|
||||||
{
|
{
|
||||||
FlexCanBoot_TxMessage(APP_TX_ECU_DEBUG1_MSG_ID, txMsgBuf2, 8);
|
FlexCanBoot_TxMessage(APP_TX_ECU_DEBUG1_MSG_ID, txMsgBuf2, 8);
|
||||||
@ -184,7 +198,7 @@ void MsgTask(UdsType *obj)//1ms task
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scm_matrix_Receive(&scm_matrix_rx,rxMsg.data,rxMsg.id,rxMsg.len);
|
scm_canmatrix_Receive(&scm_canmatrix_rx,rxMsg.data,rxMsg.id,rxMsg.len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RxMsgProcess();
|
RxMsgProcess();
|
||||||
|
14
cva_asw_m0146/src/event.c
Normal file
14
cva_asw_m0146/src/event.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include "mcu.h"
|
||||||
|
#include "hwctrl.h"
|
||||||
|
|
||||||
|
extern McuType mcu;
|
||||||
|
|
||||||
|
|
||||||
|
void ADC0_Handler()
|
||||||
|
{
|
||||||
|
for(uint8_t i=0;i<ADCH_NUM;i++){
|
||||||
|
adcResult[i] = AdcDrv_GetRn(&mcu.adc0Drv, i);
|
||||||
|
}
|
||||||
|
}
|
@ -12,8 +12,8 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the defines
|
* the defines
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
#define ADC_DEMO_LAST_CHANNLE ADCH_HEAT_C2
|
||||||
|
#define PDB_BB_SEL (0u) //000b : PDB0 and PDB1 operates independently.
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the typedefs
|
* the typedefs
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
@ -23,19 +23,25 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the globals
|
* the globals
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
uint32_t adcResult[ADCH_NUM];
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the const
|
* the const
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
/*! \brief The trgmux in out mappings table for trgmux configure
|
||||||
|
*/
|
||||||
|
const TrgMuxDrv_InOutMappingType c_trgmuxInOutMappings[] = {
|
||||||
|
{TRGMUXDRV_TRIGSOURCE_SIM_SW_TRIG, TRGMUXDRV_TARGETMODULE_PDB0_TRG_IN, false}, /* Use SIM_SW_TRIG trigger PDB0 */
|
||||||
|
};
|
||||||
|
const uint16_t c_numOfTrgmuxInOutMappings = sizeof(c_trgmuxInOutMappings) / sizeof(TrgMuxDrv_InOutMappingType);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the function prototypes
|
* the function prototypes
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void hw_IO_Init(McuType *obj);
|
static void hw_IO_Init(McuType *obj);
|
||||||
|
static void ADC_Init(McuType *obj);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +83,93 @@ static void hw_clock_init(McuType *obj)
|
|||||||
|
|
||||||
tTcr = SpiReg_GetTcr((const SpiRegType *)&obj->spiDrv2.reg);
|
tTcr = SpiReg_GetTcr((const SpiRegType *)&obj->spiDrv2.reg);
|
||||||
SpiDrv_SetPrescaler(&tTcr,0x03);
|
SpiDrv_SetPrescaler(&tTcr,0x03);
|
||||||
|
|
||||||
|
//adc功能
|
||||||
|
/* Enable the clock for PDB0 */
|
||||||
|
ClockDrv_ConfigureClock(&obj->clockDrv, CLOCKDRV_PDB0, &clockConfig);
|
||||||
|
|
||||||
|
/* TRGMUX */
|
||||||
|
TrgMuxDrv_ConfigType trgmuxConfig;
|
||||||
|
trgmuxConfig.numOfInOutMappings = c_numOfTrgmuxInOutMappings;
|
||||||
|
trgmuxConfig.inOutMapping = c_trgmuxInOutMappings;
|
||||||
|
TrgMuxDrv_Configure(&obj->trgMuxDrv, &trgmuxConfig);
|
||||||
|
|
||||||
|
/* Enable the clock for ADC */
|
||||||
|
clockConfig.gating = true;
|
||||||
|
clockConfig.source = CLOCKDRV_PLL;
|
||||||
|
clockConfig.div = 4;
|
||||||
|
ClockDrv_ConfigureClock(&obj->clockDrv, CLOCKDRV_ADC0, &clockConfig);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void ADC_Init(McuType *obj)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < ADCH_NUM; i++)
|
||||||
|
{
|
||||||
|
adcResult[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Configure ADC module */
|
||||||
|
AdcDrv_ConfigType adcCfg;
|
||||||
|
AdcDrv_GetDefaultConfig(&adcCfg);
|
||||||
|
adcCfg.conversionMode = ADCDRV_CONVERSION_12BIT; /* Selects the ADC resolution to 12-bit conversion */
|
||||||
|
adcCfg.avgEnable = true; /* Enable hardware average function */
|
||||||
|
adcCfg.avgSamplesSel = ADCDRV_AVERAGE_32; /* Select 32 samples average */
|
||||||
|
adcCfg.continuousMode = ADCDRV_ONESHOT; /* Select one-shot mode */
|
||||||
|
adcCfg.chnCfg[ADCH_Power].chnSel = ADCDRV_INCHN_EXT3;
|
||||||
|
adcCfg.chnCfg[ADCH_RLY1].chnSel = ADCDRV_INCHN_VBG;
|
||||||
|
adcCfg.chnCfg[ADCH_RLY3].chnSel = ADCDRV_INCHN_EXT0;
|
||||||
|
adcCfg.chnCfg[ADCH_RLY5].chnSel = ADCDRV_INCHN_EXT1;
|
||||||
|
adcCfg.chnCfg[ADCH_HEAT_SENSOR1].chnSel = ADCDRV_INCHN_LDO_VOLT;
|
||||||
|
adcCfg.chnCfg[ADCH_HEAT_SENSOR2].chnSel = ADCDRV_INCHN_EXT3;
|
||||||
|
adcCfg.chnCfg[ADCH_HEAT_C1].chnSel = ADCDRV_INCHN_EXT3;
|
||||||
|
adcCfg.chnCfg[ADCH_HEAT_C2].chnSel = ADCDRV_INCHN_EXT3;
|
||||||
|
|
||||||
|
adcCfg.chnCfg[ADC_DEMO_LAST_CHANNLE].intEnable = true; /* Last channel enable interrupt */
|
||||||
|
|
||||||
|
adcCfg.trgSrcCfg.trgSrc = ADCDRV_HW_TRIGGER;
|
||||||
|
adcCfg.trgSrcCfg.hwTrgSrc = ADCDRV_HW_TRGSRC_PDB;
|
||||||
|
adcCfg.trgSrcCfg.swPretrgSrc = ADCDRV_SWPRETRG_PRETRIGGER_0;
|
||||||
|
adcCfg.trgSrcCfg.pretrgSrc = ADCDRV_PRETRG_PDB_PRETRIGGER;
|
||||||
|
|
||||||
|
/* Enable ADC interrupts */
|
||||||
|
IrqDrv_EnableIrq(ADC0_IRQn);
|
||||||
|
AdcDrv_Configure(&obj->adc0Drv, &adcCfg);
|
||||||
|
AdcDrv_EnableAdc(&obj->adc0Drv);
|
||||||
|
|
||||||
|
/* Configure PDB module */
|
||||||
|
uint32_t pdbFreq;
|
||||||
|
ClockDrv_GetFreq(&obj->clockDrv, CLOCKDRV_PDB0, &pdbFreq);
|
||||||
|
|
||||||
|
PdbDrv_ConfigType pdbCfg;
|
||||||
|
PdbDrv_GetDefaultConfig(&pdbCfg);
|
||||||
|
pdbCfg.ldmode = PDBDRV_LDMOD_LOAD_VAL_IMMEDIATELY; /* The internal registers are loaded with the values from their buffers, immediately after 1 is written to LDOK */
|
||||||
|
pdbCfg.trgInSel = PDBDRV_TRGSEL_TRGGER_IN_0; /* Use hardware trigger source */
|
||||||
|
pdbCfg.cMode = PDBDRV_CONT_CONTINUOUS; /* PDB operation in Continuous mode */
|
||||||
|
pdbCfg.prescalerFactor = PDBDRV_PRESCALER_128MULT; /* Counting uses the peripheral clock divided by MULT (the multiplication factor) */
|
||||||
|
pdbCfg.mult = PDBDRV_MULT_FACTOR_40; /* Multiplication factor is 40 */
|
||||||
|
pdbCfg.preTrgCfg.mode[0][0] = PDBDRV_PRETRG_DELAY_MODE; /* The first channel start with other trigger source */
|
||||||
|
pdbCfg.preTrgCfg.mode[0][1] = PDBDRV_PRETRG_BB_MODE; /* PDB channel[0][1-7] & channel[1][0-7] with Back-to-Back operation*/
|
||||||
|
pdbCfg.preTrgCfg.mode[0][2] = PDBDRV_PRETRG_BB_MODE;
|
||||||
|
pdbCfg.preTrgCfg.mode[0][3] = PDBDRV_PRETRG_BB_MODE;
|
||||||
|
pdbCfg.preTrgCfg.mode[0][4] = PDBDRV_PRETRG_BB_MODE;
|
||||||
|
pdbCfg.preTrgCfg.mode[0][5] = PDBDRV_PRETRG_BB_MODE;
|
||||||
|
pdbCfg.preTrgCfg.mode[0][6] = PDBDRV_PRETRG_BB_MODE;
|
||||||
|
pdbCfg.preTrgCfg.mode[0][7] = PDBDRV_PRETRG_BB_MODE;
|
||||||
|
pdbCfg.dlyCfg.modCnt = 1*pdbFreq / 128 / 40; /* Periodic triggering PDB in 1s*/
|
||||||
|
pdbCfg.dlyCfg.dlyCnt[0][0] = 0; /* first channel don't need delay time*/
|
||||||
|
pdbCfg.bbSel = PDB_BB_SEL; /* Internal channel chaining of PDB0 CH0 and CH1.
|
||||||
|
* CH0 and CH1 of PDB0 back-to-back operation with COCO[7:0] and COCO[15:8] of ADC0.
|
||||||
|
*/
|
||||||
|
PdbDrv_Configure(&obj->pdb0Drv, &pdbCfg);
|
||||||
|
|
||||||
|
PdbDrv_EnablePdb(&obj->pdb0Drv); /* Enable PDB0 */
|
||||||
|
TrgMuxDrv_GenSWTrigger(&obj->trgMuxDrv, 100); /* Trigger PDB0 */
|
||||||
|
}
|
||||||
|
|
||||||
void hw_init(McuType *obj)
|
void hw_init(McuType *obj)
|
||||||
{
|
{
|
||||||
uint32_t gCpuClockFrequency = 0;
|
uint32_t gCpuClockFrequency = 0;
|
||||||
@ -97,6 +189,8 @@ void hw_init(McuType *obj)
|
|||||||
IrqDrv_EnableIrq(SysTick_IRQn);
|
IrqDrv_EnableIrq(SysTick_IRQn);
|
||||||
|
|
||||||
SBC_Init();
|
SBC_Init();
|
||||||
|
|
||||||
|
ADC_Init(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,8 +306,10 @@ static void hw_IO_Init(McuType *obj)
|
|||||||
PortReg_SetPcrSr(obj->ptc.port, 8, 1);
|
PortReg_SetPcrSr(obj->ptc.port, 8, 1);
|
||||||
//37
|
//37
|
||||||
PinsDrv_SetMuxModeSel(&obj->pta, 7, PINSDRV_PIN_DISABLED);
|
PinsDrv_SetMuxModeSel(&obj->pta, 7, PINSDRV_PIN_DISABLED);
|
||||||
PortReg_SetPcrDrvStr(obj->pta.port, 7, 1);
|
PortReg_SetPcrAen(obj->pta.port, 7, 1);
|
||||||
PortReg_SetPcrSr(obj->pta.port, 7, 1);
|
PortReg_SetPcrSr(obj->pta.port, 7, 1);
|
||||||
|
PinsDrv_SetPinDirection(&obj->pta, 7,0);
|
||||||
|
PinsDrv_SetPortInputDisable(&obj->pta,0);
|
||||||
//38
|
//38
|
||||||
PinsDrv_SetMuxModeSel(&obj->pta, 6, PINSDRV_MUX_AS_GPIO);
|
PinsDrv_SetMuxModeSel(&obj->pta, 6, PINSDRV_MUX_AS_GPIO);
|
||||||
PortReg_SetPcrDrvStr(obj->pta.port, 6, 1);
|
PortReg_SetPcrDrvStr(obj->pta.port, 6, 1);
|
||||||
@ -318,7 +414,7 @@ void hw_MotorCtrl(McuType *obj,Motor_ID_Type motorid,Motor_ACT_Type dir)
|
|||||||
{
|
{
|
||||||
switch(motorid)
|
switch(motorid)
|
||||||
{
|
{
|
||||||
case Motor1:
|
case MotorHG:
|
||||||
switch(dir)
|
switch(dir)
|
||||||
{
|
{
|
||||||
case Motor_ACT_NOACT:
|
case Motor_ACT_NOACT:
|
||||||
@ -335,7 +431,7 @@ void hw_MotorCtrl(McuType *obj,Motor_ID_Type motorid,Motor_ACT_Type dir)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Motor2:
|
case MotorKB:
|
||||||
switch(dir)
|
switch(dir)
|
||||||
{
|
{
|
||||||
case Motor_ACT_NOACT:
|
case Motor_ACT_NOACT:
|
||||||
@ -352,7 +448,7 @@ void hw_MotorCtrl(McuType *obj,Motor_ID_Type motorid,Motor_ACT_Type dir)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Motor3:
|
case MotorTT:
|
||||||
switch(dir)
|
switch(dir)
|
||||||
{
|
{
|
||||||
case Motor_ACT_NOACT:
|
case Motor_ACT_NOACT:
|
||||||
@ -369,7 +465,7 @@ void hw_MotorCtrl(McuType *obj,Motor_ID_Type motorid,Motor_ACT_Type dir)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Motor4:
|
case MotorZY:
|
||||||
switch(dir)
|
switch(dir)
|
||||||
{
|
{
|
||||||
case Motor_ACT_NOACT:
|
case Motor_ACT_NOACT:
|
||||||
|
@ -8,11 +8,22 @@
|
|||||||
* the defines
|
* the defines
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
extern uint32_t adcResult[];
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* the typedefs
|
* the typedefs
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
ADCH_Power=0,
|
||||||
|
ADCH_RLY1,
|
||||||
|
ADCH_RLY3,
|
||||||
|
ADCH_RLY5,
|
||||||
|
ADCH_HEAT_SENSOR1,
|
||||||
|
ADCH_HEAT_SENSOR2,
|
||||||
|
ADCH_HEAT_C1,
|
||||||
|
ADCH_HEAT_C2,
|
||||||
|
ADCH_NUM,
|
||||||
|
}ADCH_ID_type;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
#include "scm_matrix-binutil.h"
|
#include "scm_canmatrix-binutil.h"
|
||||||
|
#include "MotorCtrl.h"
|
||||||
|
|
||||||
uint8_t GetSigState(KEY_ID_t key_id);
|
static uint8_t GetSigState(KEY_ID_type key_id);
|
||||||
|
|
||||||
static uint8_t keystate[KEY_NUM];
|
static uint8_t keystate[KEY_NUM];
|
||||||
static uint8_t keyPressFlag[KEY_NUM];
|
static uint8_t keyPressFlag[KEY_NUM];
|
||||||
@ -18,21 +19,21 @@ void ClearAllKeyState(void)
|
|||||||
keystate[i] = 0;
|
keystate[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void setKeyPressFlag(KEY_ID_t id)
|
static void setKeyPressFlag(KEY_ID_type id)
|
||||||
{
|
{
|
||||||
if (id < KEY_NUM)
|
if (id < KEY_NUM)
|
||||||
{
|
{
|
||||||
keyPressFlag[id] = KEY_PRESSED;
|
keyPressFlag[id] = KEY_PRESSED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void setKeyReleaseFlag(KEY_ID_t id)
|
static void setKeyReleaseFlag(KEY_ID_type id)
|
||||||
{
|
{
|
||||||
if (id < KEY_NUM)
|
if (id < KEY_NUM)
|
||||||
{
|
{
|
||||||
keyReleaseFlag[id] = KEY_PRESSED;
|
keyReleaseFlag[id] = KEY_PRESSED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint8_t getKeyPressFlag(uint8_t id)
|
uint8_t getKeyPressFlag(KEY_ID_type id)
|
||||||
{
|
{
|
||||||
uint8_t retVal = KEY_NOPRESSED;
|
uint8_t retVal = KEY_NOPRESSED;
|
||||||
if (id < KEY_NUM)
|
if (id < KEY_NUM)
|
||||||
@ -42,7 +43,7 @@ uint8_t getKeyPressFlag(uint8_t id)
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
uint8_t getKeyReleaseFlag(uint8_t id)
|
uint8_t getKeyReleaseFlag(KEY_ID_type id)
|
||||||
{
|
{
|
||||||
uint8_t retVal = KEY_NOPRESSED;
|
uint8_t retVal = KEY_NOPRESSED;
|
||||||
if (id < KEY_NUM)
|
if (id < KEY_NUM)
|
||||||
@ -53,10 +54,10 @@ uint8_t getKeyReleaseFlag(uint8_t id)
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyScan(void)//5ms
|
void KeyScanTask(void)//5ms
|
||||||
{
|
{
|
||||||
uint8_t i,key,key_nopress;
|
uint8_t i,key;
|
||||||
key_nopress = 0;
|
|
||||||
for (i = 0; i < KEY_NUM; i++)
|
for (i = 0; i < KEY_NUM; i++)
|
||||||
{
|
{
|
||||||
key = GetSigState(i);
|
key = GetSigState(i);
|
||||||
@ -82,7 +83,6 @@ void KeyScan(void)//5ms
|
|||||||
setKeyReleaseFlag(i);
|
setKeyReleaseFlag(i);
|
||||||
}
|
}
|
||||||
keystate[i] = KEY_NOPRESSED;
|
keystate[i] = KEY_NOPRESSED;
|
||||||
key_nopress++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,23 +91,109 @@ void KeyScan(void)//5ms
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t GetSigState(KEY_ID_t key_id)
|
static uint8_t GetSigState(KEY_ID_type key_id)
|
||||||
{
|
{
|
||||||
switch (key_id)
|
switch (key_id)
|
||||||
{
|
{
|
||||||
case KEY_HG_F:
|
case KEY_HG_F:
|
||||||
return scm_matrix_rx.Panel_Key.
|
return scm_canmatrix_rx.Panel_Key.KEY_HG_F;
|
||||||
|
case KEY_HG_R:
|
||||||
|
return scm_canmatrix_rx.Panel_Key.KEY_HG_R;
|
||||||
|
case KEY_KB_F:
|
||||||
|
return scm_canmatrix_rx.Panel_Key.KEY_KB_F;
|
||||||
|
case KEY_KB_R:
|
||||||
|
return scm_canmatrix_rx.Panel_Key.KEY_KB_R;
|
||||||
|
case KEY_TT_F:
|
||||||
|
return scm_canmatrix_rx.Panel_Key.KEY_TT_F;
|
||||||
|
case KEY_TT_R:
|
||||||
|
return scm_canmatrix_rx.Panel_Key.KEY_TT_R;
|
||||||
|
case KEY_ZY_U:
|
||||||
|
return scm_canmatrix_rx.Panel_Key.KEY_ZY_U;
|
||||||
|
case KEY_ZY_D:
|
||||||
|
return scm_canmatrix_rx.Panel_Key.KEY_ZY_D;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeyProTask(void)
|
||||||
|
{
|
||||||
|
//HG
|
||||||
|
if (getKeyPressFlag(KEY_HG_F) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_CW);
|
||||||
|
}
|
||||||
|
if (getKeyReleaseFlag(KEY_HG_F) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
|
}
|
||||||
|
if (getKeyPressFlag(KEY_HG_R) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_CCW);
|
||||||
|
}
|
||||||
|
if (getKeyReleaseFlag(KEY_HG_R) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
|
}
|
||||||
|
|
||||||
|
//KB
|
||||||
|
if (getKeyPressFlag(KEY_KB_F) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_CW);
|
||||||
|
}
|
||||||
|
if (getKeyReleaseFlag(KEY_KB_F) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
|
}
|
||||||
|
if (getKeyPressFlag(KEY_KB_R) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_CCW);
|
||||||
|
}
|
||||||
|
if (getKeyReleaseFlag(KEY_KB_R) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
|
}
|
||||||
|
|
||||||
|
//TT
|
||||||
|
if (getKeyPressFlag(KEY_TT_F) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_CW);
|
||||||
|
}
|
||||||
|
if (getKeyReleaseFlag(KEY_TT_F) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
|
}
|
||||||
|
if (getKeyPressFlag(KEY_TT_R) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_CCW);
|
||||||
|
}
|
||||||
|
if (getKeyReleaseFlag(KEY_TT_R) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ZY
|
||||||
|
if (getKeyPressFlag(KEY_ZY_U) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_CW);
|
||||||
|
}
|
||||||
|
if (getKeyReleaseFlag(KEY_ZY_U) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
|
}
|
||||||
|
if (getKeyPressFlag(KEY_ZY_D) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_CCW);
|
||||||
|
}
|
||||||
|
if (getKeyReleaseFlag(KEY_ZY_D) == KEY_PRESSED)
|
||||||
|
{
|
||||||
|
setMotorState(MotorHG,Motor_ACT_NOACT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,4 +22,12 @@ typedef enum
|
|||||||
KEY_NUM,
|
KEY_NUM,
|
||||||
}KEY_ID_type;
|
}KEY_ID_type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ClearAllKeyState(void);
|
||||||
|
uint8_t getKeyPressFlag(KEY_ID_type id);
|
||||||
|
uint8_t getKeyReleaseFlag(KEY_ID_type id);
|
||||||
|
void KeyScanTask(void);
|
||||||
|
void KeyProTask(void);
|
||||||
|
|
||||||
#endif // __KEY_H__
|
#endif // __KEY_H__
|
Loading…
x
Reference in New Issue
Block a user