Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions can.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "can.h"
#include "avr/interrupt.h"
#include "../dash/lightControl.h"
#include "../daq/heartbeat.h"

#include <util/delay.h>
#include <avr/io.h>
Expand All @@ -22,7 +20,7 @@ uint8_t lastError = 0;
* Reset and configure the AT90 to use CAN.
*
*/
void initCAN()
void initCAN(void)
{
// Issue a software reset of the CAN Controller
CANGCON |= ( 1 << SWRES );
Expand Down Expand Up @@ -57,7 +55,7 @@ void initCAN()
* @return free MOB index, otherwise 0xFF
*
*/
uint8_t getFreeMob()
uint8_t getFreeMob(void)
{
// This commented out code is to prevent context switching when using this function.
// When it's not commented, it caused both CAN RX and TX to fail. The reasons for this are being investigated.
Expand Down Expand Up @@ -124,8 +122,8 @@ uint8_t sendCAN( CANMessage* message )
// This library currently only supports standard CAN IDs
CANIDT4 = 0;
CANIDT3 = 0;
CANIDT2 = (uint8_t) message->id << 5;
CANIDT1 = (uint8_t) message->id >> 3;
CANIDT2 = (uint8_t) (message->id << 5);
CANIDT1 = (uint8_t) (message->id >> 3);

// Ensure nothing bigger than 8 is written to the CANCDMOB register
if( message->length > 8 )
Expand Down
6 changes: 3 additions & 3 deletions can.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ typedef struct
uint8_t acknowledgement : 1;
} CANErrorStatus;

void initCAN();
void initCAN(void);

CANErrorStatus getLastCANError();
CANErrorStatus getLastCANError(void);

uint8_t listenForMessage( uint16_t id, uint8_t expectedLength );

uint8_t getMessage( CANMessage * message );

uint8_t sendCAN( CANMessage* message );

#endif // CAN_H
#endif // CAN_H