This module contains functions for accessing the CAN interfaces of the eLua CPU

Data structures, constants and types

// eLua CAN ID types
  ELUA_CAN_ID_STD = 0,      // exported as net.ID_STD
  ELUA_CAN_ID_EXT,          // exported as can.ID_EXT

These are the CAN identifier types supported by eLua. Standard identifiers are 11 bits in length, extended identifiers are 29 bits.


clock = can.setup( id, clock )

Setup the CAN interface


  • id - the ID of the CAN interface.
  • clock - the clock of the CAN interface.

Returns: The actual clock set on the CAN interface. Depending on the hardware, this might have a different value than the clock parameter.

can.send( id, canid, canidtype, message )

Send message over the CAN bus.


Returns: nothing.

canid, canidtype, message = can.recv( id )

Receive CAN bus message.

Arguments: id - the ID of the CAN interface.