TTK4155 Ping-pong project
can_driver.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  can_msg_type
 

Functions

int CAN_init (uint16_t mode, uint8_t id)
 
uint8_t CAN_loopback (uint8_t data)
 
void CAN_transfer (uint8_t data)
 
void CAN_transfer_2 (uint8_t data1, uint8_t data2)
 
uint8_t CAN_busywait_reveive (void)
 
uint8_t CAN_check_reveive (void)
 
void CAN_send (uint8_t id, int data_byte, int *data)
 

Detailed Description

Can driver header file

Function Documentation

◆ CAN_busywait_reveive()

uint8_t CAN_busywait_reveive ( void  )

CAN receive function

WAIT FOR RX BUFFER 0 INTERUPT

read RX0 data buffer.

turn off the interrupt flag after reading

◆ CAN_check_reveive()

uint8_t CAN_check_reveive ( void  )
Here is the caller graph for this function:

◆ CAN_init()

int CAN_init ( uint16_t  mode,
uint8_t  id 
)

Trigger interrupt on falling edge on INT2.

Enable interrupt on INT2

< Set ID

< Set mode

Here is the caller graph for this function:

◆ CAN_loopback()

uint8_t CAN_loopback ( uint8_t  data)

SET ARBRITARY VALUES FOR ID AND DATA LENGTH

< Load data into TX0 buffer

WAIT FOR RX BUFFER 0 INTERUPT

◆ CAN_send()

void CAN_send ( uint8_t  id,
int  data_byte,
int *  data 
)

Send message on can bus.

Parameters
idCAN ID to send with
data_byteNumber of bytes (from 1 to 8)
dataPointer with data to send.

< Ready to send function.

Here is the caller graph for this function:

◆ CAN_transfer()

void CAN_transfer ( uint8_t  data)

Send message on can bus.

Parameters
dataData to send on bus

◆ CAN_transfer_2()

void CAN_transfer_2 ( uint8_t  data1,
uint8_t  data2 
)

SET ARBRITARY VALUES FOR ID AND DATA LENGTH

< Load data into TX0 buffer

< Load data into TX0 buffer