Skip to content

Commit

Permalink
Settable Baudrate
Browse files Browse the repository at this point in the history
Add ability to set baudrate in canInit function. Previously had to modify config.h in the library folder.
  • Loading branch information
JamieBlakey committed Feb 12, 2018
1 parent 10b00f4 commit 349d75d
Show file tree
Hide file tree
Showing 6 changed files with 374 additions and 334 deletions.
4 changes: 2 additions & 2 deletions src/ASTCanLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "ASTCanLib.h"

void canInit(void){
void canInit(long baud){
// Clock prescaler
CLKPR = ( 1 << CLKPCE ); // Set Clock Prescaler change enable
CLKPR = 0x00;
Expand All @@ -23,7 +23,7 @@ void canInit(void){
PORTB &= ~(1<<PORTB1); // RST Led
PORTB &= ~(1<<PORTB4); // Go into normal mode (CAN_STBY low)
_delay_ms(50);
can_init(0);
can_init(0,baud);
}

void clearBuffer(uint8_t *Buffer){
Expand Down
2 changes: 1 addition & 1 deletion src/ASTCanLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern "C"{
#include <can_lib.h>
}

void canInit(void);
void canInit(long baud);
void clearBuffer(uint8_t *Buffer);

#endif
Loading

0 comments on commit 349d75d

Please sign in to comment.