模型开发初版
This commit is contained in:
parent
7b5f66c953
commit
d191524d49
5
cva_asw_m0146/.vscode/settings.json
vendored
5
cva_asw_m0146/.vscode/settings.json
vendored
@ -19,7 +19,10 @@
|
||||
"sbc_tle94x1.h": "c",
|
||||
"tle94x1.h": "c",
|
||||
"reset_drv.h": "c",
|
||||
"pwmlite_drv.h": "c"
|
||||
"pwmlite_drv.h": "c",
|
||||
"RTE.C": "cpp",
|
||||
"rtwtypes.h": "c",
|
||||
"can_message.h": "c"
|
||||
},
|
||||
"C_Cpp.default.compilerPath": ""
|
||||
}
|
@ -361,6 +361,8 @@
|
||||
<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>
|
||||
</option>
|
||||
<option>
|
||||
<name>CCStdIncCheck</name>
|
||||
@ -693,7 +695,7 @@
|
||||
<data>
|
||||
<extensions></extensions>
|
||||
<cmdline></cmdline>
|
||||
<hasPrio>1</hasPrio>
|
||||
<hasPrio>24</hasPrio>
|
||||
<buildSequence>inputOutputBased</buildSequence>
|
||||
</data>
|
||||
</settings>
|
||||
@ -2634,6 +2636,27 @@
|
||||
<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>
|
||||
@ -2916,6 +2939,12 @@
|
||||
<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,6 +3273,27 @@
|
||||
<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>
|
||||
@ -3555,6 +3576,12 @@
|
||||
<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
|
||||
|
||||
"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"
|
||||
"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"
|
||||
|
||||
@echo off
|
||||
goto end
|
||||
@ -34,7 +34,7 @@ goto end
|
||||
|
||||
@echo on
|
||||
|
||||
"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"
|
||||
"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"
|
||||
|
||||
@echo off
|
||||
:end
|
@ -23,9 +23,9 @@
|
||||
|
||||
if ($debugfile -eq "")
|
||||
{
|
||||
& "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"
|
||||
& "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"
|
||||
}
|
||||
else
|
||||
{
|
||||
& "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"
|
||||
& "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"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
"-p"
|
||||
|
||||
"e:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf"
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf"
|
||||
|
||||
"--semihosting"
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
"e:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armPROC.dll"
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armPROC.dll"
|
||||
|
||||
"e:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armJLINK.dll"
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armJLINK.dll"
|
||||
|
||||
"F:\FCB_project\RP-01\CODE\cva_asw_m0146\Debug_FLASH\Exe\app_m146.out"
|
||||
"F:\work\dm\RP-01\CODE\RP-01\cva_asw_m0146\Debug_FLASH\Exe\app_m146.out"
|
||||
|
||||
--plugin="e:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armbat.dll"
|
||||
--plugin="D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armbat.dll"
|
||||
|
||||
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
</JLinkDriver>
|
||||
<PlDriver>
|
||||
<FirstRun>0</FirstRun>
|
||||
<MemConfigValue>e:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf</MemConfigValue>
|
||||
<MemConfigValue>D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf</MemConfigValue>
|
||||
</PlDriver>
|
||||
<ArmDriver>
|
||||
<EnableCache>0</EnableCache>
|
||||
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
||||
<EnableCache>0</EnableCache>
|
||||
</ArmDriver>
|
||||
<DebugChecksum>
|
||||
<Checksum>3190234441</Checksum>
|
||||
|
File diff suppressed because one or more lines are too long
636
cva_asw_m0146/src/RP_01_APP_ert_rtw/KeyPro.c
Normal file
636
cva_asw_m0146/src/RP_01_APP_ert_rtw/KeyPro.c
Normal file
@ -0,0 +1,636 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
121
cva_asw_m0146/src/RP_01_APP_ert_rtw/KeyPro.h
Normal file
121
cva_asw_m0146/src/RP_01_APP_ert_rtw/KeyPro.h
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
114
cva_asw_m0146/src/RP_01_APP_ert_rtw/MotorCtrl_Maintask.c
Normal file
114
cva_asw_m0146/src/RP_01_APP_ert_rtw/MotorCtrl_Maintask.c
Normal file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
46
cva_asw_m0146/src/RP_01_APP_ert_rtw/MotorCtrl_Maintask.h
Normal file
46
cva_asw_m0146/src/RP_01_APP_ert_rtw/MotorCtrl_Maintask.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
410
cva_asw_m0146/src/RP_01_APP_ert_rtw/MsgTx.c
Normal file
410
cva_asw_m0146/src/RP_01_APP_ert_rtw/MsgTx.c
Normal file
@ -0,0 +1,410 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
48
cva_asw_m0146/src/RP_01_APP_ert_rtw/MsgTx.h
Normal file
48
cva_asw_m0146/src/RP_01_APP_ert_rtw/MsgTx.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
346
cva_asw_m0146/src/RP_01_APP_ert_rtw/RP_01_APP.c
Normal file
346
cva_asw_m0146/src/RP_01_APP_ert_rtw/RP_01_APP.c
Normal file
@ -0,0 +1,346 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
195
cva_asw_m0146/src/RP_01_APP_ert_rtw/RP_01_APP.h
Normal file
195
cva_asw_m0146/src/RP_01_APP_ert_rtw/RP_01_APP.h
Normal file
@ -0,0 +1,195 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
31
cva_asw_m0146/src/RP_01_APP_ert_rtw/RP_01_APP_private.h
Normal file
31
cva_asw_m0146/src/RP_01_APP_ert_rtw/RP_01_APP_private.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
46
cva_asw_m0146/src/RP_01_APP_ert_rtw/RP_01_APP_types.h
Normal file
46
cva_asw_m0146/src/RP_01_APP_ert_rtw/RP_01_APP_types.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
@ -0,0 +1,4 @@
|
||||
#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 } };
|
778
cva_asw_m0146/src/RP_01_APP_ert_rtw/can_key_msg.c
Normal file
778
cva_asw_m0146/src/RP_01_APP_ert_rtw/can_key_msg.c
Normal file
@ -0,0 +1,778 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
69
cva_asw_m0146/src/RP_01_APP_ert_rtw/can_key_msg.h
Normal file
69
cva_asw_m0146/src/RP_01_APP_ert_rtw/can_key_msg.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
103
cva_asw_m0146/src/RP_01_APP_ert_rtw/ert_main.c
Normal file
103
cva_asw_m0146/src/RP_01_APP_ert_rtw/ert_main.c
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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]
|
||||
*/
|
109
cva_asw_m0146/src/RTE/RTE.C
Normal file
109
cva_asw_m0146/src/RTE/RTE.C
Normal file
@ -0,0 +1,109 @@
|
||||
|
||||
#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];
|
||||
}
|
||||
|
||||
|
28
cva_asw_m0146/src/RTE/RTE.H
Normal file
28
cva_asw_m0146/src/RTE/RTE.H
Normal file
@ -0,0 +1,28 @@
|
||||
#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__ */
|
76
cva_asw_m0146/src/RTE/can_message.h
Normal file
76
cva_asw_m0146/src/RTE/can_message.h
Normal file
@ -0,0 +1,76 @@
|
||||
/* 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
|
89
cva_asw_m0146/src/RTE/rtwtypes.h
Normal file
89
cva_asw_m0146/src/RTE/rtwtypes.h
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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,6 +10,7 @@
|
||||
#include "SEGGER_RTT.h"
|
||||
#include "MotorCtrl.h"
|
||||
#include "canuser.h"
|
||||
#include "RP_01_APP.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* the defines
|
||||
@ -81,13 +82,14 @@ 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)
|
||||
@ -115,6 +117,8 @@ void appTaskInit(McuType *obj)
|
||||
Uds_UserInit(&udsObj, &udsParam);
|
||||
|
||||
MotorCtrl_Init(obj);
|
||||
|
||||
RP_01_APP_initialize();
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,11 +132,26 @@ const FlexCanDrv_MsgCfgType msgCfgObj[UDS_MSG_IDX_NUM] = {
|
||||
};
|
||||
|
||||
|
||||
void GetRxMsgData(uint16_t msgId, uint8_t* pData, uint8_t Size)
|
||||
{
|
||||
if (msgId == APP_RX_HOST_REQ1_MSG_ID)
|
||||
{
|
||||
memcpy(pData, rxMsgBuf1, Size);
|
||||
}
|
||||
}
|
||||
|
||||
void SetTxMsgData(uint16_t msgId, uint8_t* pData, uint8_t Size)
|
||||
{
|
||||
if (msgId == APP_TX_ECU_STATUS_MSG_ID)
|
||||
{
|
||||
memcpy(txMsgBuf1, pData, Size);
|
||||
}
|
||||
}
|
||||
|
||||
static void RxMsgProcess(void)
|
||||
{
|
||||
HOST_Req1_Type* prxMsgBuf1 = (HOST_Req1_Type*)rxMsgBuf1;
|
||||
debugMode = prxMsgBuf1->HOST_DebugMode;
|
||||
//HOST_Req1_Type* prxMsgBuf1 = (HOST_Req1_Type*)rxMsgBuf1;
|
||||
//debugMode = prxMsgBuf1->HOST_DebugMode;
|
||||
}
|
||||
void MsgTask(UdsType *obj)//1ms task
|
||||
{
|
||||
|
@ -10,12 +10,15 @@
|
||||
#define UDS_FUNC_RECV_MSG_ID (0x7DF)
|
||||
#define UDS_PHYS_RESP_MSG_ID (0x7B2)
|
||||
|
||||
#define APP_TX_ECU_STATUS_MSG_ID (0x210)
|
||||
#define APP_TX_ECU_DEBUG1_MSG_ID (0x211)
|
||||
#define APP_TX_ECU_DEBUG2_MSG_ID (0x212)
|
||||
#define APP_TX_ECU_DEBUG3_MSG_ID (0x213)
|
||||
#define APP_RX_HOST_REQ1_MSG_ID (0x200)
|
||||
#define APP_RX_HOST_REQ2_MSG_ID (0x201)
|
||||
#define APP_TX_ECU_STATUS_MSG_ID (0x301)
|
||||
#define APP_TX_ECU_DEBUG1_MSG_ID (0x401)
|
||||
#define APP_TX_ECU_DEBUG2_MSG_ID (0x402)
|
||||
#define APP_TX_ECU_DEBUG3_MSG_ID (0x403)
|
||||
#define APP_TX_ECU_DEBUG4_MSG_ID (0x404)
|
||||
#define APP_TX_ECU_DEBUG5_MSG_ID (0x405)
|
||||
#define APP_TX_ECU_DEBUG6_MSG_ID (0x406)
|
||||
#define APP_RX_HOST_REQ1_MSG_ID (0x201)
|
||||
#define APP_RX_HOST_REQ2_MSG_ID (0x202)
|
||||
|
||||
#define CAN_DATA_BUFFER_SIZE (64u)
|
||||
#define CAN_BUFFER_FIFO_SIZE (32u)
|
||||
@ -43,4 +46,7 @@ int8_t FlexCanBoot_TxMessage(uint32_t msgId, const uint8_t* pData, uint8_t size)
|
||||
bool FlexCanBoot_ReadoutMsg(FlexCan_FrameStructureType* pRxMsgObj);
|
||||
void MsgTask(UdsType *obj);
|
||||
|
||||
void GetRxMsgData(uint16_t msgId, uint8_t* pData, uint8_t Size);
|
||||
void SetTxMsgData(uint16_t msgId, uint8_t* pData, uint8_t Size);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user