16FXlib
Transfer Level Access (can4.h)

Detailed Description

Overview
This library enables addressed messaging over the CAN Controller, with ports and automatic message splitting.

Modules

 Transfer Level Access Configuration (can4.h)
 

Functions

uint8_t can4_init (uint8_t address)
 
uint8_t can4_open (uint8_t port)
 
void can4_close (uint8_t port)
 
uint8_t can4_send (uint8_t dest, uint8_t port, uint8_t *data, uint8_t len, uint8_t interrupt)
 
uint8_t can4_getData (uint8_t port, uint8_t *data, uint8_t *source)
 

Macros

#define CAN4_MAX_PORT   31
 
#define CAN4_MAX_MSG_COUNT   31
 

Function Documentation

uint8_t can4_init ( uint8_t  address)

Initializes the CAN controller.

Parameters
addressAddress to be used
Returns
1 if everything went fine, 0 if there was an error

Definition at line 62 of file can4.c.

uint8_t can4_open ( uint8_t  port)

Opens an 'Port' to accept messages with suitable port

Parameters
portPort
Returns
1 if everything went right. 0 if there was an error.

Definition at line 78 of file can4.c.

void can4_close ( uint8_t  port)

Closes the given port

Parameters
portthe Port

Definition at line 270 of file can4.c.

uint8_t can4_send ( uint8_t  dest,
uint8_t  port,
uint8_t data,
uint8_t  len,
uint8_t  interrupt 
)

Sends a message over the CAN controller to the destination. Automatically splits the messages.

Parameters
destDestination of the message (0 - CAN3_MAX_ADDRESS)
portPort to send the message to
dataPointer to byte data array
lenlength of the data (1 - 512)
interrupt
Returns
1 if everything went fine, 0 if there was an error, in most cased wrong input data

Definition at line 96 of file can4.c.

uint8_t can4_getData ( uint8_t  port,
uint8_t data,
uint8_t source 
)

Checks if data was received and in case returns the data

Parameters
portPort to be checked
dataArray to save data to (max 512 Byte). If msg is longer than 8 Byte, data size of data array has to be multiple of 8!!!
sourcepointer to save the source of this message (1 Byte)
Returns
length of data field, or 0 if there was no data

Definition at line 121 of file can4.c.