Add support for RTR Frame
* You can send an RTR-Frame by adding rtr=True the calling of sendMessage
This commit is contained in:
parent
43af99401f
commit
ec5cd45b4d
1 changed files with 5 additions and 2 deletions
|
|
@ -91,7 +91,7 @@ class PcanAdapter (object):
|
||||||
|
|
||||||
print("PCAN deinitialised")
|
print("PCAN deinitialised")
|
||||||
|
|
||||||
def sendMessage(self, Message):
|
def sendMessage(self, Message, rtr = False):
|
||||||
'''
|
'''
|
||||||
Sends the CanMessage object Message onto the CAN bus.
|
Sends the CanMessage object Message onto the CAN bus.
|
||||||
|
|
||||||
|
|
@ -101,6 +101,9 @@ class PcanAdapter (object):
|
||||||
|
|
||||||
msg = PCANBasic.TPCANMsg() # create a new PCAN message object
|
msg = PCANBasic.TPCANMsg() # create a new PCAN message object
|
||||||
msg.ID = Message.Id # copy the ID
|
msg.ID = Message.Id # copy the ID
|
||||||
|
if rtr:
|
||||||
|
msg.MSGTYPE = PCANBasic.PCAN_MESSAGE_RTR # Message type is Remote-Transfer-Request
|
||||||
|
else:
|
||||||
msg.MSGTYPE = PCANBasic.PCAN_MESSAGE_STANDARD # Message type is standard (not extended)
|
msg.MSGTYPE = PCANBasic.PCAN_MESSAGE_STANDARD # Message type is standard (not extended)
|
||||||
msg.LEN = Message.Length # copy the length
|
msg.LEN = Message.Length # copy the length
|
||||||
msg.DATA[0:Message.Length] = Message.Data # copy the message data into the PCAN message object
|
msg.DATA[0:Message.Length] = Message.Data # copy the message data into the PCAN message object
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue