Skip to content

Commit

Permalink
Revert a long past commit that caused the "begin" function to not try
Browse files Browse the repository at this point in the history
to re-initialize hardware. That was a bad idea. This commit causes the
library to be able to heal itself in cause of trouble.
  • Loading branch information
collin80 committed Dec 4, 2015
1 parent e7b0ee5 commit 57dac0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions due_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ uint32_t CANRaw::init(uint32_t ul_baudrate)
uint32_t ul_flag;
uint32_t ul_tick;

if (busSpeed == ul_baudrate) return ul_baudrate; //no need to reinitialize so just return that it was a success
else if (busSpeed != 0) return 0xFFFFFFFF; //ERROR! The bus was already initialized and you're trying to change it! Use set_baudrate if you really want to do that.

//there used to be code here to cause this function to not run if the hardware is already initialized. But,
//it can be helpful to reinitialize. For instance, if the bus rate was set improperly you might need to
//go back through this code to reset the hardware.

//initialize all function pointers to null
for (int i = 0; i < 9; i++) cbCANFrame[i] = 0;
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=due_can
version=2.0.0
version=2.0.1
author=Collin Kidder <[email protected]>, Thibaut Viard, Wilfredo Molina
maintainer=Collin Kidder <[email protected]>
sentence=Allows for CAN bus communications with the Arduino Due
Expand Down

0 comments on commit 57dac0b

Please sign in to comment.