gudae 2 days ago
parent
commit
b759fb795b
  1. BIN
      DefaultBuild/app_cmd_parser.obj
  2. BIN
      DefaultBuild/app_owi_service.obj
  3. BIN
      DefaultBuild/app_result.obj
  4. BIN
      DefaultBuild/app_scheduler.obj
  5. BIN
      DefaultBuild/delay.obj
  6. BIN
      DefaultBuild/dipSwitch.obj
  7. BIN
      DefaultBuild/gatectrl.obj
  8. BIN
      DefaultBuild/i2c.obj
  9. BIN
      DefaultBuild/multical.abs
  10. 2
      DefaultBuild/multical.clnk
  11. 788
      DefaultBuild/multical.map
  12. 3484
      DefaultBuild/multical.mot
  13. 2036
      DefaultBuild/multical_all_rw_tau1_fallback.mot
  14. 1990
      DefaultBuild/multical_recovery_gpio.mot
  15. 2034
      DefaultBuild/multical_tau1_deterministic.mot
  16. 2013
      DefaultBuild/multical_tau1_p70_fix.mot
  17. 2057
      DefaultBuild/multical_tau1_root_fix.mot
  18. 2012
      DefaultBuild/multical_timer_capture_127.mot
  19. BIN
      DefaultBuild/owi.obj
  20. BIN
      DefaultBuild/r_cg_cgc.obj
  21. BIN
      DefaultBuild/r_cg_cgc_user.obj
  22. BIN
      DefaultBuild/r_cg_port.obj
  23. BIN
      DefaultBuild/r_cg_port_user.obj
  24. BIN
      DefaultBuild/r_cg_serial.obj
  25. BIN
      DefaultBuild/r_cg_serial_user.obj
  26. BIN
      DefaultBuild/r_cg_timer.obj
  27. BIN
      DefaultBuild/r_cg_timer_user.obj
  28. BIN
      DefaultBuild/r_cg_wdt.obj
  29. BIN
      DefaultBuild/r_cg_wdt_user.obj
  30. BIN
      DefaultBuild/r_main.obj
  31. BIN
      DefaultBuild/r_systeminit.obj
  32. BIN
      DefaultBuild/uart.obj
  33. 16
      QualityReport(multical,DefaultBuild).txt
  34. 92
      multical.mtpj
  35. 46
      multical.rcpe
  36. 6574
      multical.temp.mtud
  37. 334
      owi.c
  38. 10
      r_cg_port.c
  39. 157
      r_cg_timer.c
  40. 1048
      r_cg_timer.h
  41. 133
      r_cg_timer_user.c
  42. 79
      r_main.c
  43. 2
      r_systeminit.c

BIN
DefaultBuild/app_cmd_parser.obj

Binary file not shown.

BIN
DefaultBuild/app_owi_service.obj

Binary file not shown.

BIN
DefaultBuild/app_result.obj

Binary file not shown.

BIN
DefaultBuild/app_scheduler.obj

Binary file not shown.

BIN
DefaultBuild/delay.obj

Binary file not shown.

BIN
DefaultBuild/dipSwitch.obj

Binary file not shown.

BIN
DefaultBuild/gatectrl.obj

Binary file not shown.

BIN
DefaultBuild/i2c.obj

Binary file not shown.

BIN
DefaultBuild/multical.abs

Binary file not shown.

2
DefaultBuild/multical.clnk

@ -20,6 +20,8 @@
-Input=DefaultBuild\app_owi_service.obj
-Input=DefaultBuild\r_cg_wdt.obj
-Input=DefaultBuild\r_cg_wdt_user.obj
-Input=DefaultBuild\r_cg_timer.obj
-Input=DefaultBuild\r_cg_timer_user.obj
-SECURITY_ID=00000000000000000000
-DEVICE=C:\Program Files (x86)\Renesas Electronics\CS+\CC\Device\RL78\Devicefile\DR5F10PPJ.DVF
-DEBug

788
DefaultBuild/multical.map

File diff suppressed because it is too large

3484
DefaultBuild/multical.mot

File diff suppressed because it is too large

2036
DefaultBuild/multical_all_rw_tau1_fallback.mot

File diff suppressed because it is too large

1990
DefaultBuild/multical_recovery_gpio.mot

File diff suppressed because it is too large

2034
DefaultBuild/multical_tau1_deterministic.mot

File diff suppressed because it is too large

2013
DefaultBuild/multical_tau1_p70_fix.mot

File diff suppressed because it is too large

2057
DefaultBuild/multical_tau1_root_fix.mot

File diff suppressed because it is too large

2012
DefaultBuild/multical_timer_capture_127.mot

File diff suppressed because it is too large

BIN
DefaultBuild/owi.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_cgc.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_cgc_user.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_port.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_port_user.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_serial.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_serial_user.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_timer.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_timer_user.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_wdt.obj

Binary file not shown.

BIN
DefaultBuild/r_cg_wdt_user.obj

Binary file not shown.

BIN
DefaultBuild/r_main.obj

Binary file not shown.

BIN
DefaultBuild/r_systeminit.obj

Binary file not shown.

BIN
DefaultBuild/uart.obj

Binary file not shown.

16
QualityReport(multical,DefaultBuild).txt

@ -1,13 +1,13 @@
QualityReport
2026년 8월 3일 월요일 오전 9:42:59
2026년 8월 3일 월요일 오후 2:50:02
------ Start build(multical, DefaultBuild) ------
------ Build ended(Error:0, Warning:0)(multical, DefaultBuild) ------
--- SHA1 hash value of output files ---
C:\Users\temp\Desktop\new_fw - 115200\DefaultBuild\multical.abs: 018dff13bedabb61014296e2657d9cd501aa53f6
C:\Users\temp\Desktop\new_fw - 115200\DefaultBuild\multical.mot: 284709bc9ae1a019ce30893e2f2b0f45c1e9828e
C:\Users\temp\Desktop\new_fw_115200\DefaultBuild\multical.abs: 79a5baf7bac62b6a7d1a52fbebbc405fd18e00cf
C:\Users\temp\Desktop\new_fw_115200\DefaultBuild\multical.mot: 1d682c274a5490b4d3ff1e277ce18ee4f6491b48
--- System Information ---
@ -35,13 +35,13 @@ C:\Users\temp\Desktop\new_fw - 115200\DefaultBuild\multical.mot: 284709bc9ae1a01
C:\Program Files (x86)\Renesas Electronics\CS+\CC
*Memory Usage
*Private Working Set
287 MB
456 MB
*Number of GDI Objects
2865
3175
*Number of USER Objects
1602
1705
*Opened Files
36 editors, 36 files, 257 KB
38 editors, 38 files, 278 KB
--- Build Tool Plug-in Information ---
RH850 Build tool CC-RH Plug-in
@ -177,7 +177,7 @@ Device Information Common Interface
DeviceInformation.dll
--- Main Project Information ---
C:\Users\temp\Desktop\new_fw - 115200\multical.mtpj
C:\Users\temp\Desktop\new_fw_115200\multical.mtpj
Microcontroller Information
*R5F10PPJ
*File Name: Version

92
multical.mtpj

@ -154,6 +154,27 @@
<TreeImageGuid>03cad1e8-2eb3-4cde-a8a3-982423631122</TreeImageGuid>
<ParentItem>cd2e4292-1297-4c3b-8415-f027a507b349</ParentItem>
</Instance>
<Instance Guid="890af751-065b-44d1-aa38-540f63c6997c">
<Name>r_cg_timer.c</Name>
<Type>File</Type>
<RelativePath>r_cg_timer.c</RelativePath>
<TreeImageGuid>941832c1-fc3b-4e1b-94e8-01ea17128b42</TreeImageGuid>
<ParentItem>cd2e4292-1297-4c3b-8415-f027a507b349</ParentItem>
</Instance>
<Instance Guid="2474530c-fced-48ce-9bc4-434612898267">
<Name>r_cg_timer_user.c</Name>
<Type>File</Type>
<RelativePath>r_cg_timer_user.c</RelativePath>
<TreeImageGuid>941832c1-fc3b-4e1b-94e8-01ea17128b42</TreeImageGuid>
<ParentItem>cd2e4292-1297-4c3b-8415-f027a507b349</ParentItem>
</Instance>
<Instance Guid="66b9a909-5afc-4f37-b31f-8464595a6c3e">
<Name>r_cg_timer.h</Name>
<Type>File</Type>
<RelativePath>r_cg_timer.h</RelativePath>
<TreeImageGuid>03cad1e8-2eb3-4cde-a8a3-982423631122</TreeImageGuid>
<ParentItem>cd2e4292-1297-4c3b-8415-f027a507b349</ParentItem>
</Instance>
<Instance Guid="82861e3a-5f66-47ce-b5d0-07c183f03a69">
<Name>OWI</Name>
<Type>Category</Type>
@ -457,7 +478,11 @@
<SourceItemType20>CSource</SourceItemType20>
<SourceItemGuid21>b7caf418-449c-4afa-9d64-16f7aef4371a</SourceItemGuid21>
<SourceItemType21>CSource</SourceItemType21>
<SourceItemCount>22</SourceItemCount>
<SourceItemGuid22>890af751-065b-44d1-aa38-540f63c6997c</SourceItemGuid22>
<SourceItemType22>CSource</SourceItemType22>
<SourceItemGuid23>2474530c-fced-48ce-9bc4-434612898267</SourceItemGuid23>
<SourceItemType23>CSource</SourceItemType23>
<SourceItemCount>24</SourceItemCount>
<LastDeviceChangedCounter>0</LastDeviceChangedCounter>
<LastDeviceNameOnPG>R5F10PPJ</LastDeviceNameOnPG>
<LastDeviceChangedCounterOnPG>0</LastDeviceChangedCounterOnPG>
@ -909,7 +934,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
<LinkOptionRrm-DefaultValue>False</LinkOptionRrm-DefaultValue>
<LinkOptionRrmValue-DefaultValue />
<IsLockedByUser>False</IsLockedByUser>
<TimeTagModified--0>-8584259869236164714</TimeTagModified--0>
<TimeTagModified--0>-8584158725482698835</TimeTagModified--0>
<LinkOptionAutoSectionLayout-0>True</LinkOptionAutoSectionLayout-0>
<LinkOptionCpu-0>False</LinkOptionCpu-0>
<LinkOptionDebug-0>Debug</LinkOptionDebug-0>
@ -1183,7 +1208,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
<LibOptionChangeMessageError-DefaultValue>None</LibOptionChangeMessageError-DefaultValue>
<LibOptionChangeMessageErrorNumber-DefaultValue />
<IsLockedByUser>False</IsLockedByUser>
<TimeTagModified--0>-8584319544808454661</TimeTagModified--0>
<TimeTagModified--0>-8584158725482698835</TimeTagModified--0>
<LibOptionDebug-0>Debug</LibOptionDebug-0>
<LibOptionForm-0>LibraryU</LibOptionForm-0>
<LibOptionInput-0 />
@ -1413,6 +1438,18 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
<ItemAddTime>639112491618550995</ItemAddTime>
<ItemAddTimeCount>2</ItemAddTimeCount>
</Instance>
<Instance Guid="66b9a909-5afc-4f37-b31f-8464595a6c3e">
<ItemAddTime>639213644451840438</ItemAddTime>
<ItemAddTimeCount>2</ItemAddTimeCount>
</Instance>
<Instance Guid="2474530c-fced-48ce-9bc4-434612898267">
<ItemAddTime>639213644451840438</ItemAddTime>
<ItemAddTimeCount>1</ItemAddTimeCount>
</Instance>
<Instance Guid="890af751-065b-44d1-aa38-540f63c6997c">
<ItemAddTime>639213644451840438</ItemAddTime>
<ItemAddTimeCount>0</ItemAddTimeCount>
</Instance>
<Instance Guid="0b7e78c3-aadd-45ee-9f9d-ffac6141eeb2">
<TimeTagModified-SourceItem0--0>-8584334295854395005</TimeTagModified-SourceItem0--0>
<SourceItem0-IsLockedByUser>False</SourceItem0-IsLockedByUser>
@ -1504,6 +1541,14 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
<SourceItem21-IsLockedByUser>False</SourceItem21-IsLockedByUser>
<SourceItem21-BuildingTarget-0>True</SourceItem21-BuildingTarget-0>
<SourceItem21-IndividualCompileOption-0>False</SourceItem21-IndividualCompileOption-0>
<TimeTagModified-SourceItem22--0>-8584158716402935370</TimeTagModified-SourceItem22--0>
<SourceItem22-IsLockedByUser>False</SourceItem22-IsLockedByUser>
<SourceItem22-BuildingTarget-0>True</SourceItem22-BuildingTarget-0>
<SourceItem22-IndividualCompileOption-0>False</SourceItem22-IndividualCompileOption-0>
<TimeTagModified-SourceItem23--0>-8584158716402935370</TimeTagModified-SourceItem23--0>
<SourceItem23-IsLockedByUser>False</SourceItem23-IsLockedByUser>
<SourceItem23-BuildingTarget-0>True</SourceItem23-BuildingTarget-0>
<SourceItem23-IndividualCompileOption-0>False</SourceItem23-IndividualCompileOption-0>
</Instance>
</Class>
<Class Guid="44fa27c9-0aa0-4297-bd3b-2c5c5bdb8881">
@ -4459,7 +4504,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;/RTC1HZ&gt;
&lt;RXD0 Name="RXD0" Text="enable" /&gt;
&lt;ProjectName Name="PrjName" Text="multical" /&gt;
&lt;ProjectPath Name="PrjPath" Text="C:\Users\temp\Desktop\new_fw - 115200" /&gt;
&lt;ProjectPath Name="PrjPath" Text="C:\Users\temp\Desktop\new_fw_115200" /&gt;
&lt;ProjectKind Name="PrjKind" Text="Project78K0R" /&gt;
&lt;DeviceName Name="DeviceName" Fixed="" Text="RL78F14" /&gt;
&lt;MCUName Name="MCUName" Text="RL78F14_100pin" /&gt;
@ -4617,7 +4662,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;P67 Name="P67/TI02/TO02" AltFunc="P67" Point="I/O" /&gt;
&lt;/Port6&gt;
&lt;Port7 Chip="R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" Pullup="true"&gt;
&lt;P70 Name="P70/ANI26/KR0/TI15/TO15/INTP8/SI11/SDA11/SNZOUT4/KR0" DIN="true" TTL="true" PITHL="true" Nch="true" AltFunc="P70" Point="I/O" /&gt;
&lt;P70 Name="P70/ANI26/KR0/TI15/TO15/INTP8/SI11/SDA11/SNZOUT4/KR0" DIN="true" TTL="true" PITHL="true" Nch="true" AltFunc="TI15" Point="I/O" /&gt;
&lt;P71 Name="P71/ANI27/KR1/TI17/TO17/INTP6/_SCK11/SCL11/SNZOUT5/KR1" DIN="true" TTL="true" PITHL="true" Nch="true" AltFunc="P71" Point="I/O" /&gt;
&lt;P72 Name="P72/ANI28/KR2/CTXD0/SO11/SNZOUT6/KR2" DIN="true" Nch="true" AltFunc="P72" Point="I/O" /&gt;
&lt;P73 Name="P73/ANI29/KR3/CRXD0/_SSI11/SNZOUT7/KR3" DIN="true" TTL="true" PITHL="true" AltFunc="P73" Point="I/O" /&gt;
@ -5081,7 +5126,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;INTTM14 InUse="0" ISR="r_tau1_channel4_interrupt" /&gt;
&lt;/Channel4&gt;
&lt;Channel5&gt;
&lt;INTTM15 InUse="0" ISR="r_tau1_channel5_interrupt" /&gt;
&lt;INTTM15 InUse="1" ISR="r_tau1_channel5_interrupt" /&gt;
&lt;/Channel5&gt;
&lt;Channel6&gt;
&lt;INTTM16 InUse="0" ISR="r_tau1_channel6_interrupt" /&gt;
@ -5508,7 +5553,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;r_cg_adc.h UserName="r_cg_adc.h" LibName=".h" InUse="0" /&gt;
&lt;/ADC&gt;
&lt;TAU&gt;
&lt;r_cg_timer.c UserName="r_cg_timer.c" LibName=".c" InUse="0"&gt;
&lt;r_cg_timer.c UserName="r_cg_timer.c" LibName=".c" InUse="1"&gt;
&lt;Type R_TAU_Create="void R_TAU_Create(void)" R_TAU_Set_PowerOff="void R_TAU_Set_PowerOff(void)" R_TAU_Channeln_Start="void R_TAU_Channeln_Start(void)" R_TAU_Channeln_Higher8bits_Start="void R_TAU_Channeln_Higher8bits_Start(void)" R_TAU_Channeln_Lower8bits_Start="void R_TAU_Channeln_Lower8bits_Start(void)" R_TAU_Channeln_Stop="void R_TAU_Channeln_Stop(void)" R_TAU_Channeln_Higher8bits_Stop="void R_TAU_Channeln_Higher8bits_Stop(void)" R_TAU_Channeln_Lower8bits_Stop="void R_TAU_Channeln_Lower8bits_Stop(void)" R_TAU_Channeln_Get_PulseWidth="void R_TAU_Channeln_Get_PulseWidth(uint32_t * const width)" R_TAU_Channeln_Set_SoftwareTriggerOn="void R_TAU_Channeln_Set_SoftwareTriggerOn(void)" R_WUTM_Create="void R_WUTM_Create(void)" R_WUTM_Start="void R_WUTM_Start(void)" R_WUTM_Stop="void R_WUTM_Stop(void)" R_WUTM_Set_PowerOff="void R_WUTM_Set_PowerOff(void)" /&gt;
&lt;TAU0&gt;
&lt;R_TAU0_Create UserName="R_TAU0_Create" LibName="R_TAU_Create" InUse="0" Init="1" InitMode="" /&gt;
@ -5567,7 +5612,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;/Channel7&gt;
&lt;/TAU0&gt;
&lt;TAU1&gt;
&lt;R_TAU1_Create UserName="R_TAU1_Create" LibName="R_TAU_Create" InUse="0" Init="1" InitMode="" /&gt;
&lt;R_TAU1_Create UserName="R_TAU1_Create" LibName="R_TAU_Create" InUse="1" Init="1" InitMode="" /&gt;
&lt;R_TAU1_Set_PowerOff UserName="R_TAU1_Set_PowerOff" LibName="R_TAU_Set_PowerOff" InUse="0" /&gt;
&lt;Channel0 InUse=""&gt;
&lt;R_TAU1_Channel0_Start UserName="R_TAU1_Channel0_Start" LibName="R_TAU_Channeln_Start" InUse="0" /&gt;
@ -5606,9 +5651,9 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;R_TAU1_Channel4_Set_SoftwareTriggerOn UserName="R_TAU1_Channel4_Set_SoftwareTriggerOn" LibName="R_TAU_Channeln_Set_SoftwareTriggerOn" InUse="0" /&gt;
&lt;/Channel4&gt;
&lt;Channel5 Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" InUse=""&gt;
&lt;R_TAU1_Channel5_Start UserName="R_TAU1_Channel5_Start" LibName="R_TAU_Channeln_Start" InUse="0" /&gt;
&lt;R_TAU1_Channel5_Stop UserName="R_TAU1_Channel5_Stop" LibName="R_TAU_Channeln_Stop" InUse="0" /&gt;
&lt;R_TAU1_Channel5_Get_PulseWidth Chip="RL78F14_80pin,RL78F14_100pin" UserName="R_TAU1_Channel5_Get_PulseWidth" LibName="R_TAU_Channeln_Get_PulseWidth" InUse="0" /&gt;
&lt;R_TAU1_Channel5_Start UserName="R_TAU1_Channel5_Start" LibName="R_TAU_Channeln_Start" InUse="1" /&gt;
&lt;R_TAU1_Channel5_Stop UserName="R_TAU1_Channel5_Stop" LibName="R_TAU_Channeln_Stop" InUse="1" /&gt;
&lt;R_TAU1_Channel5_Get_PulseWidth Chip="RL78F14_80pin,RL78F14_100pin" UserName="R_TAU1_Channel5_Get_PulseWidth" LibName="R_TAU_Channeln_Get_PulseWidth" InUse="1" /&gt;
&lt;/Channel5&gt;
&lt;Channel6 Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" InUse=""&gt;
&lt;R_TAU1_Channel6_Start UserName="R_TAU1_Channel6_Start" LibName="R_TAU_Channeln_Start" InUse="0" /&gt;
@ -5648,7 +5693,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;R_TMR_RD1_ForcedOutput_Stop UserName="R_TMR_RD1_ForcedOutput_Stop" LibName="R_TMR_RDn_ForcedOutput_Stop" InUse="0" /&gt;
&lt;/TMRD1&gt;
&lt;/r_cg_timer.c&gt;
&lt;r_cg_timer_user.c UserName="r_cg_timer_user.c" LibName="_user.c" InUse="0"&gt;
&lt;r_cg_timer_user.c UserName="r_cg_timer_user.c" LibName="_user.c" InUse="1"&gt;
&lt;Type R_TAU_Create_UserInit="void R_TAUn_Create_UserInit(void)" r_tau_channeln_interrupt="__interrupt static void r_tau_channeln_interrupt(void)" r_tau_channeln_higher8bits_interrupt="__interrupt static void r_tau_channeln_higher8bits_interrupt(void)" R_WUTM_Create_UserInit="void R_WUTM_Create_UserInit(void)" r_wutm_interrupt="__interrupt static void r_wutm_interrupt(void)" /&gt;
&lt;TAU0&gt;
&lt;R_TAU0_Create_UserInit UserName="R_TAU0_Create_UserInit" LibName="R_TAU_Create_UserInit" InUse="0" /&gt;
@ -5699,7 +5744,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;r_tau1_channel4_interrupt UserName="r_tau1_channel4_interrupt" INTHandle="" LibName="r_tau_channeln_interrupt" InUse="0" /&gt;
&lt;/Channel4&gt;
&lt;Channel5 Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" InUse=""&gt;
&lt;r_tau1_channel5_interrupt UserName="r_tau1_channel5_interrupt" INTHandle="" LibName="r_tau_channeln_interrupt" InUse="0" /&gt;
&lt;r_tau1_channel5_interrupt UserName="r_tau1_channel5_interrupt" INTHandle="" LibName="r_tau_channeln_interrupt" InUse="1" /&gt;
&lt;/Channel5&gt;
&lt;Channel6 Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" InUse=""&gt;
&lt;r_tau1_channel6_interrupt UserName="r_tau1_channel6_interrupt" INTHandle="" LibName="r_tau_channeln_interrupt" InUse="0" /&gt;
@ -5721,7 +5766,7 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;r_tmr_rd1_interrupt UserName="r_tmr_rd1_interrupt" LibName="r_tmr_rdn_interrupt" INTHandle="" InUse="0" /&gt;
&lt;/TMRD1&gt;
&lt;/r_cg_timer_user.c&gt;
&lt;r_cg_timer.h UserName="r_cg_timer.h" LibName=".h" InUse="0" /&gt;
&lt;r_cg_timer.h UserName="r_cg_timer.h" LibName=".h" InUse="1" /&gt;
&lt;/TAU&gt;
&lt;WDT&gt;
&lt;r_cg_wdt.c UserName="r_cg_wdt.c" LibName=".c" InUse="1"&gt;
@ -6019,9 +6064,9 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;ADC SetFlag="False" HelpID="adc" NeedRefresh="False"&gt;
&lt;ADC SetFlag="False" MacroName="ADC" /&gt;
&lt;/ADC&gt;
&lt;TAU SetFlag="False" HelpID="timer" NeedRefresh="False"&gt;
&lt;TAU SetFlag="True" HelpID="timer" NeedRefresh="False"&gt;
&lt;TAU0 Accelerate="No" MacroName="TAU" Channel="0" ChannelNum="0,1,2,3,4,5,6,7" SetFlag="False" TabEnable="True" /&gt;
&lt;TAU1 Accelerate="No" Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" MacroName="TAU" Channel="1" ChannelNum="0,1,2,3,4,5,6,7" SetFlag="False" TabEnable="True" /&gt;
&lt;TAU1 Accelerate="No" Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" MacroName="TAU" Channel="1" ChannelNum="0,1,2,3,4,5,6,7" SetFlag="True" TabEnable="True" /&gt;
&lt;TMRJ0 SetFlag="False" MacroName="TMRJ" Channel="0" TabEnable="True" /&gt;
&lt;TMRD0 SetFlag="False" MacroName="TMRD" Channel="0" TabEnable="True" /&gt;
&lt;TMRD1 SetFlag="False" MacroName="TMRD" Channel="1" TabEnable="True" /&gt;
@ -6770,9 +6815,9 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;/PortP6&gt;
&lt;PortP7&gt;
&lt;P70&gt;
&lt;setting name="MODULE_UNUSED" value="false" /&gt;
&lt;setting name="MODULE_UNUSED" value="true" /&gt;
&lt;setting name="INPUT_MODE" value="false" /&gt;
&lt;setting name="OUTPUT_MODE" value="true" /&gt;
&lt;setting name="OUTPUT_MODE" value="false" /&gt;
&lt;setting name="PULLUP_ON" value="false" /&gt;
&lt;setting name="NCH_ON" value="true" /&gt;
&lt;setting name="OUTPUT_1" value="false" /&gt;
@ -7454,8 +7499,17 @@ C:\Program Files (x86)\Renesas Electronics\CS+\CC\FAA\V1.05.00
&lt;setting name="Pinselection" value="-1" /&gt;
&lt;/Channel4&gt;
&lt;Channel5&gt;
&lt;setting name="ChannelFunction" value="0" /&gt;
&lt;setting name="ChannelFunction" value="4" /&gt;
&lt;setting name="Pinselection" value="-1" /&gt;
&lt;TAUIntervalMeasure5&gt;
&lt;setting name="MeasureRang" value="0.063 (µs) &amp;lt; TI15 &amp;lt; 4.096 (ms)" /&gt;
&lt;setting name="Noise_filter" value="unused" /&gt;
&lt;setting name="TI0_input_edge" value="both" /&gt;
&lt;setting name="Interrupt" value="used" /&gt;
&lt;setting name="Generate_interrupt_when_counting_started" value="no" /&gt;
&lt;setting name="Interrupt_priority" value="3" /&gt;
&lt;setting name="Input_source" value="TI05" /&gt;
&lt;/TAUIntervalMeasure5&gt;
&lt;/Channel5&gt;
&lt;Channel6&gt;
&lt;setting name="ChannelFunction" value="0" /&gt;

46
multical.rcpe

@ -27,6 +27,9 @@
<Path>r_cg_wdt.c</Path>
<Path>r_cg_wdt_user.c</Path>
<Path>r_cg_wdt.h</Path>
<Path>r_cg_timer.c</Path>
<Path>r_cg_timer_user.c</Path>
<Path>r_cg_timer.h</Path>
</Category>
<Category Name="drivers">
<Category Name="OWI">
@ -97,6 +100,8 @@
<Path>DefaultBuild\app_owi_service.obj</Path>
<Path>DefaultBuild\r_cg_wdt.obj</Path>
<Path>DefaultBuild\r_cg_wdt_user.obj</Path>
<Path>DefaultBuild\r_cg_timer.obj</Path>
<Path>DefaultBuild\r_cg_timer_user.obj</Path>
</LinkOrder>
<CommonOptions>
<IncludePathForC>..\..\Documents\카카오톡 받은 파일\IDH1.1\IDH1.1</IncludePathForC>
@ -397,7 +402,7 @@
&lt;/RTC1HZ&gt;
&lt;RXD0 Name="RXD0" Text="enable" /&gt;
&lt;ProjectName Name="PrjName" Text="multical" /&gt;
&lt;ProjectPath Name="PrjPath" Text="C:\Users\temp\Desktop\new_fw - 115200" /&gt;
&lt;ProjectPath Name="PrjPath" Text="C:\Users\temp\Desktop\new_fw_115200" /&gt;
&lt;ProjectKind Name="PrjKind" Text="Project78K0R" /&gt;
&lt;DeviceName Name="DeviceName" Fixed="" Text="RL78F14" /&gt;
&lt;MCUName Name="MCUName" Text="RL78F14_100pin" /&gt;
@ -555,7 +560,7 @@
&lt;P67 Name="P67/TI02/TO02" AltFunc="P67" Point="I/O" /&gt;
&lt;/Port6&gt;
&lt;Port7 Chip="R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" Pullup="true"&gt;
&lt;P70 Name="P70/ANI26/KR0/TI15/TO15/INTP8/SI11/SDA11/SNZOUT4/KR0" DIN="true" TTL="true" PITHL="true" Nch="true" AltFunc="P70" Point="I/O" /&gt;
&lt;P70 Name="P70/ANI26/KR0/TI15/TO15/INTP8/SI11/SDA11/SNZOUT4/KR0" DIN="true" TTL="true" PITHL="true" Nch="true" AltFunc="TI15" Point="I/O" /&gt;
&lt;P71 Name="P71/ANI27/KR1/TI17/TO17/INTP6/_SCK11/SCL11/SNZOUT5/KR1" DIN="true" TTL="true" PITHL="true" Nch="true" AltFunc="P71" Point="I/O" /&gt;
&lt;P72 Name="P72/ANI28/KR2/CTXD0/SO11/SNZOUT6/KR2" DIN="true" Nch="true" AltFunc="P72" Point="I/O" /&gt;
&lt;P73 Name="P73/ANI29/KR3/CRXD0/_SSI11/SNZOUT7/KR3" DIN="true" TTL="true" PITHL="true" AltFunc="P73" Point="I/O" /&gt;
@ -1019,7 +1024,7 @@
&lt;INTTM14 InUse="0" ISR="r_tau1_channel4_interrupt" /&gt;
&lt;/Channel4&gt;
&lt;Channel5&gt;
&lt;INTTM15 InUse="0" ISR="r_tau1_channel5_interrupt" /&gt;
&lt;INTTM15 InUse="1" ISR="r_tau1_channel5_interrupt" /&gt;
&lt;/Channel5&gt;
&lt;Channel6&gt;
&lt;INTTM16 InUse="0" ISR="r_tau1_channel6_interrupt" /&gt;
@ -1446,7 +1451,7 @@
&lt;r_cg_adc.h UserName="r_cg_adc.h" LibName=".h" InUse="0" /&gt;
&lt;/ADC&gt;
&lt;TAU&gt;
&lt;r_cg_timer.c UserName="r_cg_timer.c" LibName=".c" InUse="0"&gt;
&lt;r_cg_timer.c UserName="r_cg_timer.c" LibName=".c" InUse="1"&gt;
&lt;Type R_TAU_Create="void R_TAU_Create(void)" R_TAU_Set_PowerOff="void R_TAU_Set_PowerOff(void)" R_TAU_Channeln_Start="void R_TAU_Channeln_Start(void)" R_TAU_Channeln_Higher8bits_Start="void R_TAU_Channeln_Higher8bits_Start(void)" R_TAU_Channeln_Lower8bits_Start="void R_TAU_Channeln_Lower8bits_Start(void)" R_TAU_Channeln_Stop="void R_TAU_Channeln_Stop(void)" R_TAU_Channeln_Higher8bits_Stop="void R_TAU_Channeln_Higher8bits_Stop(void)" R_TAU_Channeln_Lower8bits_Stop="void R_TAU_Channeln_Lower8bits_Stop(void)" R_TAU_Channeln_Get_PulseWidth="void R_TAU_Channeln_Get_PulseWidth(uint32_t * const width)" R_TAU_Channeln_Set_SoftwareTriggerOn="void R_TAU_Channeln_Set_SoftwareTriggerOn(void)" R_WUTM_Create="void R_WUTM_Create(void)" R_WUTM_Start="void R_WUTM_Start(void)" R_WUTM_Stop="void R_WUTM_Stop(void)" R_WUTM_Set_PowerOff="void R_WUTM_Set_PowerOff(void)" /&gt;
&lt;TAU0&gt;
&lt;R_TAU0_Create UserName="R_TAU0_Create" LibName="R_TAU_Create" InUse="0" Init="1" InitMode="" /&gt;
@ -1505,7 +1510,7 @@
&lt;/Channel7&gt;
&lt;/TAU0&gt;
&lt;TAU1&gt;
&lt;R_TAU1_Create UserName="R_TAU1_Create" LibName="R_TAU_Create" InUse="0" Init="1" InitMode="" /&gt;
&lt;R_TAU1_Create UserName="R_TAU1_Create" LibName="R_TAU_Create" InUse="1" Init="1" InitMode="" /&gt;
&lt;R_TAU1_Set_PowerOff UserName="R_TAU1_Set_PowerOff" LibName="R_TAU_Set_PowerOff" InUse="0" /&gt;
&lt;Channel0 InUse=""&gt;
&lt;R_TAU1_Channel0_Start UserName="R_TAU1_Channel0_Start" LibName="R_TAU_Channeln_Start" InUse="0" /&gt;
@ -1544,9 +1549,9 @@
&lt;R_TAU1_Channel4_Set_SoftwareTriggerOn UserName="R_TAU1_Channel4_Set_SoftwareTriggerOn" LibName="R_TAU_Channeln_Set_SoftwareTriggerOn" InUse="0" /&gt;
&lt;/Channel4&gt;
&lt;Channel5 Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" InUse=""&gt;
&lt;R_TAU1_Channel5_Start UserName="R_TAU1_Channel5_Start" LibName="R_TAU_Channeln_Start" InUse="0" /&gt;
&lt;R_TAU1_Channel5_Stop UserName="R_TAU1_Channel5_Stop" LibName="R_TAU_Channeln_Stop" InUse="0" /&gt;
&lt;R_TAU1_Channel5_Get_PulseWidth Chip="RL78F14_80pin,RL78F14_100pin" UserName="R_TAU1_Channel5_Get_PulseWidth" LibName="R_TAU_Channeln_Get_PulseWidth" InUse="0" /&gt;
&lt;R_TAU1_Channel5_Start UserName="R_TAU1_Channel5_Start" LibName="R_TAU_Channeln_Start" InUse="1" /&gt;
&lt;R_TAU1_Channel5_Stop UserName="R_TAU1_Channel5_Stop" LibName="R_TAU_Channeln_Stop" InUse="1" /&gt;
&lt;R_TAU1_Channel5_Get_PulseWidth Chip="RL78F14_80pin,RL78F14_100pin" UserName="R_TAU1_Channel5_Get_PulseWidth" LibName="R_TAU_Channeln_Get_PulseWidth" InUse="1" /&gt;
&lt;/Channel5&gt;
&lt;Channel6 Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" InUse=""&gt;
&lt;R_TAU1_Channel6_Start UserName="R_TAU1_Channel6_Start" LibName="R_TAU_Channeln_Start" InUse="0" /&gt;
@ -1586,7 +1591,7 @@
&lt;R_TMR_RD1_ForcedOutput_Stop UserName="R_TMR_RD1_ForcedOutput_Stop" LibName="R_TMR_RDn_ForcedOutput_Stop" InUse="0" /&gt;
&lt;/TMRD1&gt;
&lt;/r_cg_timer.c&gt;
&lt;r_cg_timer_user.c UserName="r_cg_timer_user.c" LibName="_user.c" InUse="0"&gt;
&lt;r_cg_timer_user.c UserName="r_cg_timer_user.c" LibName="_user.c" InUse="1"&gt;
&lt;Type R_TAU_Create_UserInit="void R_TAUn_Create_UserInit(void)" r_tau_channeln_interrupt="__interrupt static void r_tau_channeln_interrupt(void)" r_tau_channeln_higher8bits_interrupt="__interrupt static void r_tau_channeln_higher8bits_interrupt(void)" R_WUTM_Create_UserInit="void R_WUTM_Create_UserInit(void)" r_wutm_interrupt="__interrupt static void r_wutm_interrupt(void)" /&gt;
&lt;TAU0&gt;
&lt;R_TAU0_Create_UserInit UserName="R_TAU0_Create_UserInit" LibName="R_TAU_Create_UserInit" InUse="0" /&gt;
@ -1637,7 +1642,7 @@
&lt;r_tau1_channel4_interrupt UserName="r_tau1_channel4_interrupt" INTHandle="" LibName="r_tau_channeln_interrupt" InUse="0" /&gt;
&lt;/Channel4&gt;
&lt;Channel5 Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" InUse=""&gt;
&lt;r_tau1_channel5_interrupt UserName="r_tau1_channel5_interrupt" INTHandle="" LibName="r_tau_channeln_interrupt" InUse="0" /&gt;
&lt;r_tau1_channel5_interrupt UserName="r_tau1_channel5_interrupt" INTHandle="" LibName="r_tau_channeln_interrupt" InUse="1" /&gt;
&lt;/Channel5&gt;
&lt;Channel6 Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" InUse=""&gt;
&lt;r_tau1_channel6_interrupt UserName="r_tau1_channel6_interrupt" INTHandle="" LibName="r_tau_channeln_interrupt" InUse="0" /&gt;
@ -1659,7 +1664,7 @@
&lt;r_tmr_rd1_interrupt UserName="r_tmr_rd1_interrupt" LibName="r_tmr_rdn_interrupt" INTHandle="" InUse="0" /&gt;
&lt;/TMRD1&gt;
&lt;/r_cg_timer_user.c&gt;
&lt;r_cg_timer.h UserName="r_cg_timer.h" LibName=".h" InUse="0" /&gt;
&lt;r_cg_timer.h UserName="r_cg_timer.h" LibName=".h" InUse="1" /&gt;
&lt;/TAU&gt;
&lt;WDT&gt;
&lt;r_cg_wdt.c UserName="r_cg_wdt.c" LibName=".c" InUse="1"&gt;
@ -1957,9 +1962,9 @@
&lt;ADC SetFlag="False" HelpID="adc" NeedRefresh="False"&gt;
&lt;ADC SetFlag="False" MacroName="ADC" /&gt;
&lt;/ADC&gt;
&lt;TAU SetFlag="False" HelpID="timer" NeedRefresh="False"&gt;
&lt;TAU SetFlag="True" HelpID="timer" NeedRefresh="False"&gt;
&lt;TAU0 Accelerate="No" MacroName="TAU" Channel="0" ChannelNum="0,1,2,3,4,5,6,7" SetFlag="False" TabEnable="True" /&gt;
&lt;TAU1 Accelerate="No" Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" MacroName="TAU" Channel="1" ChannelNum="0,1,2,3,4,5,6,7" SetFlag="False" TabEnable="True" /&gt;
&lt;TAU1 Accelerate="No" Chip="R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PGG,R5F10PGH,R5F10PGJ,R5F10PLG,R5F10PLH,R5F10PLJ,R5F10PMG,R5F10PMH,R5F10PMJ,RL78F14_100pin" MacroName="TAU" Channel="1" ChannelNum="0,1,2,3,4,5,6,7" SetFlag="True" TabEnable="True" /&gt;
&lt;TMRJ0 SetFlag="False" MacroName="TMRJ" Channel="0" TabEnable="True" /&gt;
&lt;TMRD0 SetFlag="False" MacroName="TMRD" Channel="0" TabEnable="True" /&gt;
&lt;TMRD1 SetFlag="False" MacroName="TMRD" Channel="1" TabEnable="True" /&gt;
@ -2708,9 +2713,9 @@
&lt;/PortP6&gt;
&lt;PortP7&gt;
&lt;P70&gt;
&lt;setting name="MODULE_UNUSED" value="false" /&gt;
&lt;setting name="MODULE_UNUSED" value="true" /&gt;
&lt;setting name="INPUT_MODE" value="false" /&gt;
&lt;setting name="OUTPUT_MODE" value="true" /&gt;
&lt;setting name="OUTPUT_MODE" value="false" /&gt;
&lt;setting name="PULLUP_ON" value="false" /&gt;
&lt;setting name="NCH_ON" value="true" /&gt;
&lt;setting name="OUTPUT_1" value="false" /&gt;
@ -3392,8 +3397,17 @@
&lt;setting name="Pinselection" value="-1" /&gt;
&lt;/Channel4&gt;
&lt;Channel5&gt;
&lt;setting name="ChannelFunction" value="0" /&gt;
&lt;setting name="ChannelFunction" value="4" /&gt;
&lt;setting name="Pinselection" value="-1" /&gt;
&lt;TAUIntervalMeasure5&gt;
&lt;setting name="MeasureRang" value="0.063 (µs) &amp;lt; TI15 &amp;lt; 4.096 (ms)" /&gt;
&lt;setting name="Noise_filter" value="unused" /&gt;
&lt;setting name="TI0_input_edge" value="both" /&gt;
&lt;setting name="Interrupt" value="used" /&gt;
&lt;setting name="Generate_interrupt_when_counting_started" value="no" /&gt;
&lt;setting name="Interrupt_priority" value="3" /&gt;
&lt;setting name="Input_source" value="TI05" /&gt;
&lt;/TAUIntervalMeasure5&gt;
&lt;/Channel5&gt;
&lt;Channel6&gt;
&lt;setting name="ChannelFunction" value="0" /&gt;

6574
multical.temp.mtud

File diff suppressed because one or more lines are too long

334
owi.c

@ -1,5 +1,6 @@
#include "owi.h"
#include "delay.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
#include <string.h>
#include <stdio.h>
@ -10,9 +11,25 @@
#define OWI_STRONG_DRIVE_HIGH_US 5u
#endif
#ifndef OWI_USE_TAU1_CAPTURE
#define OWI_USE_TAU1_CAPTURE 1u
#endif
/* Renesas CG: count-clock period is half the selected 0.063 us minimum.
Therefore TI15 capture runs at approximately 32 timer ticks per us. */
#define OWI_TAU1_TICKS_PER_US 32UL
#define OWI_CAPTURE_QUEUE_WAIT_US (bit_period_us * 4u)
#define OWI_CAPTURE_SYNC_BITS 16u
/* 내부 상태 */
static uint32_t bit_period_us = OWI_BIT_PERIOD_US;
static uint8_t g_owi_timeout_latched = 0;
#if OWI_USE_TAU1_CAPTURE
static uint32_t g_owi_capture_threshold_ticks = 0UL;
static uint8_t g_owi_capture_pending_bits[OWI_CAPTURE_SYNC_BITS];
static uint8_t g_owi_capture_pending_index = 0U;
static uint8_t g_owi_capture_pending_count = 0U;
#endif
static uint16_t g_owi_last_timeout_byte_index = 0xFFFFu;
static uint8_t g_owi_last_timeout_bit_index = 0xFFu;
@ -114,6 +131,10 @@ void OWI_Init(uint32_t bit_time_us)
bit_period_us = bit_time_us;
(void)bit_period_us;
/* R_PORT_Create() can overwrite the TI15 setup after system init.
Re-enable the P70 digital input path before every OWI transaction. */
PMC7 &= (uint8_t)~OWI_PIN_MASK;
PIM7 &= (uint8_t)~OWI_PIN_MASK;
OWI_PORT_POM |= (uint8_t)OWI_PIN_MASK;
OWI_PORT_PU &= (uint8_t)~OWI_PIN_MASK;
@ -155,29 +176,6 @@ static void OWI_StopRead(void)
delay_us(TIDLE);
}
static uint8_t OWI_WaitFirstBitStart(void)
{
int timeout;
timeout = (int)(bit_period_us * 4u);
/* 첫 번째 HIGH->LOW 시작을 기다림 */
while (GPIO_Read() && timeout-- > 0) {
delay_us(1u);
}
if (timeout <= 0) {
if (!g_owi_timeout_latched) {
g_owi_timeout_latched = 1;
g_owi_last_timeout_byte_index = 0u;
g_owi_last_timeout_bit_index = 0u;
}
return 0u;
}
return 1u;
}
static uint8_t OWI_WaitForFallingEdge(uint16_t byte_index, uint8_t bit_index)
{
int timeout = (int)(bit_period_us * 4u);
@ -222,6 +220,258 @@ static uint8_t OWI_ReadByte_StreamSynced(uint16_t byte_index)
return data;
}
#if OWI_USE_TAU1_CAPTURE
static void OWI_CapturePrepare(void)
{
/* P70 remains a normal open-drain GPIO at boot. Configure TI15 only
immediately before a captured receive transaction. */
R_TAU1_Create();
R_TAU1_Channel5_Stop();
/* Slow RC rising edges on P70 benefit from the TI15 digital noise filter.
Give capture precedence over UART interrupts while receiving a frame. */
NFEN2 |= _20_TAU_CH5_NOISE_ON;
TMPR115 = 0U;
TMPR015 = 0U;
GPIO_Input();
}
static void OWI_CaptureBegin(void)
{
GPIO_Input();
g_owi_capture_threshold_ticks = 0UL;
g_owi_capture_pending_index = 0U;
g_owi_capture_pending_count = 0U;
R_TAU1_Channel5_CaptureReset();
R_TAU1_Channel5_Start();
}
static void OWI_CaptureEnd(void)
{
R_TAU1_Channel5_Stop();
GPIO_Input();
}
static uint8_t OWI_CaptureWaitLowWidth(uint16_t byte_index,
uint8_t bit_index,
uint32_t * const low_ticks)
{
uint32_t timeout_us = OWI_CAPTURE_QUEUE_WAIT_US;
while (timeout_us-- > 0UL)
{
if (R_TAU1_Channel5_GetLowWidthTicks(low_ticks))
{
return 1U;
}
if (R_TAU1_Channel5_CaptureOverflowed())
{
break;
}
/* This delay is only a timeout yield; pulse timing is captured by TAU1. */
delay_us(1U);
}
if (!g_owi_timeout_latched)
{
g_owi_timeout_latched = 1U;
g_owi_last_timeout_byte_index = byte_index;
g_owi_last_timeout_bit_index = bit_index;
}
return 0U;
}
static uint32_t OWI_CaptureFindThreshold(const uint32_t *widths,
uint8_t width_count)
{
uint32_t sorted[OWI_CAPTURE_SYNC_BITS];
uint32_t max_gap = 0UL;
uint32_t threshold =
((uint32_t)bit_period_us * OWI_TAU1_TICKS_PER_US) / 2UL;
uint32_t gap;
uint32_t temp;
uint8_t i;
uint8_t j;
for (i = 0U; i < width_count; i++) {
sorted[i] = widths[i];
}
for (i = 0U; i < (uint8_t)(width_count - 1U); i++) {
for (j = (uint8_t)(i + 1U); j < width_count; j++) {
if (sorted[j] < sorted[i]) {
temp = sorted[i];
sorted[i] = sorted[j];
sorted[j] = temp;
}
}
}
/* The 0x26 header contains both short and long LOW pulses. The largest
gap separates the two measured clusters without assuming timer scale. */
for (i = 0U; i < (uint8_t)(width_count - 1U); i++) {
gap = sorted[i + 1U] - sorted[i];
if (gap > max_gap) {
max_gap = gap;
threshold = sorted[i] + (gap / 2UL);
}
}
return threshold;
}
static uint8_t OWI_CaptureExpectedHeaderBit(uint8_t header_bit_index)
{
return (uint8_t)((0x26U >> (7U - header_bit_index)) & 0x01U);
}
static uint8_t OWI_CaptureFindHeaderEnd(const uint8_t *bits,
uint8_t bit_count,
uint8_t * const header_end)
{
uint8_t start;
uint8_t i;
uint8_t missed;
uint8_t matched;
if (header_end == 0) {
return 0U;
}
/* Normal case and recovery from one or more leading noise edges. */
for (start = 0U; start <= (uint8_t)(bit_count - 8U); start++) {
matched = 1U;
for (i = 0U; i < 8U; i++) {
if (bits[start + i] != OWI_CaptureExpectedHeaderBit(i)) {
matched = 0U;
break;
}
}
if (matched) {
*header_end = (uint8_t)(start + 8U);
return 1U;
}
}
/* If capture was armed during the first LOW, recover using the known
suffix of the 0x26 header. At most two leading bits are reconstructed. */
for (missed = 1U; missed <= 2U; missed++) {
matched = 1U;
for (i = 0U; i < (uint8_t)(8U - missed); i++) {
if (bits[i] != OWI_CaptureExpectedHeaderBit((uint8_t)(i + missed))) {
matched = 0U;
break;
}
}
if (matched) {
*header_end = (uint8_t)(8U - missed);
return 1U;
}
}
return 0U;
}
static uint8_t OWI_CaptureGetDecodedBit(uint16_t byte_index,
uint8_t bit_index,
uint8_t * const decoded_bit)
{
uint32_t low_ticks;
if (decoded_bit == 0) {
return 0U;
}
if (g_owi_capture_pending_index < g_owi_capture_pending_count) {
*decoded_bit = g_owi_capture_pending_bits[g_owi_capture_pending_index++];
return 1U;
}
if (!OWI_CaptureWaitLowWidth(byte_index, bit_index, &low_ticks)) {
return 0U;
}
*decoded_bit = (low_ticks < g_owi_capture_threshold_ticks) ? 1U : 0U;
return 1U;
}
static uint8_t OWI_ReadByte_Captured(uint16_t byte_index)
{
uint8_t data = 0U;
int b;
uint32_t sync_widths[OWI_CAPTURE_SYNC_BITS];
if (byte_index == 0U)
{
uint8_t sync_bits[OWI_CAPTURE_SYNC_BITS];
uint8_t header_end;
uint8_t i;
for (i = 0U; i < OWI_CAPTURE_SYNC_BITS; i++)
{
g_owi_current_read_byte_index = 0U;
g_owi_current_read_bit_index = i;
if (!OWI_CaptureWaitLowWidth(0U, i, &sync_widths[i]))
{
return 0U;
}
}
g_owi_capture_threshold_ticks =
OWI_CaptureFindThreshold(sync_widths, OWI_CAPTURE_SYNC_BITS);
for (i = 0U; i < OWI_CAPTURE_SYNC_BITS; i++) {
sync_bits[i] =
(sync_widths[i] < g_owi_capture_threshold_ticks) ? 1U : 0U;
}
if (!OWI_CaptureFindHeaderEnd(sync_bits,
OWI_CAPTURE_SYNC_BITS,
&header_end)) {
if (!g_owi_timeout_latched) {
g_owi_timeout_latched = 1U;
g_owi_last_timeout_byte_index = 0U;
g_owi_last_timeout_bit_index = 0U;
}
return 0U;
}
g_owi_capture_pending_index = 0U;
g_owi_capture_pending_count =
(uint8_t)(OWI_CAPTURE_SYNC_BITS - header_end);
for (i = 0U; i < g_owi_capture_pending_count; i++) {
g_owi_capture_pending_bits[i] = sync_bits[header_end + i];
}
return 0x26U;
}
for (b = 7; b >= 0; b--)
{
uint8_t bit_index = (uint8_t)(7 - b);
uint8_t bit;
g_owi_current_read_byte_index = byte_index;
g_owi_current_read_bit_index = bit_index;
if (!OWI_CaptureGetDecodedBit(byte_index, bit_index, &bit))
{
break;
}
if (bit)
{
data |= (uint8_t)(1U << b);
}
}
return data;
}
#endif
void OWI_SecureStop(void)
{
int i;
@ -461,6 +711,7 @@ void OWI_ReadBytesRaw(int length, uint8_t id, owi_io_result_t *r)
int i;
int max_len;
uint8_t is_long_read;
uint8_t use_capture = 0u;
if (!r) return;
@ -480,13 +731,43 @@ void OWI_ReadBytesRaw(int length, uint8_t id, owi_io_result_t *r)
r->read_len = (uint16_t)length;
OWI_ClearTimeout();
/* Only 119 keeps the established mid-stream sync. */
is_long_read = (length == 119) ? 1u : 0u;
#if OWI_USE_TAU1_CAPTURE
/* Keep short connection/handshake reads on the proven GPIO path. */
use_capture = (length == 127) ? 1u : 0u;
#endif
/* GPIO fallback also resynchronizes the requested 127-byte path. */
is_long_read = (length == 119 || length == 127) ? 1u : 0u;
R_WDT_Restart();
#if OWI_USE_TAU1_CAPTURE
if (use_capture) {
OWI_CapturePrepare();
}
#endif
OWI_SecureStop();
OWI_WriteByte((uint8_t)((id << 1) | 1u));
#if OWI_USE_TAU1_CAPTURE
if (use_capture) {
/* Each rising edge captures the preceding LOW width in hardware. */
OWI_CaptureBegin();
for (i = 0; i < length; i++)
{
R_WDT_Restart();
r->data[i] = OWI_ReadByte_Captured((uint16_t)i);
if (OWI_HasTimeout())
{
owi_result_latch_timeout(r);
break;
}
}
OWI_CaptureEnd();
} else
#endif
{
/*
* For 129 bytes, wait for the first edge immediately after the read ID.
* The old 100us delay could enter an already-started first pulse.
@ -506,7 +787,7 @@ void OWI_ReadBytesRaw(int length, uint8_t id, owi_io_result_t *r)
for (i = 0; i < length; i++) {
R_WDT_Restart();
/* Preserve the existing mid-stream sync for the 119-byte path only. */
/* Preserve the existing byte-69 checkpoint for 119-byte reads only. */
if (is_long_read && i == (length - 50)) {
R_WDT_Restart();
if (!OWI_WaitForFallingEdge((uint16_t)i, 0u)) {
@ -522,6 +803,7 @@ void OWI_ReadBytesRaw(int length, uint8_t id, owi_io_result_t *r)
break;
}
}
}
OWI_StopRead();
}

10
r_cg_port.c

@ -64,8 +64,8 @@ void R_PORT_Create(void)
_40_Pn6_OUTPUT_1 | _80_Pn7_OUTPUT_1;
P6 = _00_Pn0_OUTPUT_0 | _00_Pn1_OUTPUT_0 | _00_Pn4_OUTPUT_0 | _00_Pn5_OUTPUT_0 | _00_Pn6_OUTPUT_0 |
_00_Pn7_OUTPUT_0;
P7 = _00_Pn0_OUTPUT_0 | _02_Pn1_OUTPUT_1 | _00_Pn2_OUTPUT_0 | _00_Pn3_OUTPUT_0 | _00_Pn4_OUTPUT_0 |
_00_Pn5_OUTPUT_0 | _00_Pn6_OUTPUT_0 | _00_Pn7_OUTPUT_0;
P7 = _02_Pn1_OUTPUT_1 | _00_Pn2_OUTPUT_0 | _00_Pn3_OUTPUT_0 | _00_Pn4_OUTPUT_0 | _00_Pn5_OUTPUT_0 |
_00_Pn6_OUTPUT_0 | _00_Pn7_OUTPUT_0;
P9 = _00_Pn2_OUTPUT_0 | _00_Pn3_OUTPUT_0 | _00_Pn4_OUTPUT_0 | _00_Pn5_OUTPUT_0 | _00_Pn6_OUTPUT_0 |
_00_Pn7_OUTPUT_0;
P10 = _00_Pn0_OUTPUT_0 | _00_Pn1_OUTPUT_0 | _00_Pn2_OUTPUT_0 | _00_Pn3_OUTPUT_0 | _10_Pn4_OUTPUT_1 |
@ -76,7 +76,7 @@ void R_PORT_Create(void)
_20_Pn5_OUTPUT_1 | _40_Pn6_OUTPUT_1 | _80_Pn7_OUTPUT_1;
POM6 = _04_POMn2_NCH_ON | _08_POMn3_NCH_ON;
POM7 = _01_POMn0_NCH_ON;
PMC7 = _00_PMCn0_DI_ON | _00_PMCn1_DI_ON | _00_PMCn2_DI_ON | _00_PMCn3_DI_ON | _00_PMCn4_DI_ON | _E0_PMC7_DEFAULT;
PMC7 = _01_PMCn0_NOT_USE | _00_PMCn1_DI_ON | _00_PMCn2_DI_ON | _00_PMCn3_DI_ON | _00_PMCn4_DI_ON | _E0_PMC7_DEFAULT;
PMC12 = _00_PMCn0_DI_ON | _00_PMCn5_DI_ON | _DE_PMC12_DEFAULT;
PSRSEL = _00_PSR14_NORMAL | _00_PSR120_NORMAL | _00_PSR30_NORMAL | _00_PSR10_NORMAL;
ADPC = _04_ADPC_DI_ON;
@ -91,8 +91,8 @@ void R_PORT_Create(void)
_00_PMn5_MODE_OUTPUT | _00_PMn6_MODE_OUTPUT | _00_PMn7_MODE_OUTPUT;
PM6 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _04_PMn2_NOT_USE | _08_PMn3_NOT_USE | _00_PMn4_MODE_OUTPUT |
_00_PMn5_MODE_OUTPUT | _00_PMn6_MODE_OUTPUT | _00_PMn7_MODE_OUTPUT;
PM7 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _00_PMn2_MODE_OUTPUT | _00_PMn3_MODE_OUTPUT |
_00_PMn4_MODE_OUTPUT | _00_PMn5_MODE_OUTPUT | _00_PMn6_MODE_OUTPUT | _00_PMn7_MODE_OUTPUT;
PM7 = _01_PMn0_NOT_USE | _00_PMn1_MODE_OUTPUT | _00_PMn2_MODE_OUTPUT | _00_PMn3_MODE_OUTPUT | _00_PMn4_MODE_OUTPUT |
_00_PMn5_MODE_OUTPUT | _00_PMn6_MODE_OUTPUT | _00_PMn7_MODE_OUTPUT;
PM8 = _01_PMn0_NOT_USE | _02_PMn1_MODE_INPUT | _04_PMn2_MODE_INPUT | _08_PMn3_MODE_INPUT | _10_PMn4_MODE_INPUT |
_20_PMn5_MODE_INPUT | _40_PMn6_NOT_USE | _80_PMn7_NOT_USE;
PM9 = _01_PMn0_NOT_USE | _02_PMn1_NOT_USE | _00_PMn2_MODE_OUTPUT | _00_PMn3_MODE_OUTPUT | _00_PMn4_MODE_OUTPUT |

157
r_cg_timer.c

@ -0,0 +1,157 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_timer.c
* Version : CodeGenerator for RL78/F14 V2.03.07.02 [08 Nov 2021]
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2026-08-03
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_timer.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* For TAU1_ch5 pulse measurement */
extern volatile uint32_t g_tau1_ch5_width;
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_TAU1_Create
* Description : This function initializes the TAU1 module.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU1_Create(void)
{
TAU1EN = 1U; /* supplies input clock */
TPS1 = _0000_TAU_CKM0_FCLK_0 | _0000_TAU_CKM1_FCLK_0 | _0000_TAU_CKM2_FCLK_0 | _0000_TAU_CKM3_FCLK_0;
/* Stop all channels */
TT1 = _0001_TAU_CH0_STOP_TRG_ON | _0002_TAU_CH1_STOP_TRG_ON | _0004_TAU_CH2_STOP_TRG_ON |
_0008_TAU_CH3_STOP_TRG_ON | _0010_TAU_CH4_STOP_TRG_ON | _0020_TAU_CH5_STOP_TRG_ON |
_0040_TAU_CH6_STOP_TRG_ON | _0080_TAU_CH7_STOP_TRG_ON | _0200_TAU_CH1_H8_STOP_TRG_ON |
_0800_TAU_CH3_H8_STOP_TRG_ON;
PWMDLY2 = _0000_TAU_PWM_DELAY_CLEAR; /* clear PWM output delay */
/* Mask channel 0 interrupt */
TMMK10 = 1U; /* disable INTTM10 interrupt */
TMIF10 = 0U; /* clear INTTM10 interrupt flag */
/* Mask channel 1 interrupt */
TMMK11 = 1U; /* disable INTTM11 interrupt */
TMIF11 = 0U; /* clear INTTM11 interrupt flag */
/* Mask channel 1 higher 8 bits interrupt */
TMMK11H = 1U; /* disable INTTM11H interrupt */
TMIF11H = 0U; /* clear INTTM11H interrupt flag */
/* Mask channel 2 interrupt */
TMMK12 = 1U; /* disable INTTM12 interrupt */
TMIF12 = 0U; /* clear INTTM12 interrupt flag */
/* Mask channel 3 interrupt */
TMMK13 = 1U; /* disable INTTM13 interrupt */
TMIF13 = 0U; /* clear INTTM13 interrupt flag */
/* Mask channel 3 higher 8 bits interrupt */
TMMK13H = 1U; /* disable INTTM13H interrupt */
TMIF13H = 0U; /* clear INTTM13H interrupt flag */
/* Mask channel 4 interrupt */
TMMK14 = 1U; /* disable INTTM14 interrupt */
TMIF14 = 0U; /* clear INTTM14 interrupt flag */
/* Mask channel 5 interrupt */
TMMK15 = 1U; /* disable INTTM15 interrupt */
TMIF15 = 0U; /* clear INTTM15 interrupt flag */
/* Mask channel 6 interrupt */
TMMK16 = 1U; /* disable INTTM16 interrupt */
TMIF16 = 0U; /* clear INTTM16 interrupt flag */
/* Mask channel 7 interrupt */
TMMK17 = 1U; /* disable INTTM17 interrupt */
TMIF17 = 0U; /* clear INTTM17 interrupt flag */
/* Set INTTM15 low priority */
TMPR115 = 1U;
TMPR015 = 1U;
/* Channel 5 is used to measure input pulse interval */
TMR15 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE |
_0100_TAU_TRIGGER_TIMN_VALID | _0080_TAU_TIMN_EDGE_BOTH_LOW | _0004_TAU_MODE_CAPTURE |
_0000_TAU_START_INT_UNUSED;
TOM1 &= ~_0020_TAU_CH5_OUTPUT_COMBIN;
TOL1 &= ~_0020_TAU_CH5_OUTPUT_LEVEL_L;
TO1 &= ~_0020_TAU_CH5_OUTPUT_VALUE_1;
TOE1 &= ~_0020_TAU_CH5_OUTPUT_ENABLE;
NFEN2 &= (uint8_t)~_20_TAU_CH5_NOISE_ON; /* disable using noise filter of TI15 pin input signal */
/* Set TI15 pin */
PIM7 &= 0xFEU;
PMC7 &= 0xFEU;
PM7 |= 0x01U;
}
/***********************************************************************************************************************
* Function Name: R_TAU1_Channel5_Start
* Description : This function starts TAU1 channel 5 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU1_Channel5_Start(void)
{
TMIF15 = 0U; /* clear INTTM15 interrupt flag */
TMMK15 = 0U; /* enable INTTM15 interrupt */
TS1 |= _0020_TAU_CH5_START_TRG_ON;
}
/***********************************************************************************************************************
* Function Name: R_TAU1_Channel5_Stop
* Description : This function stops TAU1 channel 5 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU1_Channel5_Stop(void)
{
TT1 |= _0020_TAU_CH5_STOP_TRG_ON;
/* Mask channel 5 interrupt */
TMMK15 = 1U; /* disable INTTM15 interrupt */
TMIF15 = 0U; /* clear INTTM15 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_TAU1_Channel5_Get_PulseWidth
* Description : This function measures TAU1 channel 5 input pulse width.
* Arguments : width -
* the address where to write the input pulse width
* Return Value : None
***********************************************************************************************************************/
void R_TAU1_Channel5_Get_PulseWidth(uint32_t * const width)
{
/* For channel 5 pulse measurement */
*width = g_tau1_ch5_width;
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

1048
r_cg_timer.h

File diff suppressed because it is too large

133
r_cg_timer_user.c

@ -0,0 +1,133 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_timer_user.c
* Version : CodeGenerator for RL78/F14 V2.03.07.02 [08 Nov 2021]
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2026-08-03
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_timer.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
#pragma interrupt r_tau1_channel5_interrupt(vect=INTTM15)
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* For TAU1_ch5 pulse measurement */
volatile uint32_t g_tau1_ch5_width = 0UL;
/* Start user code for global. Do not edit comment generated here */
#define TAU1_CH5_CAPTURE_QUEUE_SIZE (16U)
#define TAU1_CH5_CAPTURE_QUEUE_MASK (TAU1_CH5_CAPTURE_QUEUE_SIZE - 1U)
static volatile uint32_t g_tau1_ch5_low_ticks[TAU1_CH5_CAPTURE_QUEUE_SIZE];
static volatile uint8_t g_tau1_ch5_capture_head = 0U;
static volatile uint8_t g_tau1_ch5_capture_tail = 0U;
static volatile uint8_t g_tau1_ch5_capture_overflow = 0U;
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_tau1_channel5_interrupt
* Description : This function is INTTM15 interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_tau1_channel5_interrupt(void)
{
if ((TSR15 & _0001_TAU_OVERFLOW_OCCURS) == 1U) /* overflow occurs */
{
g_tau1_ch5_width = (uint32_t)(TDR15 + 1U) + 0x10000U;
}
else
{
g_tau1_ch5_width = (uint32_t)(TDR15 + 1U);
}
/* Start user code. Do not edit comment generated here */
/* A rising edge ends a LOW pulse. Queue only LOW widths for the OWI decoder. */
if ((P7 & 0x01U) != 0U)
{
uint8_t next = (uint8_t)((g_tau1_ch5_capture_head + 1U) & TAU1_CH5_CAPTURE_QUEUE_MASK);
if (next != g_tau1_ch5_capture_tail)
{
g_tau1_ch5_low_ticks[g_tau1_ch5_capture_head] = g_tau1_ch5_width;
g_tau1_ch5_capture_head = next;
}
else
{
g_tau1_ch5_capture_overflow = 1U;
}
}
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
void R_TAU1_Channel5_CaptureReset(void)
{
DI();
g_tau1_ch5_capture_head = 0U;
g_tau1_ch5_capture_tail = 0U;
g_tau1_ch5_capture_overflow = 0U;
g_tau1_ch5_width = 0UL;
EI();
}
uint8_t R_TAU1_Channel5_GetLowWidthTicks(uint32_t * const ticks)
{
uint8_t available = 0U;
if (ticks == 0)
{
return 0U;
}
DI();
if (g_tau1_ch5_capture_tail != g_tau1_ch5_capture_head)
{
*ticks = g_tau1_ch5_low_ticks[g_tau1_ch5_capture_tail];
g_tau1_ch5_capture_tail =
(uint8_t)((g_tau1_ch5_capture_tail + 1U) & TAU1_CH5_CAPTURE_QUEUE_MASK);
available = 1U;
}
EI();
return available;
}
uint8_t R_TAU1_Channel5_CaptureOverflowed(void)
{
return g_tau1_ch5_capture_overflow;
}
/* End user code. Do not edit comment generated here */

79
r_main.c

@ -23,7 +23,7 @@
* Device(s) : R5F10PPJ
* Tool-Chain : CCRL
* Description : This file implements main function.
* Creation Date: 2026-04-08
* Creation Date: 2026-08-03
***********************************************************************************************************************/
/***********************************************************************************************************************
@ -33,6 +33,7 @@ Includes
#include "r_cg_cgc.h"
#include "r_cg_port.h"
#include "r_cg_serial.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
#include "common.h"
@ -60,7 +61,38 @@ Pragma directive
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
static void App_Main(void);
static void App_UserInit(void);
/* End user code. Do not edit comment generated here */
void R_MAIN_UserInit(void);
/***********************************************************************************************************************
* Function Name: main
* Description : This function implements main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void main(void)
{
R_MAIN_UserInit();
/* Start user code. Do not edit comment generated here */
App_Main();
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
* Function Name: R_MAIN_UserInit
* Description : This function adds user code before implementing main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_MAIN_UserInit(void)
{
/* Start user code. Do not edit comment generated here */
App_UserInit();
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* =========================
* Config
@ -69,8 +101,8 @@ Global variables and functions
#define UART_RX_BUF_SIZE 1024
#define RS485_BRIDGE_FIFO_SZ 2048
#define BRIDGE_IDLE_DONE_US 2500000U /* sweep �� ���� ���� ���� �ִ� ������ ��� �ð� */
#define BRIDGE_TOTAL_WAIT_US 30000000U /* sweep ��ü �긮�� �ִ� ��� �ð� */
#define BRIDGE_IDLE_DONE_US 2500000U /* sweep 占쏙옙 占쏙옙占쏙옙 占쏙옙占쏙옙 占쏙옙占쏙옙 占쌍댐옙 占쏙옙占쏙옙占쏙옙 占쏙옙占?占시곤옙 */
#define BRIDGE_TOTAL_WAIT_US 30000000U /* sweep 占쏙옙체 占쎄리占쏙옙 占쌍댐옙 占쏙옙占?占시곤옙 */
#define OWI_LONG_READ_SETTLE_US 30000U
#define OWI_LONG_READ_RETRY_US 10000U
@ -205,7 +237,7 @@ static void rs485_abort_and_reset_pipeline(void)
/* ���� job �ߴ� */
app_runtime_reset();
/* ��� queue ���� */
/* 占쏙옙占?queue 占쏙옙占쏙옙 */
app_scheduler_clear();
/* UART0 recover ��û */
@ -282,7 +314,6 @@ static void UART1_SendBytes_Safe(const uint8_t *data, uint16_t len)
}
static void UART1_SendString_Safe(const char *s)
{
uint16_t len;
@ -590,7 +621,7 @@ static void scan_one_addr_rs485(uint8_t addr)
RS485_FlushJunk(2, 100);
for (try = 0; try < 1; try++) { /* ��õ��� �켱 1ȸ�� ���̱� */
for (try = 0; try < 1; try++) { /* 占쏙옙천占쏙옙占?占쎌선 1회占쏙옙 占쏙옙占싱깍옙 */
uint32_t total_wait_us;
char linebuf[320];
@ -827,7 +858,7 @@ static int run_connect_verify_one_channel(const app_job_t *job, uint8_t ch)
for (attempt = 0; attempt < 2; attempt++) {
/* ��õ� �� OFF ó�� */
/* 占쏙옙천占?占쏙옙 OFF 처占쏙옙 */
if (attempt > 0) {
Cal_Init();
}
@ -899,7 +930,7 @@ static int execute_connect_verify_sequence(CmdSource src, const app_job_t *job)
- id = 0x28
- len = 6
- payload[0..2] = ù write 3Ʈ
- payload[3..5] = 3Ʈ
- payload[3..5] = ?3
*/
if (job->type != APP_JOB_PROTO_OW) return 0;
if (job->proto != APP_PROTO_OWIT) return 0;
@ -1122,7 +1153,7 @@ static int execute_write_coeff_sequence(CmdSource src, const app_job_t *job)
return 1;
}
/* NVM read ���� ù ����Ʈ�� 0x26 �̾�� ���� */
/* NVM read 占쏙옙占쏙옙 첫 占쏙옙占쏙옙트占쏙옙 0x26 占싱억옙占?占쏙옙占쏙옙 */
if (r_read2.data[0] != 0x26u) {
OUT_PRINT(src, "Fail\r\n");
send_end_response(src);
@ -1207,7 +1238,7 @@ static int execute_shadow_write_copy_nvm_sequence(CmdSource src, const app_job_t
GateCtrl_SelectChannel(job->channel);
//delay_us(30000);
/* ������ 2����Ʈ�� GUI CRC�� ��� */
/* 占쏙옙占쏙옙占쏙옙 2占쏙옙占쏙옙트占쏙옙 GUI CRC占쏙옙 占쏙옙占?*/
gui_crc = &job->payload[119];
/* 1) ow28119230039 + data + crc */
@ -1676,7 +1707,7 @@ static int execute_owi_service_from_line(CmdSource src, const char *line)
return 0;
}
/* �ڱ� �ּҰ� �ƴϸ� ���� ��η� �ѱ� */
/* 占쌘깍옙 占쌍소곤옙 占싣니몌옙 占쏙옙占쏙옙 占쏙옙管占?占싼깍옙 */
if (addr != g_fixed_addr) {
return 0;
}
@ -1720,7 +1751,7 @@ static int execute_owi_service_from_line(CmdSource src, const char *line)
proto = detect_protocol(h0, h1);
if (proto != PROTOCOL_OWIW && proto != PROTOCOL_OWIR) {
return 0; /* I2C ���� ���� ��� fallback */
return 0; /* I2C 占쏙옙占쏙옙 占쏙옙占쏙옙 占쏙옙占?fallback */
}
}
@ -1916,7 +1947,7 @@ static void process_one_line_now(CmdSource src, const char *input_line)
}
/* ������(addr 0)�� PC���� ���� ���� OFF��
RS485 Լ */
RS485 ?*/
if (g_fixed_addr == 0 && src == CMD_SRC_PC) {
forward_line_rs485_and_bridge(line);
return;
@ -1963,7 +1994,7 @@ static void process_one_line_now(CmdSource src, const char *input_line)
/* addr mismatch */
if (addr != g_fixed_addr)
{
/* 0�� ����(PC ���� ������)�� �״�� RS485�� ������ */
/* 0占쏙옙 占쏙옙占쏙옙(PC 占쏙옙占쏙옙 占쏙옙占쏙옙占쏙옙)占쏙옙 占쌓댐옙占?RS485占쏙옙 占쏙옙占쏙옙占쏙옙 */
if (g_fixed_addr == 0 && src == CMD_SRC_PC)
{
forward_line_rs485_and_bridge(orig_line);
@ -2083,7 +2114,7 @@ static void process_one_line(CmdSource src, const volatile uint8_t *rx_buf, uint
idx = build_line_from_rx(rx_buf, (int)rx_len, line, (int)sizeof(line));
if (idx <= 0) return;
/* RS485 xNNv�� ť�� Ÿ�� ���� ��� ���� */
/* RS485 xNNv占쏙옙 큐占쏙옙 타占쏙옙 占쏙옙占쏙옙 占쏙옙占?占쏙옙占쏙옙 */
if (src == CMD_SRC_RS485) {
uint8_t vaddr = 0;
@ -2181,14 +2212,14 @@ static void app_job_tick(void)
return;
}
/* �����Ͱ� PC ����� ���� ����� forwarding */
/* 占쏙옙占쏙옙占싶곤옙 PC 占쏙옙占쏙옙占?占쏙옙占쏙옙 占쏙옙占쏙옙占?forwarding */
if (g_fixed_addr == 0 && src == CMD_SRC_PC && g_app_runtime_job.job.addr != 0) {
forward_line_rs485_and_bridge(g_app_runtime_job.job.line);
app_runtime_reset();
return;
}
/* �����̺갡 RS485���� ���� ���� ����� ���� */
/* 占쏙옙占쏙옙占싱브가 RS485占쏙옙占쏙옙 占쏙옙占쏙옙 占쏙옙占쏙옙 占쏙옙占쏙옙占?占쏙옙占쏙옙 */
if (src == CMD_SRC_RS485) {
app_runtime_reset();
return;
@ -2282,11 +2313,8 @@ void handle_uart_command_line(void)
/* =========================
* Renesas entrypoints
* ========================= */
void R_MAIN_UserInit(void);
void main(void)
static void App_Main(void)
{
R_MAIN_UserInit();
R_WDT_Create();
R_WDT_Restart();
@ -2316,16 +2344,15 @@ void R_MAIN_UserInit(void);
while (1U) { ; }
}
void R_MAIN_UserInit(void)
static void App_UserInit(void)
{
/* Start user code. Do not edit comment generated here */
EI();
EI();
R_PORT_Create();
rs485_init();
DipSwitch_Init();
g_fixed_addr = DipSwitch_ReadAddr_0to31();
/* End user code. Do not edit comment generated here */
}
/* End user code. Do not edit comment generated here */

2
r_systeminit.c

@ -33,6 +33,7 @@ Includes
#include "r_cg_cgc.h"
#include "r_cg_port.h"
#include "r_cg_serial.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
@ -74,6 +75,7 @@ void R_Systeminit(void)
R_SAU0_Create();
R_SAU1_Create();
R_IICA0_Create();
R_TAU1_Create();
R_WDT_Create();
/* Set invalid memory access detection control */

Loading…
Cancel
Save