Overview
This module contains functions for accessing the CAN interfaces of the eLua CPU
Data structures, constants and types
// eLua CAN ID types
enum
{
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.
Functions
clock = can.setup( id, clock )
Setup the CAN interface
Arguments:
- 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.
Arguments:
- id - the ID of the CAN interface.
- canid - CAN identifier number.
- canidtype - identifier type as defined here.
- message - message in string format, 8 or fewer bytes.
Returns: nothing.
canid, canidtype, message = can.recv( id )
Receive CAN bus message.
Arguments: id - the ID of the CAN interface.
Returns:
- canid - CAN identifier number.
- canidtype - identifier type as defined here.
- message - message in string format, 8 or fewer bytes.