Since | Origin / Contributor | Maintainer | Source |
---|---|---|---|
2017-04-27 | @ThomasBarth, zelll | can.c |
The CAN module provides access to the in-built CAN controller.
Send a frame.
can.send(format, msg_id, data)
format
Frame format. can.STANDARD_FRAME
or can.EXTENDED_FRAME
msg_id
CAN Messge IDdata
CAN data, up to 8 bytes
nil
Configuration CAN controller.
can.setup({
speed = 1000,
tx = 5,
rx = 4,
dual_filter = false,
code = 0,
mask = 0xffffffff
}, function(format, msg_id, data) end)
config
speed
kbps. One of following value: 1000
, 800
, 500
, 250
, 100
.tx
Pin num for TX.rx
Pin num for RX.dual_filter
true
dual filter mode, false
single filter mode (default)code
4-bytes integer. Use this with mask to filter CAN frame. Default: 0
. See SJA1000mask
4-bytes integer. Default: 0xffffffff
callback
function to be called when CAN data received.
format
Frame format. can.STANDARD_FRAME
or can.EXTENDED_FRAME
msg_id
CAN Messge IDdata
CAN data, up to 8 bytes
nil
Start CAN controller.
can.start()
nil
Stop CAN controller.
can.stop()
nil