#ifndef _CAN_H #define _CAN_H // Initialize the CAN subsystem void can_init( ); // This is an opaque data type that represents one of the hardware CAN buffers // In actuality this is a pointer at a group of SFRs, so don't mess with it! typedef unsigned char CAN_BUFFER; // Get a handle to a free CAN transmission buffer CAN_BUFFER can_get_tx_buf( ); // Set a standard address for a buffer void can_set_address_std(CAN_BUFFER buf, unsigned long addr); // Set an extended address into a buffer void can_set_address_ext(CAN_BUFFER buf, unsigned long addr); // Set the buffer's data void can_set_buffer_data( CAN_BUFFER buf, unsigned char *data_in, unsigned char length ); // Transmit Data Frame void can_send_tx_buf(CAN_BUFFER buf); // Return a buffer with the next message in the receive queue CAN_BUFFER can_get_rx_msg( ); // Get the address from a CAN_BUFFER unsigned long can_get_address(CAN_BUFFER buf); // Get the DLC from a CAN_BUFFER unsigned char can_get_dlc(CAN_BUFFER buf); // Get a data byte from a CAN_BUFFER unsigned char can_get_data_byte(CAN_BUFFER buf, unsigned char index); // Free the buffer for a new message void can_free_rx_buf(CAN_BUFFER buf); // Transmit Remote Frame void can_send_rtr(CAN_BUFFER buf); #endif