This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import canmatrix.formats | |
import sys | |
import os | |
if len(sys.argv) < 2: | |
exit() | |
file_name = sys.argv[1] | |
cm = canmatrix.formats.loadp_flat(file_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Packet with big endian signals: | |
class testFrame4(Packet): | |
fields_desc = [ | |
SignalField("sig0" ,default=0, start=1 , size=2 , fmt=">B"), | |
SignalField("sig1" ,default=0, start=7 , size=6 , fmt=">B"), | |
SignalField("sig2" ,default=0, start=15, size=11, fmt=">B"), | |
SignalField("sig3" ,default=0, start=20, size=12, fmt=">B"), | |
SignalField("sig4" ,default=0, start=24, size=9 , fmt=">B"), | |
SignalField("sig5" ,default=0, start=50, size=3 , fmt=">B"), | |
SignalField("sig6" ,default=0, start=53, size=3 , fmt=">B"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import canmatrix.formats | |
import can.io.player | |
def get_sub_multiplexer(signals, parent_multiplexer_name, parent_multiplexer_value, decoded): | |
for signal in signals: | |
if signal.is_multiplexer and signal.muxer_for_signal == parent_multiplexer_name and signal.mux_val == parent_multiplexer_value: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.packet import Packet | |
from scapy.packet import bind_layers | |
from scapy.fields import * | |
from scapy.layers.can import CAN | |
class DBC(CAN): | |
name = 'DBC' | |
fields_desc = [ | |
FlagsField('flags', 0, 3, ['error', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <iostream> | |
#include <stdint.h> //uint typedefinitions, non-rtw! | |
#define MASK64(nbits) ((0xffffffffffffffff)>> (64-nbits)) | |
float toPhysicalValue(uint64_t target, float factor, float offset, bool is_signed) | |
{ | |
if (is_signed) |