不用模型
This commit is contained in:
parent
9efdb538b6
commit
adad6693a9
29
cva_asw_m0146/.vscode/settings.json
vendored
29
cva_asw_m0146/.vscode/settings.json
vendored
@ -22,7 +22,32 @@
|
||||
"pwmlite_drv.h": "c",
|
||||
"RTE.C": "cpp",
|
||||
"rtwtypes.h": "c",
|
||||
"can_message.h": "c"
|
||||
"can_message.h": "c",
|
||||
"canuser.h": "c",
|
||||
"scm_matrix-binutil.h": "c",
|
||||
"matrix.h": "c",
|
||||
"key.h": "c",
|
||||
"dbccodeconf.h": "c"
|
||||
},
|
||||
"C_Cpp.default.compilerPath": ""
|
||||
"C_Cpp.default.compilerPath": "",
|
||||
"MicroPython.executeButton": [
|
||||
{
|
||||
"text": "▶",
|
||||
"tooltip": "运行",
|
||||
"alignment": "left",
|
||||
"command": "extension.executeFile",
|
||||
"priority": 3.5
|
||||
}
|
||||
],
|
||||
"MicroPython.syncButton": [
|
||||
{
|
||||
"text": "$(sync)",
|
||||
"tooltip": "同步",
|
||||
"alignment": "left",
|
||||
"command": "extension.execute",
|
||||
"priority": 4
|
||||
}
|
||||
],
|
||||
"Codegeex.CompletionDelay": 0.5,
|
||||
"Codegeex.RepoIndex": true
|
||||
}
|
@ -361,8 +361,11 @@
|
||||
<state>$PROJ_DIR$\src\RTT</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$\src\RP_01_APP_ert_rtw</state>
|
||||
<state>$PROJ_DIR$\src\RTE</state>
|
||||
<state>$PROJ_DIR$\src\Matrix\inc</state>
|
||||
<state>$PROJ_DIR$\src\Matrix\butl</state>
|
||||
<state>$PROJ_DIR$\src\Matrix\conf</state>
|
||||
<state>$PROJ_DIR$\src\Matrix\lib</state>
|
||||
<state>$PROJ_DIR$\src\Matrix\usr</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CCStdIncCheck</name>
|
||||
@ -695,7 +698,7 @@
|
||||
<data>
|
||||
<extensions></extensions>
|
||||
<cmdline></cmdline>
|
||||
<hasPrio>24</hasPrio>
|
||||
<hasPrio>1</hasPrio>
|
||||
<buildSequence>inputOutputBased</buildSequence>
|
||||
</data>
|
||||
</settings>
|
||||
@ -2636,33 +2639,45 @@
|
||||
<name>$PROJ_DIR$\SDK\platform\devices\CVM014x\mcu.h</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>ert_rtw</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\can_datatype_ground.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\can_key_msg.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\KeyPro.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\MotorCtrl_Maintask.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\MsgTx.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\RP_01_APP.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>linker</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\linker\app_m0146_flash.icf</name>
|
||||
</file>
|
||||
</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>
|
||||
<name>middleware</name>
|
||||
<group>
|
||||
@ -2939,12 +2954,6 @@
|
||||
<name>$PROJ_DIR$\SDK\platform\devices\CVM014x\reg\wdg_reg.h</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>RTE</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RTE\RTE.C</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>RTT</name>
|
||||
<file>
|
||||
|
@ -3273,33 +3273,45 @@
|
||||
<name>$PROJ_DIR$\SDK\platform\devices\CVM014x\mcu.h</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>ert_rtw</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\can_datatype_ground.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\can_key_msg.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\KeyPro.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\MotorCtrl_Maintask.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\MsgTx.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RP_01_APP_ert_rtw\RP_01_APP.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>linker</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\linker\app_m0146_flash.icf</name>
|
||||
</file>
|
||||
</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>
|
||||
<name>middleware</name>
|
||||
<group>
|
||||
@ -3576,12 +3588,6 @@
|
||||
<name>$PROJ_DIR$\SDK\platform\devices\CVM014x\reg\wdg_reg.h</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>RTE</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RTE\RTE.C</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>RTT</name>
|
||||
<file>
|
||||
|
@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
|
||||
|
||||
@echo on
|
||||
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\settings\cva_asw_m0146.Debug.general.xcl" --backend -f "F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\settings\cva_asw_m0146.Debug.driver.xcl"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\RP-01\CODE\cva_asw_m0146\settings\cva_asw_m0146.Debug.general.xcl" --backend -f "F:\FCB_project\RP-01\CODE\cva_asw_m0146\settings\cva_asw_m0146.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
goto end
|
||||
@ -34,7 +34,7 @@ goto end
|
||||
|
||||
@echo on
|
||||
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\settings\cva_asw_m0146.Debug.general.xcl" "--debug_file=%~1" --backend -f "F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\settings\cva_asw_m0146.Debug.driver.xcl"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\RP-01\CODE\cva_asw_m0146\settings\cva_asw_m0146.Debug.general.xcl" "--debug_file=%~1" --backend -f "F:\FCB_project\RP-01\CODE\cva_asw_m0146\settings\cva_asw_m0146.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
:end
|
@ -23,9 +23,9 @@
|
||||
|
||||
if ($debugfile -eq "")
|
||||
{
|
||||
& "D:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\settings\cva_asw_m0146.Debug.general.xcl" --backend -f "F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\settings\cva_asw_m0146.Debug.driver.xcl"
|
||||
& "E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\RP-01\CODE\cva_asw_m0146\settings\cva_asw_m0146.Debug.general.xcl" --backend -f "F:\FCB_project\RP-01\CODE\cva_asw_m0146\settings\cva_asw_m0146.Debug.driver.xcl"
|
||||
}
|
||||
else
|
||||
{
|
||||
& "D:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\settings\cva_asw_m0146.Debug.general.xcl" --debug_file=$debugfile --backend -f "F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\settings\cva_asw_m0146.Debug.driver.xcl"
|
||||
& "E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\RP-01\CODE\cva_asw_m0146\settings\cva_asw_m0146.Debug.general.xcl" --debug_file=$debugfile --backend -f "F:\FCB_project\RP-01\CODE\cva_asw_m0146\settings\cva_asw_m0146.Debug.driver.xcl"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
"-p"
|
||||
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf"
|
||||
|
||||
"--semihosting"
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armPROC.dll"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armPROC.dll"
|
||||
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armJLINK.dll"
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armJLINK.dll"
|
||||
|
||||
"F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\Debug_FLASH\Exe\app_m146.out"
|
||||
"F:\FCB_project\RP-01\CODE\cva_asw_m0146\Debug_FLASH\Exe\app_m146.out"
|
||||
|
||||
--plugin="D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armbat.dll"
|
||||
--plugin="E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armbat.dll"
|
||||
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
</JLinkDriver>
|
||||
<PlDriver>
|
||||
<FirstRun>0</FirstRun>
|
||||
<MemConfigValue>D:\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>
|
||||
<ArmDriver>
|
||||
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
||||
|
File diff suppressed because one or more lines are too long
28
cva_asw_m0146/src/Matrix/butl/scm_matrix-binutil.c
Normal file
28
cva_asw_m0146/src/Matrix/butl/scm_matrix-binutil.c
Normal file
@ -0,0 +1,28 @@
|
||||
// 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;
|
||||
}
|
||||
|
42
cva_asw_m0146/src/Matrix/butl/scm_matrix-binutil.h
Normal file
42
cva_asw_m0146/src/Matrix/butl/scm_matrix-binutil.h
Normal file
@ -0,0 +1,42 @@
|
||||
// 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
|
||||
|
||||
#include "dbccodeconf.h"
|
||||
|
||||
#include "matrix.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Panel_Key_t Panel_Key;
|
||||
} scm_matrix_rx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SCM_STATE_t SCM_STATE;
|
||||
SCM_DEBUG1_t SCM_DEBUG1;
|
||||
SCM_DEBUG2_t SCM_DEBUG2;
|
||||
SCM_DEBUG3_t SCM_DEBUG3;
|
||||
SCM_DEBUG4_t SCM_DEBUG4;
|
||||
SCM_DEBUG5_t SCM_DEBUG5;
|
||||
SCM_DEBUG6_t SCM_DEBUG6;
|
||||
} scm_matrix_tx_t;
|
||||
|
||||
uint32_t scm_matrix_Receive(scm_matrix_rx_t* m, const uint8_t* d, uint32_t msgid, uint8_t dlc);
|
||||
|
||||
#ifdef __DEF_SCM_MATRIX__
|
||||
|
||||
extern scm_matrix_rx_t scm_matrix_rx;
|
||||
|
||||
extern scm_matrix_tx_t scm_matrix_tx;
|
||||
|
||||
#endif // __DEF_SCM_MATRIX__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
33
cva_asw_m0146/src/Matrix/conf/dbccodeconf.h
Normal file
33
cva_asw_m0146/src/Matrix/conf/dbccodeconf.h
Normal file
@ -0,0 +1,33 @@
|
||||
// Generator version : v3.1
|
||||
// Generation time : 2024.11.18 11:42:14
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// when USE_SIGFLOAT enabed the sigfloat_t must be defined
|
||||
// typedef double sigfloat_t;
|
||||
|
||||
// when USE_CANSTRUCT enabled __CoderDbcCanFrame_t__ must be defined
|
||||
#include "can_message.h"
|
||||
typedef CAN_DATATYPE __CoderDbcCanFrame_t__;
|
||||
|
||||
// if you need to allocate rx and tx messages structs put the allocation macro here
|
||||
// #define __DEF_{your_driver_name}__
|
||||
#define __DEF_SCM_MATRIX__
|
||||
|
||||
// defualt @__ext_sig__ help types definition
|
||||
|
||||
typedef uint32_t ubitext_t;
|
||||
typedef int32_t bitext_t;
|
||||
|
||||
// To provide a way to make missing control correctly you
|
||||
// have to define macro @GetSystemTick() which has to
|
||||
// return kind of tick counter (e.g. 1 ms ticker)
|
||||
|
||||
// #define GetSystemTick() __get__tick__()
|
||||
|
||||
// To provide a way to calculate hash (crc) for CAN
|
||||
// frame's data field you have to define macro @GetFrameHash
|
||||
|
||||
// #define GetFrameHash(a,b,c,d,e) __get_hash__(a,b,c,d,e)
|
||||
|
131
cva_asw_m0146/src/Matrix/conf/matrix-config.h
Normal file
131
cva_asw_m0146/src/Matrix/conf/matrix-config.h
Normal file
@ -0,0 +1,131 @@
|
||||
// Generator version : v3.1
|
||||
// Generation time : 2024.11.18 11:42:14
|
||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
||||
#pragma once
|
||||
|
||||
/* include common dbccode configurations */
|
||||
#include "dbccodeconf.h"
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
This define enables using CAN message structs with bit-fielded signals
|
||||
layout.
|
||||
|
||||
Note(!): bit-feild was not tested properly. */
|
||||
|
||||
#define MATRIX_USE_BITS_SIGNAL
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
This macro enables using CAN message descriptive struct packing functions
|
||||
(by default signature of pack function intakes a few simple typed params
|
||||
for loading data, len, etc). To compile you need to define the struct
|
||||
__CoderDbcCanFrame_t__ which must have fields:
|
||||
|
||||
u32 MsgId (CAN Frame message ID)
|
||||
u8 DLC (CAN Frame payload length field)
|
||||
u8 Data[8] (CAN Frame payload data)
|
||||
u8 IDE (CAN Frame Extended (1) / Standard (0) ID type)
|
||||
|
||||
This struct definition have to be placed (or be included) in dbccodeconf.h */
|
||||
|
||||
#define MATRIX_USE_CANSTRUCT
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
All the signals which have values of factor != 1 or offset != 0
|
||||
will be named in message struct with posfix '_ro'. Pack to payload
|
||||
operations will be made on this signal value as well as unpack from payload.
|
||||
|
||||
USE_SIGFLOAT macro makes some difference:
|
||||
|
||||
1. All the '_ro' fields will have a pair field with '_phys' postfix.
|
||||
If only offset != 0 is true then the type of '_phys' signal is the same
|
||||
as '_ro' signal. In other case the type will be @sigfloat_t which
|
||||
have to be defined in user dbccodeconf.h
|
||||
|
||||
2. In pack function '_ro' signal will be rewritten by '_phys' signal, which
|
||||
requires from user to use ONLY '_phys' signal for packing frame
|
||||
|
||||
3. In unpack function '_phys' signal will be written by '_ro' signal.
|
||||
User have to use '_phys' signal to read physical value. */
|
||||
|
||||
/* #define MATRIX_USE_SIGFLOAT */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
Note(!) that the "canmonitorutil.h" must be accessed in include path:
|
||||
|
||||
This macro adds:
|
||||
|
||||
- monitor field @mon1 to message struct
|
||||
|
||||
- capture system tick in unpack function and save value to mon1 field
|
||||
to provide to user better missing frame detection code. For this case
|
||||
user must provide function declared in canmonitorutil.h - GetSysTick()
|
||||
which may return 1ms uptime.
|
||||
|
||||
- calling function FMon_*** (from 'fmon' driver) inside unpack function
|
||||
which is empty by default and have to be filled by user if
|
||||
tests for DLC, rolling, checksum are necessary */
|
||||
|
||||
/* #define MATRIX_USE_DIAG_MONITORS */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
When monitor using is enabled (MATRIX_USE_DIAG_MONITORS) and define below
|
||||
uncommented, additional signal will be added to message struct. ***_expt:
|
||||
expected rolling counter, to perform monitoring rolling counter sequence
|
||||
automatically (result may be tested in dedicated Fmon_*** function) */
|
||||
|
||||
/* #define MATRIX_AUTO_ROLL */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
When monitor using is enabled (MATRIX_USE_DIAG_MONITORS) and define below
|
||||
uncommented, frame checksum signal may be handled automatically.
|
||||
|
||||
The signal which may be marked as checksum signal must have substring
|
||||
with next format:
|
||||
<Checksum:XOR8:3>
|
||||
|
||||
where:
|
||||
|
||||
- "Checksum": constant marker word
|
||||
|
||||
- "XOR8": type of method, this text will be passed to GetFrameHash
|
||||
(canmonitorutil.h) function as is, the best use case is to define 'enum
|
||||
DbcCanCrcMethods' in canmonitorutil.h file with all possible
|
||||
checksum algorithms (e.g. XOR8, XOR4 etc)
|
||||
|
||||
- "3": optional value that will be passed to GetFrameHash as integer value
|
||||
|
||||
Function GetFrameHash have to be implemented by user
|
||||
|
||||
In pack function checksum signal will be calculated automatically
|
||||
and loaded to payload
|
||||
|
||||
In unpack function checksum signal is checked with calculated.
|
||||
(result may be tested in dedicated Fmon_*** function). */
|
||||
|
||||
/* #define MATRIX_AUTO_CSM */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
FMon handling model can be build in two ways:
|
||||
|
||||
1 - Default. In this case when specific frame unpack is called the
|
||||
specific FMon_{Frame name}_{driver name} functoin will be called.
|
||||
User's code scope has to define each of these functions. Each function is
|
||||
responsible for the error handling of one frame
|
||||
|
||||
2 - MONO. In this case there is only one function to perform any frame
|
||||
monitoring. This function has to be implemented in the user's code scope.
|
||||
This function is named as FMon_MONO_{driver name}. It takes frame id
|
||||
which can be used for selection of the logic for a frame monitoring.
|
||||
This mode costs a bit more in runtime but when you often edit you DBC and you
|
||||
have more than one project it could be more maintanable (there is
|
||||
no necessity to replace source code)
|
||||
|
||||
For using MONO way uncomment line below */
|
||||
/* #define MATRIX_USE_MONO_FMON */
|
47
cva_asw_m0146/src/Matrix/inc/can_message.h
Normal file
47
cva_asw_m0146/src/Matrix/inc/can_message.h
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
/**
|
||||
* @file: can_message.h
|
||||
*
|
||||
* Purpose: Declare custom and register CAN datatype.
|
||||
*
|
||||
* $Authors: fcb $
|
||||
*
|
||||
* $Copyright: $
|
||||
*
|
||||
*/
|
||||
#ifndef __CANMESSAGE__HEADER__
|
||||
#define __CANMESSAGE__HEADER__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* @DO NOT REMOVE: The following typedef is required for targets (FM5, C166 etc.) to actually
|
||||
use it for their code generation TLC file. Since their datatype is being
|
||||
discarded, this is being defined in our header which they will be referencing.*/
|
||||
typedef enum {CAN_MESSAGE_STANDARD, CAN_MESSAGE_EXTENDED} CanFrameType;
|
||||
|
||||
/* Define invalid CAN Identifier value. This can be used to specify invalid CAN Message
|
||||
This represents a uint32_T value */
|
||||
#define INVALID_CAN_ID 0xFFFFFFFFU
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
/* Is Extended frame */
|
||||
uint8_t IDE;
|
||||
|
||||
/* Length */
|
||||
uint8_t DLC;
|
||||
|
||||
/* CAN ID */
|
||||
uint32_t MsgId;
|
||||
|
||||
/* Data field */
|
||||
uint8_t Data[8];
|
||||
|
||||
} CAN_MESSAGE;
|
||||
|
||||
typedef CAN_MESSAGE CAN_DATATYPE;
|
||||
|
||||
|
||||
|
||||
#endif
|
55
cva_asw_m0146/src/Matrix/inc/canmonitorutil.h
Normal file
55
cva_asw_m0146/src/Matrix/inc/canmonitorutil.h
Normal file
@ -0,0 +1,55 @@
|
||||
// Generator version : v3.1
|
||||
// Generation time : 2024.11.18 11:42:14
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// declare here all availible checksum algorithms
|
||||
typedef enum
|
||||
{
|
||||
// XOR8 = 0,
|
||||
// XOR4 = 1,
|
||||
// etc
|
||||
|
||||
// it is up to user to have or to skip final enum value - @CRC_ALG_COUNT
|
||||
CRC_ALG_COUNT
|
||||
} DbcCanCrcMethods;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// @last_cycle keeps tick-value when last frame was received
|
||||
uint32_t last_cycle;
|
||||
|
||||
// @timeout_cycle keeps maximum timeout for frame, user responsibility
|
||||
// to init this field and use it in missing frame monitoring function
|
||||
uint32_t timeout_cycle;
|
||||
|
||||
// @frame_cnt keeps count of all the received frames
|
||||
uint32_t frame_cnt;
|
||||
|
||||
// setting up @roll_error bit indicates roll counting fail.
|
||||
// Bit is not clearing automatically!
|
||||
uint32_t roll_error : 1;
|
||||
|
||||
// setting up @checksum_error bit indicates checksum checking failure.
|
||||
// Bit is not clearing automatically!
|
||||
uint32_t csm_error : 1;
|
||||
|
||||
// setting up @cycle_error bit indicates that time was overrunned.
|
||||
// Bit is not clearing automatically!
|
||||
uint32_t cycle_error : 1;
|
||||
|
||||
// setting up @dlc_error bit indicates that the actual length of
|
||||
// CAN frame is less then defined by CAN matrix!
|
||||
uint32_t dlc_error : 1;
|
||||
|
||||
} FrameMonitor_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
65
cva_asw_m0146/src/Matrix/lib/matrix-fmon.h
Normal file
65
cva_asw_m0146/src/Matrix/lib/matrix-fmon.h
Normal file
@ -0,0 +1,65 @@
|
||||
// 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
|
557
cva_asw_m0146/src/Matrix/lib/matrix.c
Normal file
557
cva_asw_m0146/src/Matrix/lib/matrix.c
Normal file
@ -0,0 +1,557 @@
|
||||
// Generator version : v3.1
|
||||
// Generation time : 2024.11.18 11:42:14
|
||||
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
|
||||
#include "matrix.h"
|
||||
|
||||
|
||||
// DBC file version
|
||||
#if (VER_MATRIX_MAJ != (0U)) || (VER_MATRIX_MIN != (0U))
|
||||
#error The MATRIX dbc source files have different versions
|
||||
#endif
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
// Function prototypes to be called each time CAN frame is unpacked
|
||||
// FMon function may detect RC, CRC or DLC violation
|
||||
#include "matrix-fmon.h"
|
||||
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
// This macro guard for the case when you need to enable
|
||||
// using diag monitors but there is no necessity in proper
|
||||
// SysTick provider. For providing one you need define macro
|
||||
// before this line - in dbccodeconf.h
|
||||
|
||||
#ifndef GetSystemTick
|
||||
#define GetSystemTick() (0u)
|
||||
#endif
|
||||
|
||||
// This macro guard is for the case when you want to build
|
||||
// app with enabled optoin auto CSM, but don't yet have
|
||||
// proper getframehash implementation
|
||||
|
||||
#ifndef GetFrameHash
|
||||
#define GetFrameHash(a,b,c,d,e) (0u)
|
||||
#endif
|
||||
|
||||
// This function performs extension of sign for the signals
|
||||
// whose bit width value is not aligned to one of power of 2 or less than 8.
|
||||
// The types 'bitext_t' and 'ubitext_t' define the biggest bit width which
|
||||
// can be correctly handled. You need to select type which can contain
|
||||
// n+1 bits where n is the largest signed signal width. For example if
|
||||
// the most wide signed signal has a width of 31 bits you need to set
|
||||
// bitext_t as int32_t and ubitext_t as uint32_t
|
||||
// Defined these typedefs in @dbccodeconf.h or locally in 'dbcdrvname'-config.h
|
||||
static bitext_t __ext_sig__(ubitext_t val, uint8_t bits)
|
||||
{
|
||||
ubitext_t const m = (ubitext_t) (1u << (bits - 1u));
|
||||
return ((val ^ m) - m);
|
||||
}
|
||||
|
||||
uint32_t Unpack_Panel_Key_Matrix(Panel_Key_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||
{
|
||||
(void)dlc_;
|
||||
_m->KEY_ZY_D = (uint8_t) ( (_d[0] & (0x01U)) );
|
||||
_m->KEY_ZY_U = (uint8_t) ( ((_d[0] >> 1U) & (0x01U)) );
|
||||
_m->KEY_TT_R = (uint8_t) ( ((_d[0] >> 2U) & (0x01U)) );
|
||||
_m->KEY_TT_F = (uint8_t) ( ((_d[0] >> 3U) & (0x01U)) );
|
||||
_m->KEY_KB_R = (uint8_t) ( ((_d[0] >> 4U) & (0x01U)) );
|
||||
_m->KEY_KB_F = (uint8_t) ( ((_d[0] >> 5U) & (0x01U)) );
|
||||
_m->KEY_HG_R = (uint8_t) ( ((_d[0] >> 6U) & (0x01U)) );
|
||||
_m->KEY_HG_F = (uint8_t) ( ((_d[0] >> 7U) & (0x01U)) );
|
||||
_m->KEY_YT_D = (uint8_t) ( (_d[1] & (0x01U)) );
|
||||
_m->KEY_YT_U = (uint8_t) ( ((_d[1] >> 1U) & (0x01U)) );
|
||||
_m->KEY_TZ_D = (uint8_t) ( ((_d[1] >> 2U) & (0x01U)) );
|
||||
_m->KEY_TZ_U = (uint8_t) ( ((_d[1] >> 3U) & (0x01U)) );
|
||||
_m->KEY_ZY_FAN = (uint8_t) ( (_d[2] & (0x01U)) );
|
||||
_m->KEY_ZY_HEAT = (uint8_t) ( ((_d[2] >> 1U) & (0x01U)) );
|
||||
_m->KEY_ZY_MSSG = (uint8_t) ( ((_d[2] >> 4U) & (0x01U)) );
|
||||
_m->KEY_MEMORY_3 = (uint8_t) ( (_d[3] & (0x01U)) );
|
||||
_m->KEY_MEMORY_2 = (uint8_t) ( ((_d[3] >> 1U) & (0x01U)) );
|
||||
_m->KEY_MEMORY_1 = (uint8_t) ( ((_d[3] >> 2U) & (0x01U)) );
|
||||
_m->KEY_MEMORY_SET = (uint8_t) ( ((_d[3] >> 3U) & (0x01U)) );
|
||||
_m->KEY_ZY_FLAT = (uint8_t) ( (_d[4] & (0x01U)) );
|
||||
_m->KEY_RESET = (uint8_t) ( ((_d[4] >> 1U) & (0x01U)) );
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
_m->mon1.dlc_error = (dlc_ < Panel_Key_DLC);
|
||||
_m->mon1.last_cycle = GetSystemTick();
|
||||
_m->mon1.frame_cnt++;
|
||||
|
||||
FMon_Panel_Key_matrix(&_m->mon1, Panel_Key_CANID);
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
return Panel_Key_CANID;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Pack_Panel_Key_Matrix(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);
|
||||
|
||||
cframe->Data[0] |= (uint8_t) ( (_m->KEY_ZY_D & (0x01U)) | ((_m->KEY_ZY_U & (0x01U)) << 1U) | ((_m->KEY_TT_R & (0x01U)) << 2U) | ((_m->KEY_TT_F & (0x01U)) << 3U) | ((_m->KEY_KB_R & (0x01U)) << 4U) | ((_m->KEY_KB_F & (0x01U)) << 5U) | ((_m->KEY_HG_R & (0x01U)) << 6U) | ((_m->KEY_HG_F & (0x01U)) << 7U) );
|
||||
cframe->Data[1] |= (uint8_t) ( (_m->KEY_YT_D & (0x01U)) | ((_m->KEY_YT_U & (0x01U)) << 1U) | ((_m->KEY_TZ_D & (0x01U)) << 2U) | ((_m->KEY_TZ_U & (0x01U)) << 3U) );
|
||||
cframe->Data[2] |= (uint8_t) ( (_m->KEY_ZY_FAN & (0x01U)) | ((_m->KEY_ZY_HEAT & (0x01U)) << 1U) | ((_m->KEY_ZY_MSSG & (0x01U)) << 4U) );
|
||||
cframe->Data[3] |= (uint8_t) ( (_m->KEY_MEMORY_3 & (0x01U)) | ((_m->KEY_MEMORY_2 & (0x01U)) << 1U) | ((_m->KEY_MEMORY_1 & (0x01U)) << 2U) | ((_m->KEY_MEMORY_SET & (0x01U)) << 3U) );
|
||||
cframe->Data[4] |= (uint8_t) ( (_m->KEY_ZY_FLAT & (0x01U)) | ((_m->KEY_RESET & (0x01U)) << 1U) );
|
||||
|
||||
cframe->MsgId = (uint32_t) Panel_Key_CANID;
|
||||
cframe->DLC = (uint8_t) Panel_Key_DLC;
|
||||
cframe->IDE = (uint8_t) Panel_Key_IDE;
|
||||
return Panel_Key_CANID;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t Pack_Panel_Key_Matrix(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);
|
||||
|
||||
_d[0] |= (uint8_t) ( (_m->KEY_ZY_D & (0x01U)) | ((_m->KEY_ZY_U & (0x01U)) << 1U) | ((_m->KEY_TT_R & (0x01U)) << 2U) | ((_m->KEY_TT_F & (0x01U)) << 3U) | ((_m->KEY_KB_R & (0x01U)) << 4U) | ((_m->KEY_KB_F & (0x01U)) << 5U) | ((_m->KEY_HG_R & (0x01U)) << 6U) | ((_m->KEY_HG_F & (0x01U)) << 7U) );
|
||||
_d[1] |= (uint8_t) ( (_m->KEY_YT_D & (0x01U)) | ((_m->KEY_YT_U & (0x01U)) << 1U) | ((_m->KEY_TZ_D & (0x01U)) << 2U) | ((_m->KEY_TZ_U & (0x01U)) << 3U) );
|
||||
_d[2] |= (uint8_t) ( (_m->KEY_ZY_FAN & (0x01U)) | ((_m->KEY_ZY_HEAT & (0x01U)) << 1U) | ((_m->KEY_ZY_MSSG & (0x01U)) << 4U) );
|
||||
_d[3] |= (uint8_t) ( (_m->KEY_MEMORY_3 & (0x01U)) | ((_m->KEY_MEMORY_2 & (0x01U)) << 1U) | ((_m->KEY_MEMORY_1 & (0x01U)) << 2U) | ((_m->KEY_MEMORY_SET & (0x01U)) << 3U) );
|
||||
_d[4] |= (uint8_t) ( (_m->KEY_ZY_FLAT & (0x01U)) | ((_m->KEY_RESET & (0x01U)) << 1U) );
|
||||
|
||||
*_len = (uint8_t) Panel_Key_DLC;
|
||||
*_ide = (uint8_t) Panel_Key_IDE;
|
||||
return Panel_Key_CANID;
|
||||
}
|
||||
|
||||
#endif // MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Unpack_SCM_STATE_Matrix(SCM_STATE_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||
{
|
||||
(void)dlc_;
|
||||
_m->MOTOR_HG_STATE = (uint8_t) ( (_d[0] & (0x03U)) );
|
||||
_m->MOTOR_KB_STATE = (uint8_t) ( ((_d[0] >> 2U) & (0x03U)) );
|
||||
_m->MOTOR_TT_STATE = (uint8_t) ( ((_d[0] >> 4U) & (0x03U)) );
|
||||
_m->MOTOR_TZ_STATE = (uint8_t) ( ((_d[0] >> 6U) & (0x03U)) );
|
||||
_m->MOTOR_YT_STATE = (uint8_t) ( (_d[1] & (0x03U)) );
|
||||
_m->MOTOR_ZY_STATE = (uint8_t) ( ((_d[1] >> 2U) & (0x03U)) );
|
||||
_m->ZY_FAN_STATE = (uint8_t) ( (_d[2] & (0x03U)) );
|
||||
_m->ZY_HEAT_STATE = (uint8_t) ( ((_d[2] >> 2U) & (0x03U)) );
|
||||
_m->ZY_MSSG_STATE = (uint8_t) ( ((_d[2] >> 4U) & (0x03U)) );
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
_m->mon1.dlc_error = (dlc_ < SCM_STATE_DLC);
|
||||
_m->mon1.last_cycle = GetSystemTick();
|
||||
_m->mon1.frame_cnt++;
|
||||
|
||||
FMon_SCM_STATE_matrix(&_m->mon1, SCM_STATE_CANID);
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
return SCM_STATE_CANID;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Pack_SCM_STATE_Matrix(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);
|
||||
|
||||
cframe->Data[0] |= (uint8_t) ( (_m->MOTOR_HG_STATE & (0x03U)) | ((_m->MOTOR_KB_STATE & (0x03U)) << 2U) | ((_m->MOTOR_TT_STATE & (0x03U)) << 4U) | ((_m->MOTOR_TZ_STATE & (0x03U)) << 6U) );
|
||||
cframe->Data[1] |= (uint8_t) ( (_m->MOTOR_YT_STATE & (0x03U)) | ((_m->MOTOR_ZY_STATE & (0x03U)) << 2U) );
|
||||
cframe->Data[2] |= (uint8_t) ( (_m->ZY_FAN_STATE & (0x03U)) | ((_m->ZY_HEAT_STATE & (0x03U)) << 2U) | ((_m->ZY_MSSG_STATE & (0x03U)) << 4U) );
|
||||
|
||||
cframe->MsgId = (uint32_t) SCM_STATE_CANID;
|
||||
cframe->DLC = (uint8_t) SCM_STATE_DLC;
|
||||
cframe->IDE = (uint8_t) SCM_STATE_IDE;
|
||||
return SCM_STATE_CANID;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t Pack_SCM_STATE_Matrix(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);
|
||||
|
||||
_d[0] |= (uint8_t) ( (_m->MOTOR_HG_STATE & (0x03U)) | ((_m->MOTOR_KB_STATE & (0x03U)) << 2U) | ((_m->MOTOR_TT_STATE & (0x03U)) << 4U) | ((_m->MOTOR_TZ_STATE & (0x03U)) << 6U) );
|
||||
_d[1] |= (uint8_t) ( (_m->MOTOR_YT_STATE & (0x03U)) | ((_m->MOTOR_ZY_STATE & (0x03U)) << 2U) );
|
||||
_d[2] |= (uint8_t) ( (_m->ZY_FAN_STATE & (0x03U)) | ((_m->ZY_HEAT_STATE & (0x03U)) << 2U) | ((_m->ZY_MSSG_STATE & (0x03U)) << 4U) );
|
||||
|
||||
*_len = (uint8_t) SCM_STATE_DLC;
|
||||
*_ide = (uint8_t) SCM_STATE_IDE;
|
||||
return SCM_STATE_CANID;
|
||||
}
|
||||
|
||||
#endif // MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Unpack_SCM_DEBUG1_Matrix(SCM_DEBUG1_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||
{
|
||||
(void)dlc_;
|
||||
_m->DEBUG_MOTOR_HG_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_HG_STATUS = (uint8_t) ( (_d[1] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_HG_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_HG_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_HG_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG1_DLC);
|
||||
_m->mon1.last_cycle = GetSystemTick();
|
||||
_m->mon1.frame_cnt++;
|
||||
|
||||
FMon_SCM_DEBUG1_matrix(&_m->mon1, SCM_DEBUG1_CANID);
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
return SCM_DEBUG1_CANID;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Pack_SCM_DEBUG1_Matrix(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);
|
||||
|
||||
cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_CURRENT & (0xFFU)) );
|
||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STATUS & (0xFFU)) );
|
||||
cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_LOC & (0xFFU)) );
|
||||
cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_LOC >> 8U) & (0xFFU)) );
|
||||
cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STOP_1 & (0xFFU)) );
|
||||
cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_STOP_1 >> 8U) & (0xFFU)) );
|
||||
cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STOP_2 & (0xFFU)) );
|
||||
cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
cframe->MsgId = (uint32_t) SCM_DEBUG1_CANID;
|
||||
cframe->DLC = (uint8_t) SCM_DEBUG1_DLC;
|
||||
cframe->IDE = (uint8_t) SCM_DEBUG1_IDE;
|
||||
return SCM_DEBUG1_CANID;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t Pack_SCM_DEBUG1_Matrix(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);
|
||||
|
||||
_d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_CURRENT & (0xFFU)) );
|
||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STATUS & (0xFFU)) );
|
||||
_d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_LOC & (0xFFU)) );
|
||||
_d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_LOC >> 8U) & (0xFFU)) );
|
||||
_d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STOP_1 & (0xFFU)) );
|
||||
_d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_STOP_1 >> 8U) & (0xFFU)) );
|
||||
_d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_HG_STOP_2 & (0xFFU)) );
|
||||
_d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_HG_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
*_len = (uint8_t) SCM_DEBUG1_DLC;
|
||||
*_ide = (uint8_t) SCM_DEBUG1_IDE;
|
||||
return SCM_DEBUG1_CANID;
|
||||
}
|
||||
|
||||
#endif // MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Unpack_SCM_DEBUG2_Matrix(SCM_DEBUG2_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||
{
|
||||
(void)dlc_;
|
||||
_m->DEBUG_MOTOR_KB_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_KB_STATUS = (uint8_t) ( (_d[1] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_KB_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_KB_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_KB_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG2_DLC);
|
||||
_m->mon1.last_cycle = GetSystemTick();
|
||||
_m->mon1.frame_cnt++;
|
||||
|
||||
FMon_SCM_DEBUG2_matrix(&_m->mon1, SCM_DEBUG2_CANID);
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
return SCM_DEBUG2_CANID;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Pack_SCM_DEBUG2_Matrix(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);
|
||||
|
||||
cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_CURRENT & (0xFFU)) );
|
||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STATUS & (0xFFU)) );
|
||||
cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_LOC & (0xFFU)) );
|
||||
cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_LOC >> 8U) & (0xFFU)) );
|
||||
cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STOP_1 & (0xFFU)) );
|
||||
cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_STOP_1 >> 8U) & (0xFFU)) );
|
||||
cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STOP_2 & (0xFFU)) );
|
||||
cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
cframe->MsgId = (uint32_t) SCM_DEBUG2_CANID;
|
||||
cframe->DLC = (uint8_t) SCM_DEBUG2_DLC;
|
||||
cframe->IDE = (uint8_t) SCM_DEBUG2_IDE;
|
||||
return SCM_DEBUG2_CANID;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t Pack_SCM_DEBUG2_Matrix(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);
|
||||
|
||||
_d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_CURRENT & (0xFFU)) );
|
||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STATUS & (0xFFU)) );
|
||||
_d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_LOC & (0xFFU)) );
|
||||
_d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_LOC >> 8U) & (0xFFU)) );
|
||||
_d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STOP_1 & (0xFFU)) );
|
||||
_d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_STOP_1 >> 8U) & (0xFFU)) );
|
||||
_d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_KB_STOP_2 & (0xFFU)) );
|
||||
_d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_KB_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
*_len = (uint8_t) SCM_DEBUG2_DLC;
|
||||
*_ide = (uint8_t) SCM_DEBUG2_IDE;
|
||||
return SCM_DEBUG2_CANID;
|
||||
}
|
||||
|
||||
#endif // MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Unpack_SCM_DEBUG3_Matrix(SCM_DEBUG3_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||
{
|
||||
(void)dlc_;
|
||||
_m->DEBUG_MOTOR_TT_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_TT_STATUS = (uint8_t) ( (_d[1] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_TT_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_TT_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_TT_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG3_DLC);
|
||||
_m->mon1.last_cycle = GetSystemTick();
|
||||
_m->mon1.frame_cnt++;
|
||||
|
||||
FMon_SCM_DEBUG3_matrix(&_m->mon1, SCM_DEBUG3_CANID);
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
return SCM_DEBUG3_CANID;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Pack_SCM_DEBUG3_Matrix(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);
|
||||
|
||||
cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_CURRENT & (0xFFU)) );
|
||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STATUS & (0xFFU)) );
|
||||
cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_LOC & (0xFFU)) );
|
||||
cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_LOC >> 8U) & (0xFFU)) );
|
||||
cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STOP_1 & (0xFFU)) );
|
||||
cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_STOP_1 >> 8U) & (0xFFU)) );
|
||||
cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STOP_2 & (0xFFU)) );
|
||||
cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
cframe->MsgId = (uint32_t) SCM_DEBUG3_CANID;
|
||||
cframe->DLC = (uint8_t) SCM_DEBUG3_DLC;
|
||||
cframe->IDE = (uint8_t) SCM_DEBUG3_IDE;
|
||||
return SCM_DEBUG3_CANID;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t Pack_SCM_DEBUG3_Matrix(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);
|
||||
|
||||
_d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_CURRENT & (0xFFU)) );
|
||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STATUS & (0xFFU)) );
|
||||
_d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_LOC & (0xFFU)) );
|
||||
_d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_LOC >> 8U) & (0xFFU)) );
|
||||
_d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STOP_1 & (0xFFU)) );
|
||||
_d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_STOP_1 >> 8U) & (0xFFU)) );
|
||||
_d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_TT_STOP_2 & (0xFFU)) );
|
||||
_d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TT_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
*_len = (uint8_t) SCM_DEBUG3_DLC;
|
||||
*_ide = (uint8_t) SCM_DEBUG3_IDE;
|
||||
return SCM_DEBUG3_CANID;
|
||||
}
|
||||
|
||||
#endif // MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Unpack_SCM_DEBUG4_Matrix(SCM_DEBUG4_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||
{
|
||||
(void)dlc_;
|
||||
_m->DEBUG_MOTOR_ZY_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_ZY_STATUS = (uint8_t) ( (_d[1] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_ZY_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_ZY_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_ZY_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG4_DLC);
|
||||
_m->mon1.last_cycle = GetSystemTick();
|
||||
_m->mon1.frame_cnt++;
|
||||
|
||||
FMon_SCM_DEBUG4_matrix(&_m->mon1, SCM_DEBUG4_CANID);
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
return SCM_DEBUG4_CANID;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Pack_SCM_DEBUG4_Matrix(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);
|
||||
|
||||
cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_CURRENT & (0xFFU)) );
|
||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STATUS & (0xFFU)) );
|
||||
cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_LOC & (0xFFU)) );
|
||||
cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_LOC >> 8U) & (0xFFU)) );
|
||||
cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STOP_1 & (0xFFU)) );
|
||||
cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_STOP_1 >> 8U) & (0xFFU)) );
|
||||
cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STOP_2 & (0xFFU)) );
|
||||
cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
cframe->MsgId = (uint32_t) SCM_DEBUG4_CANID;
|
||||
cframe->DLC = (uint8_t) SCM_DEBUG4_DLC;
|
||||
cframe->IDE = (uint8_t) SCM_DEBUG4_IDE;
|
||||
return SCM_DEBUG4_CANID;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t Pack_SCM_DEBUG4_Matrix(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);
|
||||
|
||||
_d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_CURRENT & (0xFFU)) );
|
||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STATUS & (0xFFU)) );
|
||||
_d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_LOC & (0xFFU)) );
|
||||
_d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_LOC >> 8U) & (0xFFU)) );
|
||||
_d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STOP_1 & (0xFFU)) );
|
||||
_d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_STOP_1 >> 8U) & (0xFFU)) );
|
||||
_d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_ZY_STOP_2 & (0xFFU)) );
|
||||
_d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_ZY_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
*_len = (uint8_t) SCM_DEBUG4_DLC;
|
||||
*_ide = (uint8_t) SCM_DEBUG4_IDE;
|
||||
return SCM_DEBUG4_CANID;
|
||||
}
|
||||
|
||||
#endif // MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Unpack_SCM_DEBUG5_Matrix(SCM_DEBUG5_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||
{
|
||||
(void)dlc_;
|
||||
_m->DEBUG_MOTOR_TZ_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_TZ_STATUS = (uint8_t) ( (_d[1] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_TZ_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_TZ_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_TZ_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG5_DLC);
|
||||
_m->mon1.last_cycle = GetSystemTick();
|
||||
_m->mon1.frame_cnt++;
|
||||
|
||||
FMon_SCM_DEBUG5_matrix(&_m->mon1, SCM_DEBUG5_CANID);
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
return SCM_DEBUG5_CANID;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Pack_SCM_DEBUG5_Matrix(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);
|
||||
|
||||
cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_CURRENT & (0xFFU)) );
|
||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STATUS & (0xFFU)) );
|
||||
cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_LOC & (0xFFU)) );
|
||||
cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_LOC >> 8U) & (0xFFU)) );
|
||||
cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STOP_1 & (0xFFU)) );
|
||||
cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_STOP_1 >> 8U) & (0xFFU)) );
|
||||
cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STOP_2 & (0xFFU)) );
|
||||
cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
cframe->MsgId = (uint32_t) SCM_DEBUG5_CANID;
|
||||
cframe->DLC = (uint8_t) SCM_DEBUG5_DLC;
|
||||
cframe->IDE = (uint8_t) SCM_DEBUG5_IDE;
|
||||
return SCM_DEBUG5_CANID;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t Pack_SCM_DEBUG5_Matrix(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);
|
||||
|
||||
_d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_CURRENT & (0xFFU)) );
|
||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STATUS & (0xFFU)) );
|
||||
_d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_LOC & (0xFFU)) );
|
||||
_d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_LOC >> 8U) & (0xFFU)) );
|
||||
_d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STOP_1 & (0xFFU)) );
|
||||
_d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_STOP_1 >> 8U) & (0xFFU)) );
|
||||
_d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_TZ_STOP_2 & (0xFFU)) );
|
||||
_d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_TZ_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
*_len = (uint8_t) SCM_DEBUG5_DLC;
|
||||
*_ide = (uint8_t) SCM_DEBUG5_IDE;
|
||||
return SCM_DEBUG5_CANID;
|
||||
}
|
||||
|
||||
#endif // MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Unpack_SCM_DEBUG6_Matrix(SCM_DEBUG6_t* _m, const uint8_t* _d, uint8_t dlc_)
|
||||
{
|
||||
(void)dlc_;
|
||||
_m->DEBUG_MOTOR_YT_CURRENT = (uint8_t) ( (_d[0] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_YT_STATUS = (uint8_t) ( (_d[1] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_YT_LOC = (uint16_t) ( ((_d[3] & (0xFFU)) << 8U) | (_d[2] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_YT_STOP_1 = (uint16_t) ( ((_d[5] & (0xFFU)) << 8U) | (_d[4] & (0xFFU)) );
|
||||
_m->DEBUG_MOTOR_YT_STOP_2 = (uint16_t) ( ((_d[7] & (0xFFU)) << 8U) | (_d[6] & (0xFFU)) );
|
||||
|
||||
#ifdef MATRIX_USE_DIAG_MONITORS
|
||||
_m->mon1.dlc_error = (dlc_ < SCM_DEBUG6_DLC);
|
||||
_m->mon1.last_cycle = GetSystemTick();
|
||||
_m->mon1.frame_cnt++;
|
||||
|
||||
FMon_SCM_DEBUG6_matrix(&_m->mon1, SCM_DEBUG6_CANID);
|
||||
#endif // MATRIX_USE_DIAG_MONITORS
|
||||
|
||||
return SCM_DEBUG6_CANID;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_USE_CANSTRUCT
|
||||
|
||||
uint32_t Pack_SCM_DEBUG6_Matrix(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);
|
||||
|
||||
cframe->Data[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_CURRENT & (0xFFU)) );
|
||||
cframe->Data[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STATUS & (0xFFU)) );
|
||||
cframe->Data[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_LOC & (0xFFU)) );
|
||||
cframe->Data[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_LOC >> 8U) & (0xFFU)) );
|
||||
cframe->Data[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STOP_1 & (0xFFU)) );
|
||||
cframe->Data[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_STOP_1 >> 8U) & (0xFFU)) );
|
||||
cframe->Data[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STOP_2 & (0xFFU)) );
|
||||
cframe->Data[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
cframe->MsgId = (uint32_t) SCM_DEBUG6_CANID;
|
||||
cframe->DLC = (uint8_t) SCM_DEBUG6_DLC;
|
||||
cframe->IDE = (uint8_t) SCM_DEBUG6_IDE;
|
||||
return SCM_DEBUG6_CANID;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint32_t Pack_SCM_DEBUG6_Matrix(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);
|
||||
|
||||
_d[0] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_CURRENT & (0xFFU)) );
|
||||
_d[1] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STATUS & (0xFFU)) );
|
||||
_d[2] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_LOC & (0xFFU)) );
|
||||
_d[3] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_LOC >> 8U) & (0xFFU)) );
|
||||
_d[4] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STOP_1 & (0xFFU)) );
|
||||
_d[5] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_STOP_1 >> 8U) & (0xFFU)) );
|
||||
_d[6] |= (uint8_t) ( (_m->DEBUG_MOTOR_YT_STOP_2 & (0xFFU)) );
|
||||
_d[7] |= (uint8_t) ( ((_m->DEBUG_MOTOR_YT_STOP_2 >> 8U) & (0xFFU)) );
|
||||
|
||||
*_len = (uint8_t) SCM_DEBUG6_DLC;
|
||||
*_ide = (uint8_t) SCM_DEBUG6_IDE;
|
||||
return SCM_DEBUG6_CANID;
|
||||
}
|
||||
|
||||
#endif // MATRIX_USE_CANSTRUCT
|
||||
|
1080
cva_asw_m0146/src/Matrix/lib/matrix.h
Normal file
1080
cva_asw_m0146/src/Matrix/lib/matrix.h
Normal file
File diff suppressed because it is too large
Load Diff
73
cva_asw_m0146/src/Matrix/usr/matrix-fmon.c
Normal file
73
cva_asw_m0146/src/Matrix/usr/matrix-fmon.c
Normal file
@ -0,0 +1,73 @@
|
||||
// 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,636 +0,0 @@
|
||||
/*
|
||||
* File: KeyPro.c
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#include "rtwtypes.h"
|
||||
#include "KeyPro.h"
|
||||
|
||||
/* Named constants for Chart: '<S6>/Value_Debounce_Chart' */
|
||||
#define RP_01_APP_IN_Default_output ((uint8_T)1U)
|
||||
#define RP_01_APP_IN_Update_output ((uint8_T)2U)
|
||||
#define RP_01_APP_IN_input_changed ((uint8_T)3U)
|
||||
|
||||
/*
|
||||
* System initialize for atomic system:
|
||||
* '<S6>/Value_Debounce_Chart'
|
||||
* '<S7>/Value_Debounce_Chart'
|
||||
* '<S8>/Value_Debounce_Chart'
|
||||
* '<S9>/Value_Debounce_Chart'
|
||||
* '<S10>/Value_Debounce_Chart'
|
||||
* '<S11>/Value_Debounce_Chart'
|
||||
* '<S12>/Value_Debounce_Chart'
|
||||
* '<S13>/Value_Debounce_Chart'
|
||||
* '<S14>/Value_Debounce_Chart'
|
||||
* '<S15>/Value_Debounce_Chart'
|
||||
* ...
|
||||
*/
|
||||
void RP_01_Value_Debounce_Chart_Init(uint8_T *rty_output)
|
||||
{
|
||||
*rty_output = 0U;
|
||||
}
|
||||
|
||||
/*
|
||||
* Output and update for atomic system:
|
||||
* '<S6>/Value_Debounce_Chart'
|
||||
* '<S7>/Value_Debounce_Chart'
|
||||
* '<S8>/Value_Debounce_Chart'
|
||||
* '<S9>/Value_Debounce_Chart'
|
||||
* '<S10>/Value_Debounce_Chart'
|
||||
* '<S11>/Value_Debounce_Chart'
|
||||
* '<S12>/Value_Debounce_Chart'
|
||||
* '<S13>/Value_Debounce_Chart'
|
||||
* '<S14>/Value_Debounce_Chart'
|
||||
* '<S15>/Value_Debounce_Chart'
|
||||
* ...
|
||||
*/
|
||||
void RP_01_APP_Value_Debounce_Chart(uint8_T rtu_input, uint8_T rtu_change_flag,
|
||||
uint8_T *rty_output, uint8_T rtp_Debounce_count,
|
||||
DW_Value_Debounce_Chart_RP_01_T *localDW)
|
||||
{
|
||||
if ((uint32_T)localDW->temporalCounter_i1 < 255U) {
|
||||
localDW->temporalCounter_i1 = (uint8_T)((uint32_T)
|
||||
localDW->temporalCounter_i1 + 1U);
|
||||
}
|
||||
|
||||
/* Chart: '<S6>/Value_Debounce_Chart' */
|
||||
if ((uint32_T)localDW->bitsForTID0.is_active_c1_WorkLib == 0U) {
|
||||
localDW->bitsForTID0.is_active_c1_WorkLib = 1U;
|
||||
localDW->bitsForTID0.is_c1_WorkLib = RP_01_APP_IN_Default_output;
|
||||
*rty_output = rtu_input;
|
||||
} else {
|
||||
switch (localDW->bitsForTID0.is_c1_WorkLib) {
|
||||
case RP_01_APP_IN_Default_output:
|
||||
if (rtu_change_flag == 1U) {
|
||||
localDW->temp_state = rtu_input;
|
||||
localDW->temporalCounter_i1 = 0U;
|
||||
localDW->bitsForTID0.is_c1_WorkLib = RP_01_APP_IN_input_changed;
|
||||
}
|
||||
break;
|
||||
|
||||
case RP_01_APP_IN_Update_output:
|
||||
if (rtu_change_flag == 1U) {
|
||||
localDW->temp_state = rtu_input;
|
||||
localDW->temporalCounter_i1 = 0U;
|
||||
localDW->bitsForTID0.is_c1_WorkLib = RP_01_APP_IN_input_changed;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* case IN_input_changed: */
|
||||
if (localDW->temporalCounter_i1 >= rtp_Debounce_count) {
|
||||
localDW->bitsForTID0.is_c1_WorkLib = RP_01_APP_IN_Update_output;
|
||||
*rty_output = localDW->temp_state;
|
||||
} else if (rtu_change_flag == 1U) {
|
||||
localDW->temp_state = rtu_input;
|
||||
localDW->temporalCounter_i1 = 0U;
|
||||
localDW->bitsForTID0.is_c1_WorkLib = RP_01_APP_IN_input_changed;
|
||||
} else {
|
||||
/* no actions */
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of Chart: '<S6>/Value_Debounce_Chart' */
|
||||
}
|
||||
|
||||
/* System initialize for function-call system: '<Root>/KeyPro' */
|
||||
void RP_01_APP_KeyPro_Init(uint8_T *rty_KeyHG_F_state, uint8_T
|
||||
*rty_KeyHG_R_state, uint8_T *rty_KeyKB_F_state, uint8_T *rty_KeyKB_R_state,
|
||||
uint8_T *rty_KeyTT_F_state, uint8_T *rty_KeyTT_R_state, uint8_T
|
||||
*rty_KeyZY_U_state, uint8_T *rty_KeyZY_D_state, uint8_T *rty_KeyTZ_U_state,
|
||||
uint8_T *rty_KeyTZ_D_state, uint8_T *rty_KeyYT_U_state, uint8_T
|
||||
*rty_KeyYT_D_state, uint8_T *rty_KeyZY_HEAT_state, uint8_T
|
||||
*rty_KeyZY_FAN_state, uint8_T *rty_KeyZY_MSSG_state, uint8_T
|
||||
*rty_KeyMEMORY_SET_state, uint8_T *rty_KeyMEMORY_1_state, uint8_T
|
||||
*rty_KeyMEMORY_2_state, uint8_T *rty_KeyMEMORY_3_state, uint8_T
|
||||
*rty_KeyRESET_state, uint8_T *rty_KeyZY_FLAT_state)
|
||||
{
|
||||
/* SystemInitialize for Chart: '<S6>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyHG_F_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S7>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyHG_R_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S16>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyKB_F_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S20>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyKB_R_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S21>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyTT_F_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S22>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyTT_R_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S23>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyZY_U_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S24>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyZY_D_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S25>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyTZ_U_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S26>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyTZ_D_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S8>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyYT_U_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S9>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyYT_D_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S10>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyZY_HEAT_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S11>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyZY_FAN_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S12>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyZY_MSSG_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S13>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyMEMORY_SET_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S17>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyMEMORY_1_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S18>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyMEMORY_2_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S19>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyMEMORY_3_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S14>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyRESET_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S15>/Value_Debounce_Chart' */
|
||||
RP_01_Value_Debounce_Chart_Init(rty_KeyZY_FLAT_state);
|
||||
}
|
||||
|
||||
/* Output and update for function-call system: '<Root>/KeyPro' */
|
||||
void RP_01_APP_KeyPro(uint8_T rtu_KeyHG_F, uint8_T rtu_KeyHG_R, uint8_T
|
||||
rtu_KeyKB_F, uint8_T rtu_KeyKB_R, uint8_T rtu_KeyTT_F,
|
||||
uint8_T rtu_KeyTT_R, uint8_T rtu_KeyZY_U, uint8_T
|
||||
rtu_KeyZY_D, uint8_T rtu_KeyTZ_U, uint8_T rtu_KeyTZ_D,
|
||||
uint8_T rtu_KeyYT_U, uint8_T rtu_KeyYT_D, uint8_T
|
||||
rtu_KeyZY_HEAT, uint8_T rtu_KeyZY_FAN, uint8_T
|
||||
rtu_KeyZY_MSSG, uint8_T rtu_KeyMEMORY_SET, uint8_T
|
||||
rtu_KeyMEMORY_1, uint8_T rtu_KeyMEMORY_2, uint8_T
|
||||
rtu_KeyMEMORY_3, uint8_T rtu_KeyRESET, uint8_T
|
||||
rtu_KeyZY_FLAT, uint8_T *rty_KeyHG_F_state, uint8_T
|
||||
*rty_KeyHG_R_state, uint8_T *rty_KeyKB_F_state, uint8_T
|
||||
*rty_KeyKB_R_state, uint8_T *rty_KeyTT_F_state, uint8_T
|
||||
*rty_KeyTT_R_state, uint8_T *rty_KeyZY_U_state, uint8_T
|
||||
*rty_KeyZY_D_state, uint8_T *rty_KeyTZ_U_state, uint8_T
|
||||
*rty_KeyTZ_D_state, uint8_T *rty_KeyYT_U_state, uint8_T
|
||||
*rty_KeyYT_D_state, uint8_T *rty_KeyZY_HEAT_state, uint8_T
|
||||
*rty_KeyZY_FAN_state, uint8_T *rty_KeyZY_MSSG_state,
|
||||
uint8_T *rty_KeyMEMORY_SET_state, uint8_T
|
||||
*rty_KeyMEMORY_1_state, uint8_T *rty_KeyMEMORY_2_state,
|
||||
uint8_T *rty_KeyMEMORY_3_state, uint8_T
|
||||
*rty_KeyRESET_state, uint8_T *rty_KeyZY_FLAT_state,
|
||||
DW_KeyPro_RP_01_APP_T *localDW)
|
||||
{
|
||||
/* Chart: '<S6>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S27>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S27>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S27>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyHG_F, (uint8_T)((rtu_KeyHG_F !=
|
||||
localDW->DelayInput1_DSTATE) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyHG_F_state, 3, &localDW->sf_Value_Debounce_Chart);
|
||||
|
||||
/* Chart: '<S7>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S29>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S29>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S29>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyHG_R, (uint8_T)((rtu_KeyHG_R !=
|
||||
localDW->DelayInput1_DSTATE_h) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyHG_R_state, 3, &localDW->sf_Value_Debounce_Chart_f);
|
||||
|
||||
/* Chart: '<S16>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S47>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S47>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S47>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyKB_F, (uint8_T)((rtu_KeyKB_F !=
|
||||
localDW->DelayInput1_DSTATE_e) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyKB_F_state, 3, &localDW->sf_Value_Debounce_Chart_hx);
|
||||
|
||||
/* Chart: '<S20>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S55>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S55>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S55>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyKB_R, (uint8_T)((rtu_KeyKB_R !=
|
||||
localDW->DelayInput1_DSTATE_j) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyKB_R_state, 3, &localDW->sf_Value_Debounce_Chart_k);
|
||||
|
||||
/* Chart: '<S21>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S57>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S57>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S57>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyTT_F, (uint8_T)((rtu_KeyTT_F !=
|
||||
localDW->DelayInput1_DSTATE_a) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyTT_F_state, 3, &localDW->sf_Value_Debounce_Chart_m);
|
||||
|
||||
/* Chart: '<S22>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S59>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S59>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S59>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyTT_R, (uint8_T)((rtu_KeyTT_R !=
|
||||
localDW->DelayInput1_DSTATE_c) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyTT_R_state, 3, &localDW->sf_Value_Debounce_Chart_d);
|
||||
|
||||
/* Chart: '<S23>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S61>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S61>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S61>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyZY_U, (uint8_T)((rtu_KeyZY_U !=
|
||||
localDW->DelayInput1_DSTATE_k) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyZY_U_state, 3, &localDW->sf_Value_Debounce_Chart_l);
|
||||
|
||||
/* Chart: '<S24>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S63>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S63>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S63>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyZY_D, (uint8_T)((rtu_KeyZY_D !=
|
||||
localDW->DelayInput1_DSTATE_n) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyZY_D_state, 3, &localDW->sf_Value_Debounce_Chart_b);
|
||||
|
||||
/* Chart: '<S25>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S65>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S65>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S65>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyTZ_U, (uint8_T)((rtu_KeyTZ_U !=
|
||||
localDW->DelayInput1_DSTATE_af) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyTZ_U_state, 3, &localDW->sf_Value_Debounce_Chart_ba);
|
||||
|
||||
/* Chart: '<S26>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S67>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S67>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S67>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyTZ_D, (uint8_T)((rtu_KeyTZ_D !=
|
||||
localDW->DelayInput1_DSTATE_no) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyTZ_D_state, 3, &localDW->sf_Value_Debounce_Chart_cg);
|
||||
|
||||
/* Chart: '<S8>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S31>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S31>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S31>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyYT_U, (uint8_T)((rtu_KeyYT_U !=
|
||||
localDW->DelayInput1_DSTATE_d) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyYT_U_state, 3, &localDW->sf_Value_Debounce_Chart_a);
|
||||
|
||||
/* Chart: '<S9>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S33>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S33>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S33>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyYT_D, (uint8_T)((rtu_KeyYT_D !=
|
||||
localDW->DelayInput1_DSTATE_av) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyYT_D_state, 3, &localDW->sf_Value_Debounce_Chart_o);
|
||||
|
||||
/* Chart: '<S10>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S35>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S35>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S35>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyZY_HEAT, (uint8_T)((rtu_KeyZY_HEAT !=
|
||||
localDW->DelayInput1_DSTATE_ks) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyZY_HEAT_state, 3, &localDW->sf_Value_Debounce_Chart_c);
|
||||
|
||||
/* Chart: '<S11>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S37>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S37>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S37>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyZY_FAN, (uint8_T)((rtu_KeyZY_FAN !=
|
||||
localDW->DelayInput1_DSTATE_f) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyZY_FAN_state, 3, &localDW->sf_Value_Debounce_Chart_cj);
|
||||
|
||||
/* Chart: '<S12>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S39>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S39>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S39>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyZY_MSSG, (uint8_T)((rtu_KeyZY_MSSG !=
|
||||
localDW->DelayInput1_DSTATE_p) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyZY_MSSG_state, 3, &localDW->sf_Value_Debounce_Chart_h);
|
||||
|
||||
/* Chart: '<S13>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S41>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S41>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S41>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyMEMORY_SET, (uint8_T)
|
||||
((rtu_KeyMEMORY_SET != localDW->DelayInput1_DSTATE_pu) ? ((int32_T)1) :
|
||||
((int32_T)0)), rty_KeyMEMORY_SET_state, 3,
|
||||
&localDW->sf_Value_Debounce_Chart_cu);
|
||||
|
||||
/* Chart: '<S17>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S49>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S49>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S49>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyMEMORY_1, (uint8_T)((rtu_KeyMEMORY_1
|
||||
!= localDW->DelayInput1_DSTATE_o) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyMEMORY_1_state, 3, &localDW->sf_Value_Debounce_Chart_os);
|
||||
|
||||
/* Chart: '<S18>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S51>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S51>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S51>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyMEMORY_2, (uint8_T)((rtu_KeyMEMORY_2
|
||||
!= localDW->DelayInput1_DSTATE_g) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyMEMORY_2_state, 3, &localDW->sf_Value_Debounce_Chart_p);
|
||||
|
||||
/* Chart: '<S19>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S53>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S53>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S53>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyMEMORY_3, (uint8_T)((rtu_KeyMEMORY_3
|
||||
!= localDW->DelayInput1_DSTATE_i) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyMEMORY_3_state, 3, &localDW->sf_Value_Debounce_Chart_ab);
|
||||
|
||||
/* Chart: '<S14>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S43>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S43>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S43>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyRESET, (uint8_T)((rtu_KeyRESET !=
|
||||
localDW->DelayInput1_DSTATE_ez) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyRESET_state, 3, &localDW->sf_Value_Debounce_Chart_co);
|
||||
|
||||
/* Chart: '<S15>/Value_Debounce_Chart' incorporates:
|
||||
* RelationalOperator: '<S45>/FixPt Relational Operator'
|
||||
* UnitDelay: '<S45>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S45>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
RP_01_APP_Value_Debounce_Chart(rtu_KeyZY_FLAT, (uint8_T)((rtu_KeyZY_FLAT !=
|
||||
localDW->DelayInput1_DSTATE_hp) ? ((int32_T)1) : ((int32_T)0)),
|
||||
rty_KeyZY_FLAT_state, 3, &localDW->sf_Value_Debounce_Chart_av);
|
||||
|
||||
/* Update for UnitDelay: '<S27>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S27>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE = rtu_KeyHG_F;
|
||||
|
||||
/* Update for UnitDelay: '<S29>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S29>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_h = rtu_KeyHG_R;
|
||||
|
||||
/* Update for UnitDelay: '<S47>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S47>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_e = rtu_KeyKB_F;
|
||||
|
||||
/* Update for UnitDelay: '<S55>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S55>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_j = rtu_KeyKB_R;
|
||||
|
||||
/* Update for UnitDelay: '<S57>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S57>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_a = rtu_KeyTT_F;
|
||||
|
||||
/* Update for UnitDelay: '<S59>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S59>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_c = rtu_KeyTT_R;
|
||||
|
||||
/* Update for UnitDelay: '<S61>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S61>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_k = rtu_KeyZY_U;
|
||||
|
||||
/* Update for UnitDelay: '<S63>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S63>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_n = rtu_KeyZY_D;
|
||||
|
||||
/* Update for UnitDelay: '<S65>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S65>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_af = rtu_KeyTZ_U;
|
||||
|
||||
/* Update for UnitDelay: '<S67>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S67>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_no = rtu_KeyTZ_D;
|
||||
|
||||
/* Update for UnitDelay: '<S31>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S31>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_d = rtu_KeyYT_U;
|
||||
|
||||
/* Update for UnitDelay: '<S33>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S33>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_av = rtu_KeyYT_D;
|
||||
|
||||
/* Update for UnitDelay: '<S35>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S35>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_ks = rtu_KeyZY_HEAT;
|
||||
|
||||
/* Update for UnitDelay: '<S37>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S37>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_f = rtu_KeyZY_FAN;
|
||||
|
||||
/* Update for UnitDelay: '<S39>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S39>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_p = rtu_KeyZY_MSSG;
|
||||
|
||||
/* Update for UnitDelay: '<S41>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S41>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_pu = rtu_KeyMEMORY_SET;
|
||||
|
||||
/* Update for UnitDelay: '<S49>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S49>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_o = rtu_KeyMEMORY_1;
|
||||
|
||||
/* Update for UnitDelay: '<S51>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S51>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_g = rtu_KeyMEMORY_2;
|
||||
|
||||
/* Update for UnitDelay: '<S53>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S53>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_i = rtu_KeyMEMORY_3;
|
||||
|
||||
/* Update for UnitDelay: '<S43>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S43>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_ez = rtu_KeyRESET;
|
||||
|
||||
/* Update for UnitDelay: '<S45>/Delay Input1'
|
||||
*
|
||||
* Block description for '<S45>/Delay Input1':
|
||||
*
|
||||
* Store in Global RAM
|
||||
*/
|
||||
localDW->DelayInput1_DSTATE_hp = rtu_KeyZY_FLAT;
|
||||
}
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* File: KeyPro.h
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#ifndef RTW_HEADER_KeyPro_h_
|
||||
#define RTW_HEADER_KeyPro_h_
|
||||
#ifndef RP_01_APP_COMMON_INCLUDES_
|
||||
#define RP_01_APP_COMMON_INCLUDES_
|
||||
#include <math.h>
|
||||
#include "rtwtypes.h"
|
||||
#endif /* RP_01_APP_COMMON_INCLUDES_ */
|
||||
|
||||
/* Block states (default storage) for system '<S6>/Value_Debounce_Chart' */
|
||||
typedef struct {
|
||||
struct {
|
||||
uint_T is_c1_WorkLib:2; /* '<S6>/Value_Debounce_Chart' */
|
||||
uint_T is_active_c1_WorkLib:1; /* '<S6>/Value_Debounce_Chart' */
|
||||
} bitsForTID0;
|
||||
|
||||
uint8_T temp_state; /* '<S6>/Value_Debounce_Chart' */
|
||||
uint8_T temporalCounter_i1; /* '<S6>/Value_Debounce_Chart' */
|
||||
} DW_Value_Debounce_Chart_RP_01_T;
|
||||
|
||||
/* Block states (default storage) for system '<Root>/KeyPro' */
|
||||
typedef struct {
|
||||
uint8_T DelayInput1_DSTATE; /* '<S27>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_h; /* '<S29>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_e; /* '<S47>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_j; /* '<S55>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_a; /* '<S57>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_c; /* '<S59>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_k; /* '<S61>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_n; /* '<S63>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_af; /* '<S65>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_no; /* '<S67>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_d; /* '<S31>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_av; /* '<S33>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_ks; /* '<S35>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_f; /* '<S37>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_p; /* '<S39>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_pu; /* '<S41>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_o; /* '<S49>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_g; /* '<S51>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_i; /* '<S53>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_ez; /* '<S43>/Delay Input1' */
|
||||
uint8_T DelayInput1_DSTATE_hp; /* '<S45>/Delay Input1' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_cg;/* '<S26>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_ba;/* '<S25>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_b;/* '<S24>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_l;/* '<S23>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_d;/* '<S22>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_m;/* '<S21>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_k;/* '<S20>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_ab;/* '<S19>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_p;/* '<S18>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_os;/* '<S17>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_hx;/* '<S16>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_av;/* '<S15>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_co;/* '<S14>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_cu;/* '<S13>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_h;/* '<S12>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_cj;/* '<S11>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_c;/* '<S10>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_o;/* '<S9>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_a;/* '<S8>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart_f;/* '<S7>/Value_Debounce_Chart' */
|
||||
DW_Value_Debounce_Chart_RP_01_T sf_Value_Debounce_Chart;/* '<S6>/Value_Debounce_Chart' */
|
||||
} DW_KeyPro_RP_01_APP_T;
|
||||
|
||||
extern void RP_01_Value_Debounce_Chart_Init(uint8_T *rty_output);
|
||||
extern void RP_01_APP_Value_Debounce_Chart(uint8_T rtu_input, uint8_T
|
||||
rtu_change_flag, uint8_T *rty_output, uint8_T rtp_Debounce_count,
|
||||
DW_Value_Debounce_Chart_RP_01_T *localDW);
|
||||
extern void RP_01_APP_KeyPro_Init(uint8_T *rty_KeyHG_F_state, uint8_T
|
||||
*rty_KeyHG_R_state, uint8_T *rty_KeyKB_F_state, uint8_T *rty_KeyKB_R_state,
|
||||
uint8_T *rty_KeyTT_F_state, uint8_T *rty_KeyTT_R_state, uint8_T
|
||||
*rty_KeyZY_U_state, uint8_T *rty_KeyZY_D_state, uint8_T *rty_KeyTZ_U_state,
|
||||
uint8_T *rty_KeyTZ_D_state, uint8_T *rty_KeyYT_U_state, uint8_T
|
||||
*rty_KeyYT_D_state, uint8_T *rty_KeyZY_HEAT_state, uint8_T
|
||||
*rty_KeyZY_FAN_state, uint8_T *rty_KeyZY_MSSG_state, uint8_T
|
||||
*rty_KeyMEMORY_SET_state, uint8_T *rty_KeyMEMORY_1_state, uint8_T
|
||||
*rty_KeyMEMORY_2_state, uint8_T *rty_KeyMEMORY_3_state, uint8_T
|
||||
*rty_KeyRESET_state, uint8_T *rty_KeyZY_FLAT_state);
|
||||
extern void RP_01_APP_KeyPro(uint8_T rtu_KeyHG_F, uint8_T rtu_KeyHG_R, uint8_T
|
||||
rtu_KeyKB_F, uint8_T rtu_KeyKB_R, uint8_T rtu_KeyTT_F, uint8_T rtu_KeyTT_R,
|
||||
uint8_T rtu_KeyZY_U, uint8_T rtu_KeyZY_D, uint8_T rtu_KeyTZ_U, uint8_T
|
||||
rtu_KeyTZ_D, uint8_T rtu_KeyYT_U, uint8_T rtu_KeyYT_D, uint8_T
|
||||
rtu_KeyZY_HEAT, uint8_T rtu_KeyZY_FAN, uint8_T rtu_KeyZY_MSSG, uint8_T
|
||||
rtu_KeyMEMORY_SET, uint8_T rtu_KeyMEMORY_1, uint8_T rtu_KeyMEMORY_2, uint8_T
|
||||
rtu_KeyMEMORY_3, uint8_T rtu_KeyRESET, uint8_T rtu_KeyZY_FLAT, uint8_T
|
||||
*rty_KeyHG_F_state, uint8_T *rty_KeyHG_R_state, uint8_T *rty_KeyKB_F_state,
|
||||
uint8_T *rty_KeyKB_R_state, uint8_T *rty_KeyTT_F_state, uint8_T
|
||||
*rty_KeyTT_R_state, uint8_T *rty_KeyZY_U_state, uint8_T *rty_KeyZY_D_state,
|
||||
uint8_T *rty_KeyTZ_U_state, uint8_T *rty_KeyTZ_D_state, uint8_T
|
||||
*rty_KeyYT_U_state, uint8_T *rty_KeyYT_D_state, uint8_T
|
||||
*rty_KeyZY_HEAT_state, uint8_T *rty_KeyZY_FAN_state, uint8_T
|
||||
*rty_KeyZY_MSSG_state, uint8_T *rty_KeyMEMORY_SET_state, uint8_T
|
||||
*rty_KeyMEMORY_1_state, uint8_T *rty_KeyMEMORY_2_state, uint8_T
|
||||
*rty_KeyMEMORY_3_state, uint8_T *rty_KeyRESET_state, uint8_T
|
||||
*rty_KeyZY_FLAT_state, DW_KeyPro_RP_01_APP_T *localDW);
|
||||
|
||||
#endif /* RTW_HEADER_KeyPro_h_ */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* File: MotorCtrl_Maintask.c
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#include "rtwtypes.h"
|
||||
#include "MotorCtrl_Maintask.h"
|
||||
|
||||
/*
|
||||
* System initialize for atomic system:
|
||||
* '<S69>/Chart'
|
||||
* '<S70>/Chart'
|
||||
* '<S71>/Chart'
|
||||
* '<S72>/Chart'
|
||||
* '<S73>/Chart'
|
||||
* '<S74>/Chart'
|
||||
*/
|
||||
void RP_01_APP_Chart_Init(uint8_T *rty_Out)
|
||||
{
|
||||
*rty_Out = 0U;
|
||||
}
|
||||
|
||||
/*
|
||||
* Output and update for atomic system:
|
||||
* '<S69>/Chart'
|
||||
* '<S70>/Chart'
|
||||
* '<S71>/Chart'
|
||||
* '<S72>/Chart'
|
||||
* '<S73>/Chart'
|
||||
* '<S74>/Chart'
|
||||
*/
|
||||
void RP_01_APP_Chart(uint8_T rtu_front, uint8_T rtu_rear, uint8_T *rty_Out)
|
||||
{
|
||||
/* Chart: '<S69>/Chart' */
|
||||
if ((rtu_front > 0U) && (rtu_rear == 0U)) {
|
||||
*rty_Out = 1U;
|
||||
} else if ((rtu_rear > 0U) && (rtu_front == 0U)) {
|
||||
*rty_Out = 2U;
|
||||
} else {
|
||||
*rty_Out = 0U;
|
||||
}
|
||||
|
||||
/* End of Chart: '<S69>/Chart' */
|
||||
}
|
||||
|
||||
/* System initialize for function-call system: '<Root>/MotorCtrl_Maintask' */
|
||||
void RP_01_A_MotorCtrl_Maintask_Init(uint8_T *rty_HG_state, uint8_T
|
||||
*rty_KB_state, uint8_T *rty_TT_state, uint8_T *rty_ZY_state, uint8_T
|
||||
*rty_TZ_state, uint8_T *rty_YT_state)
|
||||
{
|
||||
/* SystemInitialize for Chart: '<S69>/Chart' */
|
||||
RP_01_APP_Chart_Init(rty_HG_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S70>/Chart' */
|
||||
RP_01_APP_Chart_Init(rty_KB_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S71>/Chart' */
|
||||
RP_01_APP_Chart_Init(rty_TT_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S72>/Chart' */
|
||||
RP_01_APP_Chart_Init(rty_ZY_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S73>/Chart' */
|
||||
RP_01_APP_Chart_Init(rty_TZ_state);
|
||||
|
||||
/* SystemInitialize for Chart: '<S74>/Chart' */
|
||||
RP_01_APP_Chart_Init(rty_YT_state);
|
||||
}
|
||||
|
||||
/* Output and update for function-call system: '<Root>/MotorCtrl_Maintask' */
|
||||
void RP_01_APP_MotorCtrl_Maintask(uint8_T rtu_Key_HG_F, uint8_T rtu_Key_HG_R,
|
||||
uint8_T rtu_Key_KB_F, uint8_T rtu_Key_KB_R, uint8_T rtu_Key_TT_F, uint8_T
|
||||
rtu_Key_TT_R, uint8_T rtu_Key_ZY_U, uint8_T rtu_Key_ZY_D, uint8_T
|
||||
rtu_Key_TZ_U, uint8_T rtu_Key_TZ_D, uint8_T rtu_Key_YT_U, uint8_T
|
||||
rtu_Key_YT_D, uint8_T *rty_HG_state, uint8_T *rty_KB_state, uint8_T
|
||||
*rty_TT_state, uint8_T *rty_ZY_state, uint8_T *rty_TZ_state, uint8_T
|
||||
*rty_YT_state)
|
||||
{
|
||||
/* Chart: '<S69>/Chart' */
|
||||
RP_01_APP_Chart(rtu_Key_HG_F, rtu_Key_HG_R, rty_HG_state);
|
||||
|
||||
/* Chart: '<S70>/Chart' */
|
||||
RP_01_APP_Chart(rtu_Key_KB_F, rtu_Key_KB_R, rty_KB_state);
|
||||
|
||||
/* Chart: '<S71>/Chart' */
|
||||
RP_01_APP_Chart(rtu_Key_TT_F, rtu_Key_TT_R, rty_TT_state);
|
||||
|
||||
/* Chart: '<S72>/Chart' */
|
||||
RP_01_APP_Chart(rtu_Key_ZY_U, rtu_Key_ZY_D, rty_ZY_state);
|
||||
|
||||
/* Chart: '<S73>/Chart' */
|
||||
RP_01_APP_Chart(rtu_Key_TZ_U, rtu_Key_TZ_D, rty_TZ_state);
|
||||
|
||||
/* Chart: '<S74>/Chart' */
|
||||
RP_01_APP_Chart(rtu_Key_YT_U, rtu_Key_YT_D, rty_YT_state);
|
||||
}
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* File: MotorCtrl_Maintask.h
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#ifndef RTW_HEADER_MotorCtrl_Maintask_h_
|
||||
#define RTW_HEADER_MotorCtrl_Maintask_h_
|
||||
#ifndef RP_01_APP_COMMON_INCLUDES_
|
||||
#define RP_01_APP_COMMON_INCLUDES_
|
||||
#include <math.h>
|
||||
#include "rtwtypes.h"
|
||||
#endif /* RP_01_APP_COMMON_INCLUDES_ */
|
||||
|
||||
extern void RP_01_APP_Chart_Init(uint8_T *rty_Out);
|
||||
extern void RP_01_APP_Chart(uint8_T rtu_front, uint8_T rtu_rear, uint8_T
|
||||
*rty_Out);
|
||||
extern void RP_01_A_MotorCtrl_Maintask_Init(uint8_T *rty_HG_state, uint8_T
|
||||
*rty_KB_state, uint8_T *rty_TT_state, uint8_T *rty_ZY_state, uint8_T
|
||||
*rty_TZ_state, uint8_T *rty_YT_state);
|
||||
extern void RP_01_APP_MotorCtrl_Maintask(uint8_T rtu_Key_HG_F, uint8_T
|
||||
rtu_Key_HG_R, uint8_T rtu_Key_KB_F, uint8_T rtu_Key_KB_R, uint8_T
|
||||
rtu_Key_TT_F, uint8_T rtu_Key_TT_R, uint8_T rtu_Key_ZY_U, uint8_T
|
||||
rtu_Key_ZY_D, uint8_T rtu_Key_TZ_U, uint8_T rtu_Key_TZ_D, uint8_T
|
||||
rtu_Key_YT_U, uint8_T rtu_Key_YT_D, uint8_T *rty_HG_state, uint8_T
|
||||
*rty_KB_state, uint8_T *rty_TT_state, uint8_T *rty_ZY_state, uint8_T
|
||||
*rty_TZ_state, uint8_T *rty_YT_state);
|
||||
|
||||
#endif /* RTW_HEADER_MotorCtrl_Maintask_h_ */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,410 +0,0 @@
|
||||
/*
|
||||
* File: MsgTx.c
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#include "rtwtypes.h"
|
||||
#include "MsgTx.h"
|
||||
|
||||
/* Output and update for function-call system: '<Root>/MsgTx' */
|
||||
void RP_01_APP_MsgTx(uint8_T rtu_hg_state, uint8_T rtu_kb_state, uint8_T
|
||||
rtu_tt_state, uint8_T rtu_tz_state, uint8_T rtu_yt_state,
|
||||
uint8_T rtu_zy_state, uint8_T rty_Out1[8],
|
||||
B_MsgTx_RP_01_APP_T *localB)
|
||||
{
|
||||
int32_T i;
|
||||
|
||||
/* S-Function (scanpack): '<S3>/CAN Pack' incorporates:
|
||||
* Constant: '<S3>/Constant'
|
||||
* Constant: '<S3>/Constant1'
|
||||
* Constant: '<S3>/Constant2'
|
||||
*/
|
||||
/* S-Function (scanpack): '<S3>/CAN Pack' */
|
||||
localB->CANPack.ID = 769U;
|
||||
localB->CANPack.Length = 8U;
|
||||
localB->CANPack.Extended = 0U;
|
||||
localB->CANPack.Remote = 0;
|
||||
localB->CANPack.Data[0] = 0;
|
||||
localB->CANPack.Data[1] = 0;
|
||||
localB->CANPack.Data[2] = 0;
|
||||
localB->CANPack.Data[3] = 0;
|
||||
localB->CANPack.Data[4] = 0;
|
||||
localB->CANPack.Data[5] = 0;
|
||||
localB->CANPack.Data[6] = 0;
|
||||
localB->CANPack.Data[7] = 0;
|
||||
|
||||
{
|
||||
/* --------------- START Packing signal 0 ------------------
|
||||
* startBit = 0
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint32_T packingValue = 0;
|
||||
|
||||
{
|
||||
uint32_T result = (uint32_T) (rtu_hg_state);
|
||||
|
||||
/* no scaling required */
|
||||
packingValue = result;
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (packingValue > (uint8_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else {
|
||||
packedValue = (uint8_T) (packingValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[0] = localB->CANPack.Data[0] |
|
||||
(uint8_T)((uint8_T)(packedValue & (uint8_T)0x3U));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Packing signal 1 ------------------
|
||||
* startBit = 2
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint32_T packingValue = 0;
|
||||
|
||||
{
|
||||
uint32_T result = (uint32_T) (rtu_kb_state);
|
||||
|
||||
/* no scaling required */
|
||||
packingValue = result;
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (packingValue > (uint8_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else {
|
||||
packedValue = (uint8_T) (packingValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[0] = localB->CANPack.Data[0] |
|
||||
(uint8_T)((uint8_T)((uint8_T)(packedValue & (uint8_T)
|
||||
0x3U) << 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Packing signal 2 ------------------
|
||||
* startBit = 4
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint32_T packingValue = 0;
|
||||
|
||||
{
|
||||
uint32_T result = (uint32_T) (rtu_tt_state);
|
||||
|
||||
/* no scaling required */
|
||||
packingValue = result;
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (packingValue > (uint8_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else {
|
||||
packedValue = (uint8_T) (packingValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[0] = localB->CANPack.Data[0] |
|
||||
(uint8_T)((uint8_T)((uint8_T)(packedValue & (uint8_T)
|
||||
0x3U) << 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Packing signal 3 ------------------
|
||||
* startBit = 6
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint32_T packingValue = 0;
|
||||
|
||||
{
|
||||
uint32_T result = (uint32_T) (rtu_tz_state);
|
||||
|
||||
/* no scaling required */
|
||||
packingValue = result;
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (packingValue > (uint8_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else {
|
||||
packedValue = (uint8_T) (packingValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[0] = localB->CANPack.Data[0] |
|
||||
(uint8_T)((uint8_T)((uint8_T)(packedValue & (uint8_T)
|
||||
0x3U) << 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Packing signal 4 ------------------
|
||||
* startBit = 8
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint32_T packingValue = 0;
|
||||
|
||||
{
|
||||
uint32_T result = (uint32_T) (rtu_yt_state);
|
||||
|
||||
/* no scaling required */
|
||||
packingValue = result;
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (packingValue > (uint8_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else {
|
||||
packedValue = (uint8_T) (packingValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[1] = localB->CANPack.Data[1] |
|
||||
(uint8_T)((uint8_T)(packedValue & (uint8_T)0x3U));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Packing signal 5 ------------------
|
||||
* startBit = 10
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint32_T packingValue = 0;
|
||||
|
||||
{
|
||||
uint32_T result = (uint32_T) (rtu_zy_state);
|
||||
|
||||
/* no scaling required */
|
||||
packingValue = result;
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (packingValue > (uint8_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else {
|
||||
packedValue = (uint8_T) (packingValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[1] = localB->CANPack.Data[1] |
|
||||
(uint8_T)((uint8_T)((uint8_T)(packedValue & (uint8_T)
|
||||
0x3U) << 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Packing signal 6 ------------------
|
||||
* startBit = 16
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
real_T outValue = 0;
|
||||
|
||||
{
|
||||
real_T result = 0.0;
|
||||
|
||||
/* no scaling required */
|
||||
/* round to closest integer value for integer CAN signal */
|
||||
outValue = round(result);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (outValue > (real_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else if (outValue < (real_T)(0)) {
|
||||
packedValue = (uint8_T) 0;
|
||||
} else {
|
||||
packedValue = (uint8_T) (outValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[2] = localB->CANPack.Data[2] |
|
||||
(uint8_T)((uint8_T)(packedValue & (uint8_T)0x3U));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Packing signal 7 ------------------
|
||||
* startBit = 18
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
real_T outValue = 0;
|
||||
|
||||
{
|
||||
real_T result = 0.0;
|
||||
|
||||
/* no scaling required */
|
||||
/* round to closest integer value for integer CAN signal */
|
||||
outValue = round(result);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (outValue > (real_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else if (outValue < (real_T)(0)) {
|
||||
packedValue = (uint8_T) 0;
|
||||
} else {
|
||||
packedValue = (uint8_T) (outValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[2] = localB->CANPack.Data[2] |
|
||||
(uint8_T)((uint8_T)((uint8_T)(packedValue & (uint8_T)
|
||||
0x3U) << 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Packing signal 8 ------------------
|
||||
* startBit = 20
|
||||
* length = 2
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* minimum = 0.0
|
||||
* maximum = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
real_T outValue = 0;
|
||||
|
||||
{
|
||||
real_T result = 0.0;
|
||||
|
||||
/* no scaling required */
|
||||
/* round to closest integer value for integer CAN signal */
|
||||
outValue = round(result);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T packedValue;
|
||||
if (outValue > (real_T)(3)) {
|
||||
packedValue = (uint8_T) 3;
|
||||
} else if (outValue < (real_T)(0)) {
|
||||
packedValue = (uint8_T) 0;
|
||||
} else {
|
||||
packedValue = (uint8_T) (outValue);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
localB->CANPack.Data[2] = localB->CANPack.Data[2] |
|
||||
(uint8_T)((uint8_T)((uint8_T)(packedValue & (uint8_T)
|
||||
0x3U) << 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* SignalConversion generated from: '<S3>/Out1' */
|
||||
for (i = 0; i < 8; i++) {
|
||||
rty_Out1[i] = localB->CANPack.Data[i];
|
||||
}
|
||||
|
||||
/* End of SignalConversion generated from: '<S3>/Out1' */
|
||||
}
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* File: MsgTx.h
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#ifndef RTW_HEADER_MsgTx_h_
|
||||
#define RTW_HEADER_MsgTx_h_
|
||||
#ifndef RP_01_APP_COMMON_INCLUDES_
|
||||
#define RP_01_APP_COMMON_INCLUDES_
|
||||
#include <math.h>
|
||||
#include "rtwtypes.h"
|
||||
#endif /* RP_01_APP_COMMON_INCLUDES_ */
|
||||
|
||||
#include "RP_01_APP_types.h"
|
||||
|
||||
/* Block signals for system '<Root>/MsgTx' */
|
||||
typedef struct {
|
||||
CAN_MESSAGE_BUS CANPack; /* '<S3>/CAN Pack' */
|
||||
} B_MsgTx_RP_01_APP_T;
|
||||
|
||||
/* Block states (default storage) for system '<Root>/MsgTx' */
|
||||
typedef struct {
|
||||
int_T CANPack_ModeSignalID; /* '<S3>/CAN Pack' */
|
||||
} DW_MsgTx_RP_01_APP_T;
|
||||
|
||||
extern void RP_01_APP_MsgTx(uint8_T rtu_hg_state, uint8_T rtu_kb_state, uint8_T
|
||||
rtu_tt_state, uint8_T rtu_tz_state, uint8_T rtu_yt_state, uint8_T
|
||||
rtu_zy_state, uint8_T rty_Out1[8], B_MsgTx_RP_01_APP_T *localB);
|
||||
|
||||
#endif /* RTW_HEADER_MsgTx_h_ */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,346 +0,0 @@
|
||||
/*
|
||||
* File: RP_01_APP.c
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#include "RP_01_APP.h"
|
||||
#include "rte.h"
|
||||
#include "KeyPro.h"
|
||||
#include "can_key_msg.h"
|
||||
#include "MsgTx.h"
|
||||
#include "MotorCtrl_Maintask.h"
|
||||
#include "rtwtypes.h"
|
||||
|
||||
/* Block signals (default storage) */
|
||||
B_RP_01_APP_T RP_01_APP_B;
|
||||
|
||||
/* Block states (default storage) */
|
||||
DW_RP_01_APP_T RP_01_APP_DW;
|
||||
|
||||
/* Real-time model */
|
||||
static RT_MODEL_RP_01_APP_T RP_01_APP_M_;
|
||||
RT_MODEL_RP_01_APP_T *const RP_01_APP_M = &RP_01_APP_M_;
|
||||
|
||||
/* Model step function */
|
||||
void RP_01_APP_step(void)
|
||||
{
|
||||
int32_T i;
|
||||
uint8_T CANMSG_0x301_DATA[8];
|
||||
uint8_T output_e1;
|
||||
uint8_T output_f;
|
||||
uint8_T output_g;
|
||||
uint8_T output_i5;
|
||||
uint8_T output_ie;
|
||||
uint8_T output_in;
|
||||
uint8_T output_j;
|
||||
uint8_T output_o;
|
||||
uint8_T output_p;
|
||||
|
||||
/* SignalConversion generated from: '<Root>/In1' incorporates:
|
||||
* Inport: '<Root>/In1'
|
||||
*/
|
||||
RP_01_APP_B.CANMSG_0x201 = rte_get_CANMSG_0x201();
|
||||
|
||||
/* S-Function (fcgen): '<Root>/Function-Call Generator' incorporates:
|
||||
* Chart: '<Root>/Task Scheduler'
|
||||
*/
|
||||
/* Chart: '<Root>/Task Scheduler' incorporates:
|
||||
* Outport: '<Root>/Out1'
|
||||
* Outport: '<Root>/Output'
|
||||
* Outport: '<Root>/Output1'
|
||||
* Outport: '<Root>/Output2'
|
||||
* Outport: '<Root>/Output3'
|
||||
* Outport: '<Root>/Output4'
|
||||
* Outport: '<Root>/Output5'
|
||||
*/
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i1 < 2U) {
|
||||
RP_01_APP_DW.temporalCounter_i1 = (uint8_T)((uint32_T)
|
||||
RP_01_APP_DW.temporalCounter_i1 + 1U);
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i2 < 5U) {
|
||||
RP_01_APP_DW.temporalCounter_i2 = (uint8_T)((uint32_T)
|
||||
RP_01_APP_DW.temporalCounter_i2 + 1U);
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i3 < 10U) {
|
||||
RP_01_APP_DW.temporalCounter_i3 = (uint8_T)((uint32_T)
|
||||
RP_01_APP_DW.temporalCounter_i3 + 1U);
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i4 < 100U) {
|
||||
RP_01_APP_DW.temporalCounter_i4 = (uint8_T)((uint32_T)
|
||||
RP_01_APP_DW.temporalCounter_i4 + 1U);
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i5 < 1000U) {
|
||||
RP_01_APP_DW.temporalCounter_i5 = (uint16_T)((uint32_T)
|
||||
RP_01_APP_DW.temporalCounter_i5 + 1U);
|
||||
}
|
||||
|
||||
if (RP_01_APP_DW.temporalCounter_i2 == 5U) {
|
||||
/* Outputs for Function Call SubSystem: '<Root>/KeyPro' */
|
||||
RP_01_APP_KeyPro(RP_01_APP_B.can_key_msg.CANUnpack_o1,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o2,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o3,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o4,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o10,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o11,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o21,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o16,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o13,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o12,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o15,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o14,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o19,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o17,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o20,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o8,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o5,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o6,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o7,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o9,
|
||||
RP_01_APP_B.can_key_msg.CANUnpack_o18,
|
||||
&RP_01_APP_B.output_hw, &RP_01_APP_B.output_jf,
|
||||
&RP_01_APP_B.output_hj, &RP_01_APP_B.output_ed,
|
||||
&RP_01_APP_B.output_i, &RP_01_APP_B.output_e,
|
||||
&RP_01_APP_B.output_hc, &RP_01_APP_B.output_h,
|
||||
&RP_01_APP_B.output_c, &RP_01_APP_B.output,
|
||||
&RP_01_APP_B.output_a, &RP_01_APP_B.output_pp,
|
||||
&output_e1, &output_p, &output_ie, &output_f,
|
||||
&output_i5, &output_o, &output_g, &output_j, &output_in,
|
||||
&RP_01_APP_DW.KeyPro);
|
||||
|
||||
/* End of Outputs for SubSystem: '<Root>/KeyPro' */
|
||||
|
||||
/* Outputs for Function Call SubSystem: '<Root>/MotorCtrl_Maintask' */
|
||||
/* Outport: '<Root>/Output' */
|
||||
output_e1 = rte_get_Motor_HG_State();
|
||||
|
||||
/* Outport: '<Root>/Output1' */
|
||||
output_p = rte_get_Motor_KB_State();
|
||||
|
||||
/* Outport: '<Root>/Output2' */
|
||||
output_ie = rte_get_Motor_TT_State();
|
||||
|
||||
/* Outport: '<Root>/Output3' */
|
||||
output_f = rte_get_Motor_ZY_State();
|
||||
|
||||
/* Outport: '<Root>/Output4' */
|
||||
output_i5 = rte_get_Motor_TZ_State();
|
||||
|
||||
/* Outport: '<Root>/Output5' */
|
||||
output_o = rte_get_Motor_YT_State();
|
||||
RP_01_APP_MotorCtrl_Maintask(RP_01_APP_B.output_hw,
|
||||
RP_01_APP_B.output_jf, RP_01_APP_B.output_hj, RP_01_APP_B.output_ed,
|
||||
RP_01_APP_B.output_i, RP_01_APP_B.output_e, RP_01_APP_B.output_hc,
|
||||
RP_01_APP_B.output_h, RP_01_APP_B.output_c, RP_01_APP_B.output,
|
||||
RP_01_APP_B.output_a, RP_01_APP_B.output_pp, &output_e1, &output_p,
|
||||
&output_ie, &output_f, &output_i5, &output_o);
|
||||
|
||||
/* Outport: '<Root>/Output5' incorporates:
|
||||
* Outport: '<Root>/Output'
|
||||
* Outport: '<Root>/Output1'
|
||||
* Outport: '<Root>/Output2'
|
||||
* Outport: '<Root>/Output3'
|
||||
* Outport: '<Root>/Output4'
|
||||
*/
|
||||
rte_set_Motor_YT_State(output_o);
|
||||
|
||||
/* Outport: '<Root>/Output4' */
|
||||
rte_set_Motor_TZ_State(output_i5);
|
||||
|
||||
/* Outport: '<Root>/Output3' */
|
||||
rte_set_Motor_ZY_State(output_f);
|
||||
|
||||
/* Outport: '<Root>/Output2' */
|
||||
rte_set_Motor_TT_State(output_ie);
|
||||
|
||||
/* Outport: '<Root>/Output1' */
|
||||
rte_set_Motor_KB_State(output_p);
|
||||
|
||||
/* Outport: '<Root>/Output' */
|
||||
rte_set_Motor_HG_State(output_e1);
|
||||
|
||||
/* End of Outputs for SubSystem: '<Root>/MotorCtrl_Maintask' */
|
||||
}
|
||||
|
||||
if (RP_01_APP_DW.temporalCounter_i3 == 10U) {
|
||||
/* Outputs for Function Call SubSystem: '<Root>/can_key_msg' */
|
||||
RP_01_APP_can_key_msg(&RP_01_APP_B.CANMSG_0x201,
|
||||
&RP_01_APP_B.can_key_msg);
|
||||
|
||||
/* End of Outputs for SubSystem: '<Root>/can_key_msg' */
|
||||
|
||||
/* Outputs for Function Call SubSystem: '<Root>/MsgTx' */
|
||||
/* Outport: '<Root>/Out1' */
|
||||
for (i = 0; i < 8; i++) {
|
||||
CANMSG_0x301_DATA[i] = rte_get_CANMSG_0x301_DATA(i);
|
||||
}
|
||||
|
||||
RP_01_APP_MsgTx(rte_get_Motor_HG_State(), rte_get_Motor_KB_State(),
|
||||
rte_get_Motor_TT_State(), rte_get_Motor_TZ_State(),
|
||||
rte_get_Motor_YT_State(), rte_get_Motor_ZY_State(),
|
||||
CANMSG_0x301_DATA, &RP_01_APP_B.MsgTx);
|
||||
|
||||
/* Outport: '<Root>/Out1' incorporates:
|
||||
* Outport: '<Root>/Output'
|
||||
* Outport: '<Root>/Output1'
|
||||
* Outport: '<Root>/Output2'
|
||||
* Outport: '<Root>/Output3'
|
||||
* Outport: '<Root>/Output4'
|
||||
* Outport: '<Root>/Output5'
|
||||
*/
|
||||
for (i = 0; i < 8; i++) {
|
||||
rte_set_CANMSG_0x301_DATA(i, CANMSG_0x301_DATA[i]);
|
||||
}
|
||||
|
||||
/* End of Outputs for SubSystem: '<Root>/MsgTx' */
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i1 == 2U) {
|
||||
RP_01_APP_DW.temporalCounter_i1 = 0U;
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i2 == 5U) {
|
||||
RP_01_APP_DW.temporalCounter_i2 = 0U;
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i3 == 10U) {
|
||||
RP_01_APP_DW.temporalCounter_i3 = 0U;
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i4 == 100U) {
|
||||
RP_01_APP_DW.temporalCounter_i4 = 0U;
|
||||
}
|
||||
|
||||
if ((uint32_T)RP_01_APP_DW.temporalCounter_i5 == 1000U) {
|
||||
RP_01_APP_DW.temporalCounter_i5 = 0U;
|
||||
}
|
||||
|
||||
/* End of Chart: '<Root>/Task Scheduler' */
|
||||
/* End of Outputs for S-Function (fcgen): '<Root>/Function-Call Generator' */
|
||||
}
|
||||
|
||||
/* Model initialize function */
|
||||
void RP_01_APP_initialize(void)
|
||||
{
|
||||
{
|
||||
uint8_T output_e1;
|
||||
uint8_T output_f;
|
||||
uint8_T output_g;
|
||||
uint8_T output_i5;
|
||||
uint8_T output_ie;
|
||||
uint8_T output_in;
|
||||
uint8_T output_j;
|
||||
uint8_T output_o;
|
||||
uint8_T output_p;
|
||||
|
||||
/* SystemInitialize for S-Function (fcgen): '<Root>/Function-Call Generator' incorporates:
|
||||
* Chart: '<Root>/Task Scheduler'
|
||||
*/
|
||||
/* SystemInitialize for Chart: '<Root>/Task Scheduler' incorporates:
|
||||
* SubSystem: '<Root>/can_key_msg'
|
||||
*/
|
||||
RP_01_APP_can_key_msg_Init();
|
||||
|
||||
/* SystemInitialize for Chart: '<Root>/Task Scheduler' incorporates:
|
||||
* SubSystem: '<Root>/MsgTx'
|
||||
*/
|
||||
/* SystemInitialize for Outport: '<Root>/Output' incorporates:
|
||||
* Outport: '<Root>/Output1'
|
||||
* Outport: '<Root>/Output2'
|
||||
* Outport: '<Root>/Output3'
|
||||
* Outport: '<Root>/Output4'
|
||||
* Outport: '<Root>/Output5'
|
||||
*/
|
||||
|
||||
/* SystemInitialize for Chart: '<Root>/Task Scheduler' incorporates:
|
||||
* SubSystem: '<Root>/KeyPro'
|
||||
*/
|
||||
RP_01_APP_KeyPro_Init(&RP_01_APP_B.output_hw, &RP_01_APP_B.output_jf,
|
||||
&RP_01_APP_B.output_hj, &RP_01_APP_B.output_ed,
|
||||
&RP_01_APP_B.output_i, &RP_01_APP_B.output_e,
|
||||
&RP_01_APP_B.output_hc, &RP_01_APP_B.output_h,
|
||||
&RP_01_APP_B.output_c, &RP_01_APP_B.output,
|
||||
&RP_01_APP_B.output_a, &RP_01_APP_B.output_pp,
|
||||
&output_e1, &output_p, &output_ie, &output_f,
|
||||
&output_i5, &output_o, &output_g, &output_j,
|
||||
&output_in);
|
||||
|
||||
/* SystemInitialize for Chart: '<Root>/Task Scheduler' incorporates:
|
||||
* SubSystem: '<Root>/MotorCtrl_Maintask'
|
||||
*/
|
||||
/* SystemInitialize for Outport: '<Root>/Output' */
|
||||
output_e1 = rte_get_Motor_HG_State();
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output1' */
|
||||
output_p = rte_get_Motor_KB_State();
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output2' */
|
||||
output_ie = rte_get_Motor_TT_State();
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output3' */
|
||||
output_f = rte_get_Motor_ZY_State();
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output4' */
|
||||
output_i5 = rte_get_Motor_TZ_State();
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output5' */
|
||||
output_o = rte_get_Motor_YT_State();
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output' incorporates:
|
||||
* Outport: '<Root>/Output1'
|
||||
* Outport: '<Root>/Output2'
|
||||
* Outport: '<Root>/Output3'
|
||||
* Outport: '<Root>/Output4'
|
||||
* Outport: '<Root>/Output5'
|
||||
*/
|
||||
RP_01_A_MotorCtrl_Maintask_Init(&output_e1, &output_p, &output_ie,
|
||||
&output_f, &output_i5, &output_o);
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output5' */
|
||||
rte_set_Motor_YT_State(output_o);
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output4' */
|
||||
rte_set_Motor_TZ_State(output_i5);
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output3' */
|
||||
rte_set_Motor_ZY_State(output_f);
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output2' */
|
||||
rte_set_Motor_TT_State(output_ie);
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output1' */
|
||||
rte_set_Motor_KB_State(output_p);
|
||||
|
||||
/* SystemInitialize for Outport: '<Root>/Output' */
|
||||
rte_set_Motor_HG_State(output_e1);
|
||||
|
||||
/* End of SystemInitialize for S-Function (fcgen): '<Root>/Function-Call Generator' */
|
||||
}
|
||||
}
|
||||
|
||||
/* Model terminate function */
|
||||
void RP_01_APP_terminate(void)
|
||||
{
|
||||
/* (no terminate code required) */
|
||||
}
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,195 +0,0 @@
|
||||
/*
|
||||
* File: RP_01_APP.h
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#ifndef RTW_HEADER_RP_01_APP_h_
|
||||
#define RTW_HEADER_RP_01_APP_h_
|
||||
#ifndef RP_01_APP_COMMON_INCLUDES_
|
||||
#define RP_01_APP_COMMON_INCLUDES_
|
||||
#include <math.h>
|
||||
#include "rtwtypes.h"
|
||||
#endif /* RP_01_APP_COMMON_INCLUDES_ */
|
||||
|
||||
#include "RP_01_APP_types.h"
|
||||
#include "can_message.h"
|
||||
#include "MsgTx.h"
|
||||
#include "can_key_msg.h"
|
||||
#include "KeyPro.h"
|
||||
|
||||
/* Macros for accessing real-time model data structure */
|
||||
#ifndef rtmGetErrorStatus
|
||||
#define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
|
||||
#endif
|
||||
|
||||
#ifndef rtmSetErrorStatus
|
||||
#define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
|
||||
#endif
|
||||
|
||||
/* Block signals (default storage) */
|
||||
typedef struct {
|
||||
CAN_DATATYPE CANMSG_0x201; /* '<Root>/In1' */
|
||||
uint8_T output; /* '<S26>/Value_Debounce_Chart' */
|
||||
uint8_T output_c; /* '<S25>/Value_Debounce_Chart' */
|
||||
uint8_T output_h; /* '<S24>/Value_Debounce_Chart' */
|
||||
uint8_T output_hc; /* '<S23>/Value_Debounce_Chart' */
|
||||
uint8_T output_e; /* '<S22>/Value_Debounce_Chart' */
|
||||
uint8_T output_i; /* '<S21>/Value_Debounce_Chart' */
|
||||
uint8_T output_ed; /* '<S20>/Value_Debounce_Chart' */
|
||||
uint8_T output_hj; /* '<S16>/Value_Debounce_Chart' */
|
||||
uint8_T output_pp; /* '<S9>/Value_Debounce_Chart' */
|
||||
uint8_T output_a; /* '<S8>/Value_Debounce_Chart' */
|
||||
uint8_T output_jf; /* '<S7>/Value_Debounce_Chart' */
|
||||
uint8_T output_hw; /* '<S6>/Value_Debounce_Chart' */
|
||||
B_MsgTx_RP_01_APP_T MsgTx; /* '<Root>/MsgTx' */
|
||||
B_can_key_msg_RP_01_APP_T can_key_msg;/* '<Root>/can_key_msg' */
|
||||
} B_RP_01_APP_T;
|
||||
|
||||
/* Block states (default storage) for system '<Root>' */
|
||||
typedef struct {
|
||||
uint16_T temporalCounter_i5; /* '<Root>/Task Scheduler' */
|
||||
uint8_T temporalCounter_i1; /* '<Root>/Task Scheduler' */
|
||||
uint8_T temporalCounter_i2; /* '<Root>/Task Scheduler' */
|
||||
uint8_T temporalCounter_i3; /* '<Root>/Task Scheduler' */
|
||||
uint8_T temporalCounter_i4; /* '<Root>/Task Scheduler' */
|
||||
DW_KeyPro_RP_01_APP_T KeyPro; /* '<Root>/KeyPro' */
|
||||
DW_MsgTx_RP_01_APP_T MsgTx; /* '<Root>/MsgTx' */
|
||||
DW_can_key_msg_RP_01_APP_T can_key_msg;/* '<Root>/can_key_msg' */
|
||||
} DW_RP_01_APP_T;
|
||||
|
||||
/* Real-time Model Data Structure */
|
||||
struct tag_RTM_RP_01_APP_T {
|
||||
const char_T * volatile errorStatus;
|
||||
};
|
||||
|
||||
extern CAN_DATATYPE CAN_DATATYPE_GROUND;
|
||||
|
||||
/* Block signals (default storage) */
|
||||
extern B_RP_01_APP_T RP_01_APP_B;
|
||||
|
||||
/* Block states (default storage) */
|
||||
extern DW_RP_01_APP_T RP_01_APP_DW;
|
||||
|
||||
/* Model entry point functions */
|
||||
extern void RP_01_APP_initialize(void);
|
||||
extern void RP_01_APP_step(void);
|
||||
extern void RP_01_APP_terminate(void);
|
||||
|
||||
/* Real-time Model object */
|
||||
extern RT_MODEL_RP_01_APP_T *const RP_01_APP_M;
|
||||
|
||||
/*-
|
||||
* The generated code includes comments that allow you to trace directly
|
||||
* back to the appropriate location in the model. The basic format
|
||||
* is <system>/block_name, where system is the system number (uniquely
|
||||
* assigned by Simulink) and block_name is the name of the block.
|
||||
*
|
||||
* Use the MATLAB hilite_system command to trace the generated code back
|
||||
* to the model. For example,
|
||||
*
|
||||
* hilite_system('<S3>') - opens system 3
|
||||
* hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
|
||||
*
|
||||
* Here is the system hierarchy for this model
|
||||
*
|
||||
* '<Root>' : 'RP_01_APP'
|
||||
* '<S1>' : 'RP_01_APP/KeyPro'
|
||||
* '<S2>' : 'RP_01_APP/MotorCtrl_Maintask'
|
||||
* '<S3>' : 'RP_01_APP/MsgTx'
|
||||
* '<S4>' : 'RP_01_APP/Task Scheduler'
|
||||
* '<S5>' : 'RP_01_APP/can_key_msg'
|
||||
* '<S6>' : 'RP_01_APP/KeyPro/KeyDebounce'
|
||||
* '<S7>' : 'RP_01_APP/KeyPro/KeyDebounce1'
|
||||
* '<S8>' : 'RP_01_APP/KeyPro/KeyDebounce10'
|
||||
* '<S9>' : 'RP_01_APP/KeyPro/KeyDebounce11'
|
||||
* '<S10>' : 'RP_01_APP/KeyPro/KeyDebounce12'
|
||||
* '<S11>' : 'RP_01_APP/KeyPro/KeyDebounce13'
|
||||
* '<S12>' : 'RP_01_APP/KeyPro/KeyDebounce14'
|
||||
* '<S13>' : 'RP_01_APP/KeyPro/KeyDebounce15'
|
||||
* '<S14>' : 'RP_01_APP/KeyPro/KeyDebounce16'
|
||||
* '<S15>' : 'RP_01_APP/KeyPro/KeyDebounce17'
|
||||
* '<S16>' : 'RP_01_APP/KeyPro/KeyDebounce2'
|
||||
* '<S17>' : 'RP_01_APP/KeyPro/KeyDebounce21'
|
||||
* '<S18>' : 'RP_01_APP/KeyPro/KeyDebounce22'
|
||||
* '<S19>' : 'RP_01_APP/KeyPro/KeyDebounce23'
|
||||
* '<S20>' : 'RP_01_APP/KeyPro/KeyDebounce3'
|
||||
* '<S21>' : 'RP_01_APP/KeyPro/KeyDebounce4'
|
||||
* '<S22>' : 'RP_01_APP/KeyPro/KeyDebounce5'
|
||||
* '<S23>' : 'RP_01_APP/KeyPro/KeyDebounce6'
|
||||
* '<S24>' : 'RP_01_APP/KeyPro/KeyDebounce7'
|
||||
* '<S25>' : 'RP_01_APP/KeyPro/KeyDebounce8'
|
||||
* '<S26>' : 'RP_01_APP/KeyPro/KeyDebounce9'
|
||||
* '<S27>' : 'RP_01_APP/KeyPro/KeyDebounce/Detect Change2'
|
||||
* '<S28>' : 'RP_01_APP/KeyPro/KeyDebounce/Value_Debounce_Chart'
|
||||
* '<S29>' : 'RP_01_APP/KeyPro/KeyDebounce1/Detect Change2'
|
||||
* '<S30>' : 'RP_01_APP/KeyPro/KeyDebounce1/Value_Debounce_Chart'
|
||||
* '<S31>' : 'RP_01_APP/KeyPro/KeyDebounce10/Detect Change2'
|
||||
* '<S32>' : 'RP_01_APP/KeyPro/KeyDebounce10/Value_Debounce_Chart'
|
||||
* '<S33>' : 'RP_01_APP/KeyPro/KeyDebounce11/Detect Change2'
|
||||
* '<S34>' : 'RP_01_APP/KeyPro/KeyDebounce11/Value_Debounce_Chart'
|
||||
* '<S35>' : 'RP_01_APP/KeyPro/KeyDebounce12/Detect Change2'
|
||||
* '<S36>' : 'RP_01_APP/KeyPro/KeyDebounce12/Value_Debounce_Chart'
|
||||
* '<S37>' : 'RP_01_APP/KeyPro/KeyDebounce13/Detect Change2'
|
||||
* '<S38>' : 'RP_01_APP/KeyPro/KeyDebounce13/Value_Debounce_Chart'
|
||||
* '<S39>' : 'RP_01_APP/KeyPro/KeyDebounce14/Detect Change2'
|
||||
* '<S40>' : 'RP_01_APP/KeyPro/KeyDebounce14/Value_Debounce_Chart'
|
||||
* '<S41>' : 'RP_01_APP/KeyPro/KeyDebounce15/Detect Change2'
|
||||
* '<S42>' : 'RP_01_APP/KeyPro/KeyDebounce15/Value_Debounce_Chart'
|
||||
* '<S43>' : 'RP_01_APP/KeyPro/KeyDebounce16/Detect Change2'
|
||||
* '<S44>' : 'RP_01_APP/KeyPro/KeyDebounce16/Value_Debounce_Chart'
|
||||
* '<S45>' : 'RP_01_APP/KeyPro/KeyDebounce17/Detect Change2'
|
||||
* '<S46>' : 'RP_01_APP/KeyPro/KeyDebounce17/Value_Debounce_Chart'
|
||||
* '<S47>' : 'RP_01_APP/KeyPro/KeyDebounce2/Detect Change2'
|
||||
* '<S48>' : 'RP_01_APP/KeyPro/KeyDebounce2/Value_Debounce_Chart'
|
||||
* '<S49>' : 'RP_01_APP/KeyPro/KeyDebounce21/Detect Change2'
|
||||
* '<S50>' : 'RP_01_APP/KeyPro/KeyDebounce21/Value_Debounce_Chart'
|
||||
* '<S51>' : 'RP_01_APP/KeyPro/KeyDebounce22/Detect Change2'
|
||||
* '<S52>' : 'RP_01_APP/KeyPro/KeyDebounce22/Value_Debounce_Chart'
|
||||
* '<S53>' : 'RP_01_APP/KeyPro/KeyDebounce23/Detect Change2'
|
||||
* '<S54>' : 'RP_01_APP/KeyPro/KeyDebounce23/Value_Debounce_Chart'
|
||||
* '<S55>' : 'RP_01_APP/KeyPro/KeyDebounce3/Detect Change2'
|
||||
* '<S56>' : 'RP_01_APP/KeyPro/KeyDebounce3/Value_Debounce_Chart'
|
||||
* '<S57>' : 'RP_01_APP/KeyPro/KeyDebounce4/Detect Change2'
|
||||
* '<S58>' : 'RP_01_APP/KeyPro/KeyDebounce4/Value_Debounce_Chart'
|
||||
* '<S59>' : 'RP_01_APP/KeyPro/KeyDebounce5/Detect Change2'
|
||||
* '<S60>' : 'RP_01_APP/KeyPro/KeyDebounce5/Value_Debounce_Chart'
|
||||
* '<S61>' : 'RP_01_APP/KeyPro/KeyDebounce6/Detect Change2'
|
||||
* '<S62>' : 'RP_01_APP/KeyPro/KeyDebounce6/Value_Debounce_Chart'
|
||||
* '<S63>' : 'RP_01_APP/KeyPro/KeyDebounce7/Detect Change2'
|
||||
* '<S64>' : 'RP_01_APP/KeyPro/KeyDebounce7/Value_Debounce_Chart'
|
||||
* '<S65>' : 'RP_01_APP/KeyPro/KeyDebounce8/Detect Change2'
|
||||
* '<S66>' : 'RP_01_APP/KeyPro/KeyDebounce8/Value_Debounce_Chart'
|
||||
* '<S67>' : 'RP_01_APP/KeyPro/KeyDebounce9/Detect Change2'
|
||||
* '<S68>' : 'RP_01_APP/KeyPro/KeyDebounce9/Value_Debounce_Chart'
|
||||
* '<S69>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual'
|
||||
* '<S70>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual1'
|
||||
* '<S71>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual2'
|
||||
* '<S72>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual3'
|
||||
* '<S73>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual4'
|
||||
* '<S74>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual5'
|
||||
* '<S75>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual/Chart'
|
||||
* '<S76>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual1/Chart'
|
||||
* '<S77>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual2/Chart'
|
||||
* '<S78>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual3/Chart'
|
||||
* '<S79>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual4/Chart'
|
||||
* '<S80>' : 'RP_01_APP/MotorCtrl_Maintask/MotorManual5/Chart'
|
||||
*/
|
||||
#endif /* RTW_HEADER_RP_01_APP_h_ */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* File: RP_01_APP_private.h
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#ifndef RTW_HEADER_RP_01_APP_private_h_
|
||||
#define RTW_HEADER_RP_01_APP_private_h_
|
||||
#include "rtwtypes.h"
|
||||
#include "RP_01_APP_types.h"
|
||||
|
||||
/* Includes for objects with custom storage classes */
|
||||
#include "rte.h"
|
||||
#endif /* RTW_HEADER_RP_01_APP_private_h_ */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* File: RP_01_APP_types.h
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#ifndef RTW_HEADER_RP_01_APP_types_h_
|
||||
#define RTW_HEADER_RP_01_APP_types_h_
|
||||
#include "rtwtypes.h"
|
||||
#include "can_message.h"
|
||||
#ifndef DEFINED_TYPEDEF_FOR_CAN_MESSAGE_BUS_
|
||||
#define DEFINED_TYPEDEF_FOR_CAN_MESSAGE_BUS_
|
||||
|
||||
typedef struct {
|
||||
uint8_T Extended;
|
||||
uint8_T Length;
|
||||
uint8_T Remote;
|
||||
uint8_T Error;
|
||||
uint32_T ID;
|
||||
real_T Timestamp;
|
||||
uint8_T Data[8];
|
||||
} CAN_MESSAGE_BUS;
|
||||
|
||||
#endif
|
||||
|
||||
/* Forward declaration for rtModel */
|
||||
typedef struct tag_RTM_RP_01_APP_T RT_MODEL_RP_01_APP_T;
|
||||
|
||||
#endif /* RTW_HEADER_RP_01_APP_types_h_ */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,4 +0,0 @@
|
||||
#include "can_message.h"
|
||||
|
||||
const CAN_DATATYPE CAN_DATATYPE_GROUND = { 0, 0, 0, 0, 0, 0.0, { 0, 0, 0, 0, 0,
|
||||
0, 0, 0 } };
|
@ -1,778 +0,0 @@
|
||||
/*
|
||||
* File: can_key_msg.c
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#include "can_message.h"
|
||||
#include "can_key_msg.h"
|
||||
|
||||
/* System initialize for function-call system: '<Root>/can_key_msg' */
|
||||
void RP_01_APP_can_key_msg_Init(void)
|
||||
{
|
||||
/* Start for S-Function (scanunpack): '<S5>/CAN Unpack' */
|
||||
|
||||
/*-----------S-Function Block: <S5>/CAN Unpack -----------------*/
|
||||
}
|
||||
|
||||
/* Output and update for function-call system: '<Root>/can_key_msg' */
|
||||
void RP_01_APP_can_key_msg(const CAN_DATATYPE *rtu_In1,
|
||||
B_can_key_msg_RP_01_APP_T *localB)
|
||||
{
|
||||
/* S-Function (scanunpack): '<S5>/CAN Unpack' */
|
||||
{
|
||||
/* S-Function (scanunpack): '<S5>/CAN Unpack' */
|
||||
if ((8 == (*rtu_In1).Length) && ((*rtu_In1).ID != INVALID_CAN_ID) ) {
|
||||
if ((513 == (*rtu_In1).ID) && (0U == (*rtu_In1).Extended) ) {
|
||||
{
|
||||
/* --------------- START Unpacking signal 0 ------------------
|
||||
* startBit = 7
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[0]) &
|
||||
(uint8_T)(0x80U)) >> 7);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o1 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 1 ------------------
|
||||
* startBit = 6
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[0]) &
|
||||
(uint8_T)(0x40U)) >> 6);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o2 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 2 ------------------
|
||||
* startBit = 5
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[0]) &
|
||||
(uint8_T)(0x20U)) >> 5);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o3 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 3 ------------------
|
||||
* startBit = 4
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[0]) &
|
||||
(uint8_T)(0x10U)) >> 4);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o4 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 4 ------------------
|
||||
* startBit = 26
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[3]) &
|
||||
(uint8_T)(0x4U)) >> 2);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o5 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 5 ------------------
|
||||
* startBit = 25
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[3]) &
|
||||
(uint8_T)(0x2U)) >> 1);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o6 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 6 ------------------
|
||||
* startBit = 24
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((*rtu_In1).Data[3]) & (uint8_T)(0x1U));
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o7 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 7 ------------------
|
||||
* startBit = 27
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[3]) &
|
||||
(uint8_T)(0x8U)) >> 3);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o8 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 8 ------------------
|
||||
* startBit = 33
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[4]) &
|
||||
(uint8_T)(0x2U)) >> 1);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o9 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 9 ------------------
|
||||
* startBit = 3
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[0]) &
|
||||
(uint8_T)(0x8U)) >> 3);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o10 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 10 ------------------
|
||||
* startBit = 2
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[0]) &
|
||||
(uint8_T)(0x4U)) >> 2);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o11 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 11 ------------------
|
||||
* startBit = 10
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[1]) &
|
||||
(uint8_T)(0x4U)) >> 2);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o12 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 12 ------------------
|
||||
* startBit = 11
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[1]) &
|
||||
(uint8_T)(0x8U)) >> 3);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o13 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 13 ------------------
|
||||
* startBit = 8
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((*rtu_In1).Data[1]) & (uint8_T)(0x1U));
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o14 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 14 ------------------
|
||||
* startBit = 9
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[1]) &
|
||||
(uint8_T)(0x2U)) >> 1);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o15 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 15 ------------------
|
||||
* startBit = 0
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((*rtu_In1).Data[0]) & (uint8_T)(0x1U));
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o16 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 16 ------------------
|
||||
* startBit = 16
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((*rtu_In1).Data[2]) & (uint8_T)(0x1U));
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o17 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 17 ------------------
|
||||
* startBit = 32
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((*rtu_In1).Data[4]) & (uint8_T)(0x1U));
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o18 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 18 ------------------
|
||||
* startBit = 17
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[2]) &
|
||||
(uint8_T)(0x2U)) >> 1);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o19 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 19 ------------------
|
||||
* startBit = 20
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[2]) &
|
||||
(uint8_T)(0x10U)) >> 4);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o20 = result;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------- START Unpacking signal 20 ------------------
|
||||
* startBit = 1
|
||||
* length = 1
|
||||
* desiredSignalByteLayout = LITTLEENDIAN
|
||||
* dataType = UNSIGNED
|
||||
* factor = 1.0
|
||||
* offset = 0.0
|
||||
* -----------------------------------------------------------------------*/
|
||||
{
|
||||
uint8_T outValue = 0;
|
||||
|
||||
{
|
||||
uint8_T unpackedValue = 0;
|
||||
|
||||
{
|
||||
uint8_T tempValue = (uint8_T) (0);
|
||||
|
||||
{
|
||||
tempValue = tempValue | (uint8_T)((uint8_T)
|
||||
((uint8_T)((*rtu_In1).Data[0]) &
|
||||
(uint8_T)(0x2U)) >> 1);
|
||||
}
|
||||
|
||||
unpackedValue = tempValue;
|
||||
}
|
||||
|
||||
outValue = (uint8_T) (unpackedValue);
|
||||
}
|
||||
|
||||
{
|
||||
uint8_T result = (uint8_T) outValue;
|
||||
localB->CANUnpack_o21 = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* File: can_key_msg.h
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#ifndef RTW_HEADER_can_key_msg_h_
|
||||
#define RTW_HEADER_can_key_msg_h_
|
||||
#ifndef RP_01_APP_COMMON_INCLUDES_
|
||||
#define RP_01_APP_COMMON_INCLUDES_
|
||||
#include <math.h>
|
||||
#include "rtwtypes.h"
|
||||
#endif /* RP_01_APP_COMMON_INCLUDES_ */
|
||||
|
||||
#include "can_message.h"
|
||||
|
||||
/* Block signals for system '<Root>/can_key_msg' */
|
||||
typedef struct {
|
||||
uint8_T CANUnpack_o1; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o2; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o3; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o4; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o5; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o6; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o7; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o8; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o9; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o10; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o11; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o12; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o13; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o14; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o15; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o16; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o17; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o18; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o19; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o20; /* '<S5>/CAN Unpack' */
|
||||
uint8_T CANUnpack_o21; /* '<S5>/CAN Unpack' */
|
||||
} B_can_key_msg_RP_01_APP_T;
|
||||
|
||||
/* Block states (default storage) for system '<Root>/can_key_msg' */
|
||||
typedef struct {
|
||||
int_T CANUnpack_ModeSignalID; /* '<S5>/CAN Unpack' */
|
||||
int_T CANUnpack_StatusPortID; /* '<S5>/CAN Unpack' */
|
||||
} DW_can_key_msg_RP_01_APP_T;
|
||||
|
||||
extern void RP_01_APP_can_key_msg_Init(void);
|
||||
extern void RP_01_APP_can_key_msg(const CAN_DATATYPE *rtu_In1,
|
||||
B_can_key_msg_RP_01_APP_T *localB);
|
||||
|
||||
#endif /* RTW_HEADER_can_key_msg_h_ */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,103 +0,0 @@
|
||||
/*
|
||||
* File: ert_main.c
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.26
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Nov 11 11:21:18 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
* Code generation objectives:
|
||||
* 1. Execution efficiency
|
||||
* 2. MISRA C:2012 guidelines
|
||||
* Validation result: Not run
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h> /* This example main program uses printf/fflush */
|
||||
#include "RP_01_APP.h" /* Model header file */
|
||||
|
||||
/*
|
||||
* Associating rt_OneStep with a real-time clock or interrupt service routine
|
||||
* is what makes the generated code "real-time". The function rt_OneStep is
|
||||
* always associated with the base rate of the model. Subrates are managed
|
||||
* by the base rate from inside the generated code. Enabling/disabling
|
||||
* interrupts and floating point context switches are target specific. This
|
||||
* example code indicates where these should take place relative to executing
|
||||
* the generated code step function. Overrun behavior should be tailored to
|
||||
* your application needs. This example simply sets an error status in the
|
||||
* real-time model and returns from rt_OneStep.
|
||||
*/
|
||||
void rt_OneStep(void);
|
||||
void rt_OneStep(void)
|
||||
{
|
||||
static boolean_T OverrunFlag = false;
|
||||
|
||||
/* Disable interrupts here */
|
||||
|
||||
/* Check for overrun */
|
||||
if (OverrunFlag) {
|
||||
rtmSetErrorStatus(RP_01_APP_M, "Overrun");
|
||||
return;
|
||||
}
|
||||
|
||||
OverrunFlag = true;
|
||||
|
||||
/* Save FPU context here (if necessary) */
|
||||
/* Re-enable timer or interrupt here */
|
||||
/* Set model inputs here */
|
||||
|
||||
/* Step the model */
|
||||
RP_01_APP_step();
|
||||
|
||||
/* Get model outputs here */
|
||||
|
||||
/* Indicate task complete */
|
||||
OverrunFlag = false;
|
||||
|
||||
/* Disable interrupts here */
|
||||
/* Restore FPU context here (if necessary) */
|
||||
/* Enable interrupts here */
|
||||
}
|
||||
|
||||
/*
|
||||
* The example main function illustrates what is required by your
|
||||
* application code to initialize, execute, and terminate the generated code.
|
||||
* Attaching rt_OneStep to a real-time clock is target specific. This example
|
||||
* illustrates how you do this relative to initializing the model.
|
||||
*/
|
||||
int_T main(int_T argc, const char *argv[])
|
||||
{
|
||||
/* Unused arguments */
|
||||
(void)(argc);
|
||||
(void)(argv);
|
||||
|
||||
/* Initialize model */
|
||||
RP_01_APP_initialize();
|
||||
|
||||
/* Attach rt_OneStep to a timer or interrupt service routine with
|
||||
* period 0.001 seconds (base rate of the model) here.
|
||||
* The call syntax for rt_OneStep is
|
||||
*
|
||||
* rt_OneStep();
|
||||
*/
|
||||
printf("Warning: The simulation will run forever. "
|
||||
"Generated ERT main won't simulate model step behavior. "
|
||||
"To change this behavior select the 'MAT-file logging' option.\n");
|
||||
fflush((NULL));
|
||||
while (rtmGetErrorStatus(RP_01_APP_M) == (NULL)) {
|
||||
/* Perform application tasks here */
|
||||
}
|
||||
|
||||
/* Terminate model */
|
||||
RP_01_APP_terminate();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -1,109 +0,0 @@
|
||||
|
||||
#include "RTE.h"
|
||||
#include "hwctrl.h"
|
||||
#include "mcu.h"
|
||||
#include "canuser.h"
|
||||
|
||||
extern McuType mcu;
|
||||
|
||||
uint8_T CAN0X301_DATA[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
uint8_T Motor_state[6] = {0,0,0,0,0,0};
|
||||
|
||||
CAN_DATATYPE rte_get_CANMSG_0x201(void)
|
||||
{
|
||||
CAN_DATATYPE CANMsg_0x201;
|
||||
CANMsg_0x201.ID = 0x201;
|
||||
GetRxMsgData(0x201,CANMsg_0x201.Data,8);
|
||||
CANMsg_0x201.Length = 8;
|
||||
CANMsg_0x201.Remote = 0;
|
||||
CANMsg_0x201.Extended = 0;
|
||||
CANMsg_0x201.Error = 0;
|
||||
|
||||
return CANMsg_0x201;
|
||||
|
||||
|
||||
}
|
||||
|
||||
uint8_T rte_get_CANMSG_0x301_DATA(int32_T i)
|
||||
{
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
void rte_set_CANMSG_0x301_DATA(int32_T i,uint8_T data)
|
||||
{
|
||||
if (i >= 0 && i <= 7)
|
||||
{
|
||||
CAN0X301_DATA[i] = data;
|
||||
}
|
||||
if (i == 7)
|
||||
{
|
||||
SetTxMsgData(0x301,CAN0X301_DATA,8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rte_set_Motor_HG_State(uint8_T act)
|
||||
{
|
||||
hw_MotorCtrl(&mcu,Motor1,act);
|
||||
Motor_state[Motor1] = act;
|
||||
}
|
||||
|
||||
void rte_set_Motor_KB_State(uint8_T act)
|
||||
{
|
||||
hw_MotorCtrl(&mcu,Motor2,act);
|
||||
Motor_state[Motor2] = act;
|
||||
}
|
||||
|
||||
void rte_set_Motor_TT_State(uint8_T act)
|
||||
{
|
||||
hw_MotorCtrl(&mcu,Motor3,act);
|
||||
Motor_state[Motor3] = act;
|
||||
}
|
||||
|
||||
void rte_set_Motor_ZY_State(uint8_T act)
|
||||
{
|
||||
hw_MotorCtrl(&mcu,Motor4,act);
|
||||
Motor_state[Motor4] = act;
|
||||
}
|
||||
|
||||
void rte_set_Motor_TZ_State(uint8_T act)
|
||||
{
|
||||
hw_MotorCtrl(&mcu,Motor5,act);
|
||||
Motor_state[Motor5] = act;
|
||||
}
|
||||
|
||||
void rte_set_Motor_YT_State(uint8_T act)
|
||||
{
|
||||
hw_MotorCtrl(&mcu,Motor6,act);
|
||||
Motor_state[Motor6] = act;
|
||||
}
|
||||
|
||||
|
||||
uint8_T rte_get_Motor_HG_State(void)
|
||||
{
|
||||
return Motor_state[Motor1];
|
||||
}
|
||||
uint8_T rte_get_Motor_KB_State(void)
|
||||
{
|
||||
return Motor_state[Motor2];
|
||||
}
|
||||
uint8_T rte_get_Motor_TT_State(void)
|
||||
{
|
||||
return Motor_state[Motor3];
|
||||
}
|
||||
uint8_T rte_get_Motor_ZY_State(void)
|
||||
{
|
||||
return Motor_state[Motor4];
|
||||
}
|
||||
uint8_T rte_get_Motor_TZ_State(void)
|
||||
{
|
||||
return Motor_state[Motor5];
|
||||
}
|
||||
uint8_T rte_get_Motor_YT_State(void)
|
||||
{
|
||||
return Motor_state[Motor6];
|
||||
}
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
#ifndef __RTE_H__
|
||||
#define __RTE_H__
|
||||
|
||||
#include "rtwtypes.h"
|
||||
#include "can_message.h"
|
||||
|
||||
CAN_DATATYPE rte_get_CANMSG_0x201(void);
|
||||
uint8_T rte_get_CANMSG_0x301_DATA(int32_T );
|
||||
void rte_set_CANMSG_0x301_DATA(int32_T,uint8_T);
|
||||
|
||||
|
||||
void rte_set_Motor_HG_State(uint8_T act);
|
||||
void rte_set_Motor_KB_State(uint8_T act);
|
||||
void rte_set_Motor_TT_State(uint8_T act);
|
||||
void rte_set_Motor_ZY_State(uint8_T act);
|
||||
void rte_set_Motor_TZ_State(uint8_T act);
|
||||
void rte_set_Motor_YT_State(uint8_T act);
|
||||
|
||||
uint8_T rte_get_Motor_HG_State(void);
|
||||
uint8_T rte_get_Motor_KB_State(void);
|
||||
uint8_T rte_get_Motor_TT_State(void);
|
||||
uint8_T rte_get_Motor_ZY_State(void);
|
||||
uint8_T rte_get_Motor_TZ_State(void);
|
||||
uint8_T rte_get_Motor_YT_State(void);
|
||||
|
||||
|
||||
|
||||
#endif /* __RTE_H__ */
|
@ -1,76 +0,0 @@
|
||||
/* Copyright 2008-2015 The MathWorks, Inc. */
|
||||
/**
|
||||
* @file: can_message.h
|
||||
*
|
||||
* Purpose: Declare custom and register CAN datatype.
|
||||
*
|
||||
* $Authors: Shankar Subramanian $
|
||||
*
|
||||
* $Copyright: 2008-2014 The MathWorks, Inc.$
|
||||
*
|
||||
*/
|
||||
#ifndef __CANMESSAGE__HEADER__
|
||||
#define __CANMESSAGE__HEADER__
|
||||
|
||||
|
||||
#include "rtwtypes.h" /* Use rtwtypes.h if available */
|
||||
|
||||
/* @DO NOT REMOVE: The following typedef is required for targets (FM5, C166 etc.) to actually
|
||||
use it for their code generation TLC file. Since their datatype is being
|
||||
discarded, this is being defined in our header which they will be referencing.*/
|
||||
typedef enum {CAN_MESSAGE_STANDARD, CAN_MESSAGE_EXTENDED} CanFrameType;
|
||||
|
||||
/* Define invalid CAN Identifier value. This can be used to specify invalid CAN Message
|
||||
This represents a uint32_T value */
|
||||
#define INVALID_CAN_ID 0xFFFFFFFFU
|
||||
|
||||
/*
|
||||
The CAN_DATATYPE structure has been structured so that it is tightly packed.
|
||||
Size of structure (without timestamp field) :16 bytes
|
||||
Size of structure (with timestamp field) :24 bytes
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
/* Is Extended frame */
|
||||
uint8_T Extended;
|
||||
|
||||
/* Length */
|
||||
uint8_T Length;
|
||||
|
||||
/* RTR */
|
||||
uint8_T Remote;
|
||||
|
||||
/* Error */
|
||||
uint8_T Error;
|
||||
|
||||
/* CAN ID */
|
||||
uint32_T ID;
|
||||
|
||||
/*
|
||||
TIMESTAMP_NOT_REQUIRED is a macro that will be defined by Target teams
|
||||
PIL, C166, FM5, xPC if they do not require the timestamp field during code
|
||||
generation. By default, timestamp is defined. If the targets do not require
|
||||
the timestamp field, they should define the macro TIMESTAMP_NOT_REQUIRED before
|
||||
including this header file for code generation.
|
||||
*/
|
||||
#ifndef TIMESTAMP_NOT_REQUIRED
|
||||
/* Timestamp */
|
||||
double Timestamp;
|
||||
#endif
|
||||
|
||||
/* Data field */
|
||||
uint8_T Data[8];
|
||||
|
||||
} CAN_MESSAGE;
|
||||
|
||||
typedef CAN_MESSAGE CAN_DATATYPE;
|
||||
|
||||
/**
|
||||
* Initialize a CAN message.
|
||||
*
|
||||
* @param CAN_DATATYPE: CAN Message structure
|
||||
*/
|
||||
void initializeCANMessage(CAN_DATATYPE* canmsg, uint8_T Extended);
|
||||
|
||||
#endif
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* File: rtwtypes.h
|
||||
*
|
||||
* Code generated for Simulink model 'RP_01_APP'.
|
||||
*
|
||||
* Model version : 1.24
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Sat Nov 9 16:01:04 2024
|
||||
*/
|
||||
|
||||
#ifndef RTWTYPES_H
|
||||
#define RTWTYPES_H
|
||||
|
||||
/* Logical type definitions */
|
||||
#if (!defined(__cplusplus))
|
||||
#ifndef false
|
||||
#define false (0U)
|
||||
#endif
|
||||
|
||||
#ifndef true
|
||||
#define true (1U)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*=======================================================================*
|
||||
* Target hardware information
|
||||
* Device type: Intel->x86-64 (Windows64)
|
||||
* Number of bits: char: 8 short: 16 int: 32
|
||||
* long: 32
|
||||
* native word size: 64
|
||||
* Byte ordering: LittleEndian
|
||||
* Signed integer division rounds to: Zero
|
||||
* Shift right on a signed integer as arithmetic shift: on
|
||||
*=======================================================================*/
|
||||
|
||||
/*=======================================================================*
|
||||
* Fixed width word size data types: *
|
||||
* int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers *
|
||||
* uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers *
|
||||
* real32_T, real64_T - 32 and 64 bit floating point numbers *
|
||||
*=======================================================================*/
|
||||
typedef signed char int8_T;
|
||||
typedef unsigned char uint8_T;
|
||||
typedef short int16_T;
|
||||
typedef unsigned short uint16_T;
|
||||
typedef int int32_T;
|
||||
typedef unsigned int uint32_T;
|
||||
typedef float real32_T;
|
||||
typedef double real64_T;
|
||||
|
||||
/*===========================================================================*
|
||||
* Generic type definitions: boolean_T, char_T, byte_T, int_T, uint_T, *
|
||||
* real_T, time_T, ulong_T. *
|
||||
*===========================================================================*/
|
||||
typedef double real_T;
|
||||
typedef double time_T;
|
||||
typedef unsigned char boolean_T;
|
||||
typedef int int_T;
|
||||
typedef unsigned int uint_T;
|
||||
typedef unsigned long ulong_T;
|
||||
typedef char char_T;
|
||||
typedef unsigned char uchar_T;
|
||||
typedef char_T byte_T;
|
||||
|
||||
/*=======================================================================*
|
||||
* Min and Max: *
|
||||
* int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers *
|
||||
* uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers *
|
||||
*=======================================================================*/
|
||||
#define MAX_int8_T ((int8_T)(127))
|
||||
#define MIN_int8_T ((int8_T)(-128))
|
||||
#define MAX_uint8_T ((uint8_T)(255U))
|
||||
#define MAX_int16_T ((int16_T)(32767))
|
||||
#define MIN_int16_T ((int16_T)(-32768))
|
||||
#define MAX_uint16_T ((uint16_T)(65535U))
|
||||
#define MAX_int32_T ((int32_T)(2147483647))
|
||||
#define MIN_int32_T ((int32_T)(-2147483647-1))
|
||||
#define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU))
|
||||
|
||||
/* Block D-Work pointer type */
|
||||
typedef void * pointer_T;
|
||||
|
||||
#endif /* RTWTYPES_H */
|
||||
|
||||
/*
|
||||
* File trailer for generated code.
|
||||
*
|
||||
* [EOF]
|
||||
*/
|
@ -10,7 +10,7 @@
|
||||
#include "SEGGER_RTT.h"
|
||||
#include "MotorCtrl.h"
|
||||
#include "canuser.h"
|
||||
#include "RP_01_APP.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* the defines
|
||||
@ -82,14 +82,13 @@ void appTask(McuType *obj)
|
||||
Asw_SetBootloaderRequest();
|
||||
ResetDrv_SoftwareResetModule(&obj->resetDrv, RESETDRV_SWRESET_SYS);
|
||||
}
|
||||
RP_01_APP_step();
|
||||
gSystick1msEvent--;
|
||||
gSystick1msCnt++;
|
||||
gSysTick1sCnt++;
|
||||
MsgTask(&udsObj);
|
||||
if (gSystick1msCnt % 10 == 0)
|
||||
{
|
||||
//MotorCtrl_Maintask(obj);
|
||||
MotorCtrl_Maintask(obj);
|
||||
}
|
||||
|
||||
if (gSystick1msCnt % 50 == 0)
|
||||
@ -118,7 +117,6 @@ void appTaskInit(McuType *obj)
|
||||
|
||||
MotorCtrl_Init(obj);
|
||||
|
||||
RP_01_APP_initialize();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
|
||||
#include "canuser.h"
|
||||
#include "scm_matrix-binutil.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* the typedefs
|
||||
@ -183,10 +184,7 @@ void MsgTask(UdsType *obj)//1ms task
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rxMsg.id == APP_RX_HOST_REQ1_MSG_ID)
|
||||
{
|
||||
memcpy(rxMsgBuf1, rxMsg.data, rxMsg.len);
|
||||
}
|
||||
scm_matrix_Receive(&scm_matrix_rx,rxMsg.data,rxMsg.id,rxMsg.len);
|
||||
}
|
||||
}
|
||||
RxMsgProcess();
|
||||
|
113
cva_asw_m0146/src/key.c
Normal file
113
cva_asw_m0146/src/key.c
Normal file
@ -0,0 +1,113 @@
|
||||
|
||||
#include "key.h"
|
||||
#include "scm_matrix-binutil.h"
|
||||
|
||||
uint8_t GetSigState(KEY_ID_t key_id);
|
||||
|
||||
static uint8_t keystate[KEY_NUM];
|
||||
static uint8_t keyPressFlag[KEY_NUM];
|
||||
static uint8_t keyReleaseFlag[KEY_NUM];
|
||||
static uint16_t keydelay[KEY_NUM];
|
||||
|
||||
#define KEY_DELAY_TIMES 4 //20Ms
|
||||
void ClearAllKeyState(void)
|
||||
{
|
||||
uint8_t i;
|
||||
for (i = 0; i < KEY_NUM; i++)
|
||||
{
|
||||
keystate[i] = 0;
|
||||
}
|
||||
}
|
||||
void setKeyPressFlag(KEY_ID_t id)
|
||||
{
|
||||
if (id < KEY_NUM)
|
||||
{
|
||||
keyPressFlag[id] = KEY_PRESSED;
|
||||
}
|
||||
}
|
||||
void setKeyReleaseFlag(KEY_ID_t id)
|
||||
{
|
||||
if (id < KEY_NUM)
|
||||
{
|
||||
keyReleaseFlag[id] = KEY_PRESSED;
|
||||
}
|
||||
}
|
||||
uint8_t getKeyPressFlag(uint8_t id)
|
||||
{
|
||||
uint8_t retVal = KEY_NOPRESSED;
|
||||
if (id < KEY_NUM)
|
||||
{
|
||||
retVal = keyPressFlag[id];
|
||||
keyPressFlag[id] = KEY_NOPRESSED;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
uint8_t getKeyReleaseFlag(uint8_t id)
|
||||
{
|
||||
uint8_t retVal = KEY_NOPRESSED;
|
||||
if (id < KEY_NUM)
|
||||
{
|
||||
retVal = keyReleaseFlag[id];
|
||||
keyReleaseFlag[id] = KEY_NOPRESSED;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void KeyScan(void)//5ms
|
||||
{
|
||||
uint8_t i,key,key_nopress;
|
||||
key_nopress = 0;
|
||||
for (i = 0; i < KEY_NUM; i++)
|
||||
{
|
||||
key = GetSigState(i);
|
||||
if (key == KEY_PRESSED && keystate[i] == KEY_NOPRESSED)
|
||||
{
|
||||
keydelay[i]++;
|
||||
if (keydelay[i] >= KEY_DELAY_TIMES)
|
||||
{
|
||||
keystate[i] = KEY_PRESSED;
|
||||
setKeyPressFlag(i);
|
||||
}
|
||||
}
|
||||
else if(key == KEY_NOPRESSED)
|
||||
{
|
||||
if (keydelay[i] > 0)
|
||||
{
|
||||
keydelay[i]--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keystate[i] == KEY_PRESSED)
|
||||
{
|
||||
setKeyReleaseFlag(i);
|
||||
}
|
||||
keystate[i] = KEY_NOPRESSED;
|
||||
key_nopress++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t GetSigState(KEY_ID_t key_id)
|
||||
{
|
||||
switch (key_id)
|
||||
{
|
||||
case KEY_HG_F:
|
||||
return scm_matrix_rx.Panel_Key.
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
25
cva_asw_m0146/src/key.h
Normal file
25
cva_asw_m0146/src/key.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef __KEY_H__
|
||||
#define __KEY_H__
|
||||
|
||||
|
||||
#include "mcu.h"
|
||||
|
||||
|
||||
#define KEY_PRESSED 1
|
||||
#define KEY_NOPRESSED 0
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
KEY_HG_F,//前
|
||||
KEY_HG_R,//后
|
||||
KEY_KB_F,
|
||||
KEY_KB_R,
|
||||
KEY_TT_F,
|
||||
KEY_TT_R,
|
||||
KEY_ZY_U,//上
|
||||
KEY_ZY_D,//下
|
||||
KEY_NUM,
|
||||
}KEY_ID_type;
|
||||
|
||||
#endif // __KEY_H__
|
Loading…
x
Reference in New Issue
Block a user