Skip to content

Commit 501c6e6

Browse files
authored
Merge pull request #8 from uv-software/development
Release candidate 3 for version 0.4.4
2 parents 78be7f3 + a68bdf5 commit 501c6e6

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

README.md

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

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

55
# CAN API V3 for PCAN Interfaces
66

@@ -9,7 +9,7 @@ CAN API V3 is a wrapper specification to have a uniform CAN Interface API for va
99
## PCANBasic-Wrapper
1010

1111
This repo contains the source code for a CAN API V3 compatible wrapper library under Windows for PCAN Interfaces from Peak-System Technik GmbH.
12-
The wrapper library is build upon PEAK´s PCANBasic DLL.
12+
The wrapper library is build upon Peak´s PCANBasic DLL.
1313

1414
### CAN Interface API, Version 3
1515

@@ -156,7 +156,7 @@ You can choose between one of them if you use this work in whole or in part.
156156
### Trademarks
157157
158158
Windows is a registered trademark of Microsoft Corporation in the United States and/or other countries. \
159-
PCAN is a registered trademark of PEAK-System Technik GmbH, Darmstadt, Germany. \
159+
PCAN is a registered trademark of Peak-System Technik GmbH, Darmstadt, Germany. \
160160
Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries. \
161161
Linux is a registered trademark of Linus Torvalds. \
162162
All other company, product and service names mentioned herein may be trademarks, registered trademarks or service marks of their respective owners.

Sources/Wrapper/can_api.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ int can_read(int handle, can_msg_t *msg, uint16_t timeout)
730730
msg->id = 0xFFFFFFFFU;
731731
msg->sts = 1;
732732

733+
repeat:
733734
if (!can[handle].mode.fdoe)
734735
rc = CAN_Read(can[handle].board, &can_msg, &timestamp);
735736
else
@@ -786,6 +787,10 @@ int can_read(int handle, can_msg_t *msg, uint16_t timeout)
786787
can[handle].counters.err++;
787788
return CANERR_ERR_FRAME; // error frame received
788789
}
790+
if ((can_msg.MSGTYPE & PCAN_MESSAGE_EXTENDED) && can[handle].mode.nxtd)
791+
goto repeat; // refuse extended frames
792+
if ((can_msg.MSGTYPE & PCAN_MESSAGE_RTR) && can[handle].mode.nrtr)
793+
goto repeat; // refuse remote frames
789794
msg->id = (int32_t)can_msg.ID;
790795
msg->xtd = (can_msg.MSGTYPE & PCAN_MESSAGE_EXTENDED) ? 1 : 0;
791796
msg->rtr = (can_msg.MSGTYPE & PCAN_MESSAGE_RTR) ? 1 : 0;
@@ -809,10 +814,15 @@ int can_read(int handle, can_msg_t *msg, uint16_t timeout)
809814
return CANERR_RX_EMPTY; // receiver empty
810815
}
811816
if ((can_msg_fd.MSGTYPE & PCAN_MESSAGE_ERRFRAME)) {
817+
// TODO: encode status message (error frame)
812818
can[handle].status.receiver_empty = 1;
813819
can[handle].counters.err++;
814820
return CANERR_ERR_FRAME; // error frame received
815821
}
822+
if ((can_msg.MSGTYPE & PCAN_MESSAGE_EXTENDED) && can[handle].mode.nxtd)
823+
goto repeat; // refuse extended frames
824+
if ((can_msg.MSGTYPE & PCAN_MESSAGE_RTR) && can[handle].mode.nrtr)
825+
goto repeat; // refuse remote frames
816826
msg->id = (int32_t)can_msg_fd.ID;
817827
msg->xtd = (can_msg_fd.MSGTYPE & PCAN_MESSAGE_EXTENDED) ? 1 : 0;
818828
msg->rtr = (can_msg_fd.MSGTYPE & PCAN_MESSAGE_RTR) ? 1 : 0;
@@ -1075,8 +1085,8 @@ static TPCANStatus pcan_capability(TPCANHandle board, can_mode_t *capability)
10751085
capability->nxtd = 1; // PCAN_ACCEPTANCE_FILTER_29BIT available since version 4.2.0
10761086
capability->nrtr = 1; // PCAN_ALLOW_RTR_FRAMES available since version 4.2.0
10771087
#else
1078-
capability->nxtd = 0; // This feature is not supported (TODO: acceptance filtering)
1079-
capability->nrtr = 0; // This feature is not supported (TODO: suppress RTR frames)
1088+
capability->nxtd = 1; // Suppress XTD frames (software solution)
1089+
capability->nrtr = 1; // Suppress RTR frames (software solution)
10801090
#endif
10811091
capability->err = 1; // PCAN_ALLOW_ERROR_FRAMES available since version 4.2.0
10821092
capability->mon = 1; // PCAN_LISTEN_ONLY available since version 1.0.0

Utilities/can_moni/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__CAN Monitor for PEAK PCAN Interfaces, Version 0.4.3__ \
1+
__CAN Monitor for PEAK PCAN Interfaces, Version 0.4.4__ \
22
Copyright © 2007,2017-2022 by Uwe Vogt, UV Software, Berlin
33

44
```

Utilities/can_moni/Sources/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "build_no.h"
2121
#define VERSION_MAJOR 0
2222
#define VERSION_MINOR 4
23-
#define VERSION_PATCH 3
23+
#define VERSION_PATCH 4
2424
#define VERSION_BUILD BUILD_NO
2525
#define VERSION_STRING TOSTRING(VERSION_MAJOR) "." TOSTRING(VERSION_MINOR) "." TOSTRING(VERSION_PATCH) " (" TOSTRING(BUILD_NO) ")"
2626
#if defined(_WIN64)

Utilities/can_test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__CAN Tester for PEAK PCAN Interfaces, Version 0.4.3__ \
1+
__CAN Tester for PEAK PCAN Interfaces, Version 0.4.4__ \
22
Copyright © 2008-2010,2014-2022 by Uwe Vogt, UV Software, Berlin
33

44
```

Utilities/can_test/Sources/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "build_no.h"
2121
#define VERSION_MAJOR 0
2222
#define VERSION_MINOR 4
23-
#define VERSION_PATCH 3
23+
#define VERSION_PATCH 4
2424
#define VERSION_BUILD BUILD_NO
2525
#define VERSION_STRING TOSTRING(VERSION_MAJOR) "." TOSTRING(VERSION_MINOR) "." TOSTRING(VERSION_PATCH) " (" TOSTRING(BUILD_NO) ")"
2626
#if defined(_WIN64)

0 commit comments

Comments
 (0)