Skip to content

Commit 0b3f025

Browse files
authored
Merge pull request #9 from uv-software/development
Release Candidate 1 for Version 0.4.5
2 parents 501c6e6 + 301e1d7 commit 0b3f025

File tree

113 files changed

+34545
-1324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+34545
-1324
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ Utilities/can_test/Debug
4343
Utilities/can_test/Release
4444
Utilities/can_test/*.sln
4545
Utilities/can_test/*.vcxproj.user
46+
Tests/.vs
47+
Tests/x64
48+
Tests/x86
49+
Tests/Debug
50+
Tests/Release
51+
Tests/*.sln
52+
Tests/*.vcxproj.user
53+
Tests/TestSpecs
4654
PeakCANBasic-cppcheck-build-dir
4755
artifacts
4856
Binaries

Deployment.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
### Wrapper Library for PEAK PCAN® Interfaces (Windows®)
1+
### CAN API V3 Wrapper Library for PEAK PCAN® Interfaces (Windows®)
22

3-
_Copyright © 2005-2022 Uwe Vogt, UV Software, Berlin ([email protected])_
3+
_Copyright © 2005-2023 Uwe Vogt, UV Software, Berlin ([email protected])_ \
44
_All rights reserved._
55

66
# Deployment
77

8-
## Release Candidate
8+
## Create the Release Candidate
99

1010
### Precondition
1111

1212
- **_All changes are made exclusively on a feature branch!_**
1313

1414
### Preparation
1515

16-
1. Update the CAN API V3 sources in `$(PROJROOT)\Sources\CANAPI` from SVN repo
16+
1. Update the PCANBasic DLL in `$(PROJROOT)\Sources\PCANBasic` from PEAK�s website
17+
when required and commit them with commit comment:
18+
- `Update PEAK's PCANBasic DLL (version `_n_`.`_n_`.`_n_`)` \
19+
`- `_list of major changes (optional)_
20+
2. Update the CAN API V3 sources in `$(PROJROOT)\Sources\CANAPI` from SVN repo
1721
when required and commit them with commit comment:
1822
- `Update CAN API V3 sources to rev. `_nnn_ \
1923
`- `_list of major changes (optional)_
20-
2. Update the PCANBasic DLL in `$(PROJROOT)\Sources\PCANBasic` from PEAK´s website
24+
3. Update the CAN API V3 testing sources in `$(PROJROOT)\Tests` from SVN repo
2125
when required and commit them with commit comment:
22-
- `Update PEAK´s PCANBasic DLL (version `_n_`.`_nn_`)` \
26+
- `Update CAN API V3 testing sources to rev. `_nnn_ \
2327
`- `_list of major changes (optional)_
24-
2. Check and update the version and date information in the following files:
28+
4. Check and update the version and date information in the following files:
2529
- `$(PROJROOT)\Sources\PeakCAN.h`
2630
- `$(PROJROOT)\Sources\PeakCAN.cpp`
2731
- `$(PROJROOT)\Sources\Wrapper\can_api.cpp`
@@ -38,7 +42,7 @@ _All rights reserved._
3842
2. Open the trial program with Visual Studio and run a code analysis.
3943
- _**There should not be any serious finding.**_
4044
- _If there are findings then fix them or create an issue in the repo._
41-
3. Run `build_86.bat` and `build_64.bat` in the project root directory.
45+
3. Run `x86_build.bat` and `x64_build.bat` in the project root directory.
4246
- _**There should be absolute no compiler or linker error!**_
4347
- _If there are compiler or linker warnings then think twice._
4448
4. Try out the trial program with different options.
@@ -47,46 +51,42 @@ _All rights reserved._
4751
5. Try out the utilities with different options.
4852
- _**There should be no crash, hangup, or any other error.**_
4953
- _If there is an error then fix it or create an issue in the repo._
50-
6. Build and try out the examples (repair them when necessary);
54+
6. Build and try out the examples (repair them if necessary);
5155
- `$(PROJROOT)\Examples\C++`
5256
- `$(PROJROOT)\Examples\Python`
5357

5458
### Pull Request
5559

5660
1. Update the `README.md` (e.g. development environment, supported devices, etc.).
5761
2. Push the feature branch onto the remote repo.
58-
3. Create a pull request and name it somehow like '**Release Candidate #**_n_'.
62+
3. Create a pull request and name it somehow like '**Release Candidate _n_ for** ...'.
5963
4. Review the changes and merge the feature branch into the default branch.
6064

61-
## Release Tag
65+
## Create the Release Tag
6266

6367
### Preparation
6468

6569
1. Pull or clone the default branch on all development systems.
6670
2. Double check all version numbers again (see above).
67-
3. Run the batch file in the project root directory:
71+
3. Run the batch files in the project root directory:
6872
- `C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN`
69-
- `C:\Projects\CAN\Drivers\PeakCAN>build_86.bat`
70-
- `C:\Projects\CAN\Drivers\PeakCAN>build_64.bat`
71-
- `C:\Projects\CAN\Drivers\PeakCAN>install_86.bat`
72-
- `C:\Projects\CAN\Drivers\PeakCAN>install_64.bat`
73-
4. Update and build the CAN API V3 Loader Library:
74-
- `C:\Users\haumea>cd C:\Projects\CAN\Library`
75-
- `C:\Projects\CAN\Library>build_86.bat`
76-
- `C:\Projects\CAN\Library>install_86.bat`
77-
5. Update and build the CAN API V3 GoogleTest:
78-
- `C:\Users\haumea>cd C:\Projects\CAN\Library\Testing\Windows`
79-
- `C:\Projects\CAN\Library\Testing\Windows>build_86.bat`
80-
6. Run the CAN API V3 GoogleTest with two PCAN-USB device:
81-
- `C:\Projects\CAN\Library\Testing\Windows>Debug\can_testing --can_path=C:\Projects\CAN\API\json --can_dut1=PCAN-USB1 --can_dut2=PCAN-USB2 --gtest_output=xml:TestReport_PCAN-USB.xml --gtest_filter=-SmokeTest.* --sunnyday_traffic=2048` [...]
73+
- `C:\Projects\CAN\Drivers\PeakCAN>x86_build.bat`
74+
- `C:\Projects\CAN\Drivers\PeakCAN>x64_build.bat`
75+
- `C:\Projects\CAN\Drivers\PeakCAN>x86_install.bat`
76+
- `C:\Projects\CAN\Drivers\PeakCAN>x64_install.bat`
77+
4. Build the CAN API V3 GoogleTest program:
78+
- `C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN\Tests`
79+
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>x86_build.bat`
80+
5. Run the CAN API V3 GoogleTest with two PCAN-USB device:
81+
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>Debug\pcb_testing --can_dut1=PCAN-USB1 --can_dut2=PCAN-USB2 --gtest_output=xml:TestReport_PCAN-USB.xml --run_all=YES --smoketest_frames=100000` [...]
8282
- _If there is any error then **stop** here or create an issue for each error in the repo._
8383
- Copy the test report into the binaries directory `$(PROJROOT)\Binaries`.
8484
6. Run the CAN API V3 GoogleTest with two PCAN-USB FD device:
85-
- `C:\Projects\CAN\Library\Testing\Windows>Debug\can_testing --can_path=C:\Projects\CAN\API\json --can_dut1=PCAN-USB3 --can_dut2=PCAN-USB4 --gtest_output=xml:TestReport_PCAN-USB_FD.xml --gtest_filter=-SmokeTest.* --sunnyday_traffic=2048` [...]
85+
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>Debug\pcb_testing --can_dut1=PCAN-USB3 --can_dut2=PCAN-USB4 --gtest_output=xml:TestReport_PCAN-USB_FD.xml --run_all=YES --smoketest_frames=100000` [...]
8686
- _If there is any error then **stop** here or create an issue for each error in the repo._
8787
- Copy the test report into the binaries directory `$(PROJROOT)\Binaries`.
88-
6. Run the CAN API V3 GoogleTest with the dual-channel PCAN-USB Pro FDdevice:
89-
- `C:\Projects\CAN\Library\Testing\Windows>Debug\can_testing --can_path=C:\Projects\CAN\API\json --can_dut1=PCAN-USB5 --can_dut2=PCAN-USB6 --gtest_output=xml:TestReport_PCAN-USB_Pro_FD.xml --gtest_filter=-SmokeTest.* --sunnyday_traffic=2048` [...]
88+
6. Run the CAN API V3 GoogleTest with the dual-channel PCAN-USB Pro FD device:
89+
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>Debug\pcb_testing --can_dut1=PCAN-USB5 --can_dut2=PCAN-USB6 --gtest_output=xml:TestReport_PCAN-USB_Pro_FD.xml --run_all=YES --smoketest_frames=100000` [...]
9090
- _If there is any error then **stop** here or create an issue for each error in the repo._
9191
- Copy the test report into the binaries directory `$(PROJROOT)\Binaries`.
9292
7. Pack the artifacts into a .zip-archive, e.g. `artifacts.zip`:
@@ -100,13 +100,13 @@ _All rights reserved._
100100

101101
1. Click on `Draft a new release` in the [GitHub](https://github.com/uv-software/PeakCAN-Wrapper) repo.
102102
2. Fill out all required fields:
103-
- Tag version: e.g `v0.2.1` (cf. semantic versioning)
103+
- Tag version: e.g `v0.4.5` (cf. semantic versioning)
104104
- Target: `main` (default branch)
105-
- Release title: e.g. `Release of June 3, 2021`
105+
- Release title: e.g. `Release of August 25, 2023`
106106
- Change-log: list all major changes, e.g. from commit comments
107107
- Assets: drag and drop the artifacts archive (see above)
108108
3. Click on `Publish release`.
109-
4. That´s all folks!
109+
4. Thats all folks!
110110

111111
### Announcement
112112

Libraries/CANAPI/Resource.rc

-2 Bytes
Binary file not shown.

Libraries/CANAPI/uvcanpcb.vcxproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,52 +44,52 @@
4444
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|Win32'" Label="Configuration">
4545
<ConfigurationType>DynamicLibrary</ConfigurationType>
4646
<UseDebugLibraries>true</UseDebugLibraries>
47-
<PlatformToolset>v142</PlatformToolset>
47+
<PlatformToolset>v143</PlatformToolset>
4848
<CharacterSet>Unicode</CharacterSet>
4949
</PropertyGroup>
5050
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_lib|Win32'" Label="Configuration">
5151
<ConfigurationType>StaticLibrary</ConfigurationType>
5252
<UseDebugLibraries>true</UseDebugLibraries>
53-
<PlatformToolset>v142</PlatformToolset>
53+
<PlatformToolset>v143</PlatformToolset>
5454
<CharacterSet>Unicode</CharacterSet>
5555
</PropertyGroup>
5656
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|Win32'" Label="Configuration">
5757
<ConfigurationType>DynamicLibrary</ConfigurationType>
5858
<UseDebugLibraries>false</UseDebugLibraries>
59-
<PlatformToolset>v142</PlatformToolset>
59+
<PlatformToolset>v143</PlatformToolset>
6060
<WholeProgramOptimization>true</WholeProgramOptimization>
6161
<CharacterSet>Unicode</CharacterSet>
6262
</PropertyGroup>
6363
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|Win32'" Label="Configuration">
6464
<ConfigurationType>StaticLibrary</ConfigurationType>
6565
<UseDebugLibraries>false</UseDebugLibraries>
66-
<PlatformToolset>v142</PlatformToolset>
66+
<PlatformToolset>v143</PlatformToolset>
6767
<WholeProgramOptimization>true</WholeProgramOptimization>
6868
<CharacterSet>Unicode</CharacterSet>
6969
</PropertyGroup>
7070
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|x64'" Label="Configuration">
7171
<ConfigurationType>DynamicLibrary</ConfigurationType>
7272
<UseDebugLibraries>true</UseDebugLibraries>
73-
<PlatformToolset>v142</PlatformToolset>
73+
<PlatformToolset>v143</PlatformToolset>
7474
<CharacterSet>Unicode</CharacterSet>
7575
</PropertyGroup>
7676
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_lib|x64'" Label="Configuration">
7777
<ConfigurationType>StaticLibrary</ConfigurationType>
7878
<UseDebugLibraries>true</UseDebugLibraries>
79-
<PlatformToolset>v142</PlatformToolset>
79+
<PlatformToolset>v143</PlatformToolset>
8080
<CharacterSet>Unicode</CharacterSet>
8181
</PropertyGroup>
8282
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|x64'" Label="Configuration">
8383
<ConfigurationType>DynamicLibrary</ConfigurationType>
8484
<UseDebugLibraries>false</UseDebugLibraries>
85-
<PlatformToolset>v142</PlatformToolset>
85+
<PlatformToolset>v143</PlatformToolset>
8686
<WholeProgramOptimization>true</WholeProgramOptimization>
8787
<CharacterSet>Unicode</CharacterSet>
8888
</PropertyGroup>
8989
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|x64'" Label="Configuration">
9090
<ConfigurationType>StaticLibrary</ConfigurationType>
9191
<UseDebugLibraries>false</UseDebugLibraries>
92-
<PlatformToolset>v142</PlatformToolset>
92+
<PlatformToolset>v143</PlatformToolset>
9393
<WholeProgramOptimization>true</WholeProgramOptimization>
9494
<CharacterSet>Unicode</CharacterSet>
9595
</PropertyGroup>
@@ -366,4 +366,4 @@
366366
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
367367
<ImportGroup Label="ExtensionTargets">
368368
</ImportGroup>
369-
</Project>
369+
</Project>

Libraries/PeakCAN/PeakCAN.vcxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,52 +44,52 @@
4444
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|Win32'" Label="Configuration">
4545
<ConfigurationType>DynamicLibrary</ConfigurationType>
4646
<UseDebugLibraries>true</UseDebugLibraries>
47-
<PlatformToolset>v142</PlatformToolset>
47+
<PlatformToolset>v143</PlatformToolset>
4848
<CharacterSet>Unicode</CharacterSet>
4949
</PropertyGroup>
5050
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_lib|Win32'" Label="Configuration">
5151
<ConfigurationType>StaticLibrary</ConfigurationType>
5252
<UseDebugLibraries>true</UseDebugLibraries>
53-
<PlatformToolset>v142</PlatformToolset>
53+
<PlatformToolset>v143</PlatformToolset>
5454
<CharacterSet>Unicode</CharacterSet>
5555
</PropertyGroup>
5656
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|Win32'" Label="Configuration">
5757
<ConfigurationType>DynamicLibrary</ConfigurationType>
5858
<UseDebugLibraries>false</UseDebugLibraries>
59-
<PlatformToolset>v142</PlatformToolset>
59+
<PlatformToolset>v143</PlatformToolset>
6060
<WholeProgramOptimization>true</WholeProgramOptimization>
6161
<CharacterSet>Unicode</CharacterSet>
6262
</PropertyGroup>
6363
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|Win32'" Label="Configuration">
6464
<ConfigurationType>StaticLibrary</ConfigurationType>
6565
<UseDebugLibraries>false</UseDebugLibraries>
66-
<PlatformToolset>v142</PlatformToolset>
66+
<PlatformToolset>v143</PlatformToolset>
6767
<WholeProgramOptimization>true</WholeProgramOptimization>
6868
<CharacterSet>Unicode</CharacterSet>
6969
</PropertyGroup>
7070
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|x64'" Label="Configuration">
7171
<ConfigurationType>DynamicLibrary</ConfigurationType>
7272
<UseDebugLibraries>true</UseDebugLibraries>
73-
<PlatformToolset>v142</PlatformToolset>
73+
<PlatformToolset>v143</PlatformToolset>
7474
<CharacterSet>Unicode</CharacterSet>
7575
</PropertyGroup>
7676
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_lib|x64'" Label="Configuration">
7777
<ConfigurationType>StaticLibrary</ConfigurationType>
7878
<UseDebugLibraries>true</UseDebugLibraries>
79-
<PlatformToolset>v142</PlatformToolset>
79+
<PlatformToolset>v143</PlatformToolset>
8080
<CharacterSet>Unicode</CharacterSet>
8181
</PropertyGroup>
8282
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|x64'" Label="Configuration">
8383
<ConfigurationType>DynamicLibrary</ConfigurationType>
8484
<UseDebugLibraries>false</UseDebugLibraries>
85-
<PlatformToolset>v142</PlatformToolset>
85+
<PlatformToolset>v143</PlatformToolset>
8686
<WholeProgramOptimization>true</WholeProgramOptimization>
8787
<CharacterSet>Unicode</CharacterSet>
8888
</PropertyGroup>
8989
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|x64'" Label="Configuration">
9090
<ConfigurationType>StaticLibrary</ConfigurationType>
9191
<UseDebugLibraries>false</UseDebugLibraries>
92-
<PlatformToolset>v142</PlatformToolset>
92+
<PlatformToolset>v143</PlatformToolset>
9393
<WholeProgramOptimization>true</WholeProgramOptimization>
9494
<CharacterSet>Unicode</CharacterSet>
9595
</PropertyGroup>

Libraries/PeakCAN/Resource.rc

-2 Bytes
Binary file not shown.

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### CAN API V3 Wrapper Library for Peak-System PCAN&reg; Interfaces (Windows&reg;)
22

3-
_Copyright &copy; 2005-2022 Uwe Vogt, UV Software, Berlin ([email protected])_
3+
_Copyright &copy; 2005-2023 Uwe Vogt, UV Software, Berlin ([email protected])_
44

55
# CAN API V3 for PCAN Interfaces
66

@@ -75,16 +75,16 @@ C:\Projects\CAN\Drivers\PeakCAN>build_no.bat
7575
```
7676
Repeat this step after each `git commit`, `git pull`, `git clone`, etc.
7777
78-
To build all 32-bit targets (x86) run the script `build_86.bat`.
78+
To build all 32-bit targets (x86) run the script `x86_build.bat`.
7979
```
8080
C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN
81-
C:\Projects\CAN\Drivers\PeakCAN>build_86.bat
81+
C:\Projects\CAN\Drivers\PeakCAN>x86_build.bat
8282
```
8383
84-
To build all 64-bit targets (x64) run the script `build_86.bat`.
84+
To build all 64-bit targets (x64) run the script `x64_build.bat`.
8585
```
8686
C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN
87-
C:\Projects\CAN\Drivers\PeakCAN>build_64.bat
87+
C:\Projects\CAN\Drivers\PeakCAN>x64_build.bat
8888
```
8989
9090
#### uvPeakCAN (DLL)
@@ -118,18 +118,18 @@ Type `can_test /?` to display all program options.
118118
119119
### Development Environment
120120
121-
- Microsoft Visual Studio Community 2019 (Version 16.11.17)
121+
- Microsoft Visual Studio Community 2022 (Version 17.7.2)
122+
123+
### Required PCANBasic DLL
124+
125+
- Version 4.5 or later _(Latest is Greatest!)_
122126
123127
### Tested CAN Hardware
124128
125129
- PCAN-USB - single channel, CAN 2.0 (Peak´s item no.: IPEH-002021, IPEH-002021)
126130
- PCAN-USB FD - single channel, CAN 2.0 and CAN FD (Peak´s item no.: IPEH-004022)
127131
- PCAN-USB Pro FD - dual channel, CAN 2.0 and CAN FD (Peak´s item no.: IPEH-004061)
128132
129-
### Required PCANBasic DLL
130-
131-
- Version 4.5 or later _(Latest is Greatest!)_
132-
133133
## Known Bugs and Caveats
134134
135135
For a list of known bugs and caveats see tab [Issues](https://github.com/uv-software/PCANBasic-Wrapper/issues) in the GitHub repo.

Sources/CANAPI/CANAPI.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// CAN Interface API, Version 3 (Interface Definition)
44
//
5-
// Copyright (c) 2004-2022 Uwe Vogt, UV Software, Berlin ([email protected])
5+
// Copyright (c) 2004-2023 Uwe Vogt, UV Software, Berlin ([email protected])
66
// All rights reserved.
77
//
88
// This file is part of CAN API V3.
@@ -73,9 +73,9 @@
7373
/// zero to compile your program with the CAN API source files or to
7474
/// link your program with the static library at compile-time.
7575
///
76-
/// \author $Author: makemake $
76+
/// \author $Author: haumea $
7777
//
78-
/// \version $Rev: 1033 $
78+
/// \version $Rev: 1143 $
7979
//
8080
/// \defgroup can_api CAN Interface API, Version 3
8181
/// \{
@@ -155,7 +155,7 @@ class CANCPP CCanApi {
155155
MessageLost = CANERR_MSG_LST, ///< message lost
156156
TransmitterBusy = CANERR_TX_BUSY, ///< transmitter busy
157157
ReceiverEmpty = CANERR_RX_EMPTY, ///< receiver empty
158-
ErrorFrame = CANERR_ERR_FRAME, ///< error frame
158+
QueueOverrun = CANERR_QUE_OVR, ///< queue overrun
159159
Timeout = CANERR_TIMEOUT, ///< timed out
160160
ResourceError = CANERR_RESOURCE, ///< resource allocation
161161
InvalidBaudrate = CANERR_BAUDRATE, ///< illegal baudrate
@@ -440,8 +440,8 @@ class CANCPP CCanApi {
440440
/// \{
441441
public:
442442
static CANAPI_Return_t MapIndex2Bitrate(int32_t index, CANAPI_Bitrate_t &bitrate);
443-
static CANAPI_Return_t MapString2Bitrate(const char *string, CANAPI_Bitrate_t &bitrate);
444-
static CANAPI_Return_t MapBitrate2String(CANAPI_Bitrate_t bitrate, char *string, size_t length);
443+
static CANAPI_Return_t MapString2Bitrate(const char *string, CANAPI_Bitrate_t &bitrate, bool &data, bool &sam);
444+
static CANAPI_Return_t MapBitrate2String(CANAPI_Bitrate_t bitrate, char *string, size_t length, bool data = false, bool sam = false);
445445
static CANAPI_Return_t MapBitrate2Speed(CANAPI_Bitrate_t bitrate, CANAPI_BusSpeed_t &speed);
446446
/// \}
447447

@@ -457,7 +457,7 @@ class CANCPP CCanApi {
457457
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U, 8U, 8U, 8U, 8U, 8U, 8U, 8U
458458
#endif
459459
};
460-
return dlc_table[dlc & 0xFU];
460+
return dlc_table[(dlc < 16U) ? dlc : 15U];
461461
}
462462
static uint8_t Len2Dlc(uint8_t len) {
463463
#if (OPTION_CAN_2_0_ONLY == 0)
@@ -478,4 +478,4 @@ class CANCPP CCanApi {
478478
/// \}
479479
#endif // CANAPI_H_INCLUDED
480480
/// \}
481-
// $Id: CANAPI.h 1033 2022-01-11 19:58:04Z makemake $ Copyright (c) UV Software //
481+
// $Id: CANAPI.h 1143 2023-08-13 17:50:24Z haumea $ Copyright (c) UV Software //

0 commit comments

Comments
 (0)