=============== MCP2515 class =============== .. class:: MCP2515(dvr, cs, rst=None, clk=800000): Creates an instance of the MCP2515 class. This class allows the control of MCP2515 devices. :param drv: SPI Driver used '(SPI0, ...)' :param cs: Chip select of the SPI driver :param rst: Reset pin (default None) :param clk: Clock speed, default 800 kHz .. method:: init(idmode, speed, clock) Initializes the MCP2515 chip :param idmode: set the RX buffer id mode (selectable from mcp2515.MCP_STDEXT, mcp2515.MCP_STD, mcp2515.MCP_EXT, or mcp2515.MCP_ANY :param speed: set the speed of the CAN communication :param clock: set the clock of the CAN Communication Possible combination of values for Clock and Speed are: * Clock --> 8MHZ =========== ================ Clock Speed =========== ================ "8MHZ" "5KBPS" "8MHZ" "10KBPS" "8MHZ" "20KBPS" "8MHZ" "31KBPS" "8MHZ" "33KBPS" "8MHZ" "40KBPS" "8MHZ" "50KBPS" "8MHZ" "80KBPS" "8MHZ" "100KBPS" "8MHZ" "125KBPS" "8MHZ" "200KBPS" "8MHZ" "250KBPS" "8MHZ" "500KBPS" "8MHZ" "1000KBPS" =========== ================ * Clock --> 16MHZ =========== ================ Clock Speed =========== ================ "16MHZ" "5KBPS" "16MHZ" "10KBPS" "16MHZ" "20KBPS" "16MHZ" "33KBPS" "16MHZ" "40KBPS" "16MHZ" "50KBPS" "16MHZ" "80KBPS" "16MHZ" "100KBPS" "16MHZ" "125KBPS" "16MHZ" "200KBPS" "16MHZ" "250KBPS" "16MHZ" "500KBPS" "16MHZ" "1000KBPS" =========== ================ * Clock --> 20MHZ =========== ================ Clock Speed =========== ================ "20MHZ" "40KBPS" "20MHZ" "50KBPS" "20MHZ" "80KBPS" "20MHZ" "100KBPS" "20MHZ" "125KBPS" "20MHZ" "200KBPS" "20MHZ" "250KBPS" "20MHZ" "500KBPS" "20MHZ" "1000KBPS" =========== ================ .. method:: set_mode(mode) Sets the operation mode of the MCP2515 :param mode: operation mode ("NORMAL", "SLEEP", "LOOPBACK", "LISTENONLY", "CONFIG", "POWERUP", "ONE_SHOT") .. method:: init_mask(num, data, ext) Initializes Masks :param num: 0 to set mask 0 on RX buffer, 1 to set mask 1 on RX buffer :param data: Data Mask :param ext: 0 for standard ID, 1 for Extended ID .. method:: init_filter(num, data, ext) Initializes Filters :param num: number of filter to be set in RX buffer (from 0 to 5) :param data: Data Filter :param ext: 0 for standard ID, 1 for Extended ID .. method:: send(canid, data, ext=None) Sends CAN messages :param canid: ID of the CAN message (bytearray of 4 bytes) :param data: Data to be sent (list of 8 bytes) :param ext: 0 for standard ID, 1 for Extended ID (default None - auto detected) .. method:: recv() Receives CAN messages returnung CAN id value and related data message Returns canid, msg