File tree Expand file tree Collapse file tree 1 file changed +1
-28
lines changed
examples/leonardo_cdc/leonardo_cdc Expand file tree Collapse file tree 1 file changed +1
-28
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,6 @@ const int INT_PIN = 3;
1414CanHackerLineReader *lineReader = NULL ;
1515CanHacker *canHacker = NULL ;
1616
17- void handleError (const CanHacker::ERROR error);
18-
1917void setup () {
2018 Serial.begin (115200 );
2119 SPI.begin ();
@@ -25,7 +23,7 @@ void setup() {
2523
2624
2725 canHacker = new CanHacker (interfaceStream, debugStream, SPI_CS_PIN);
28- canHacker->enableLoopback ();
26+ canHacker->enableLoopback (); // Enable Loopback mode for offline tests
2927 lineReader = new CanHackerLineReader (canHacker);
3028
3129 pinMode (INT_PIN, INPUT);
@@ -34,34 +32,9 @@ void setup() {
3432void loop () {
3533 if (digitalRead (INT_PIN) == LOW) {
3634 CanHacker::ERROR error = canHacker->processInterrupt ();
37- handleError (error);
3835 }
3936 if (Serial.available ()) {
4037 CanHacker::ERROR error = lineReader->process ();
41- handleError (error);
4238 }
4339}
4440
45-
46- void handleError (const CanHacker::ERROR error) {
47-
48- switch (error) {
49- case CanHacker::ERROR_OK:
50- case CanHacker::ERROR_UNKNOWN_COMMAND:
51- case CanHacker::ERROR_NOT_CONNECTED:
52- case CanHacker::ERROR_MCP2515_ERRIF:
53- case CanHacker::ERROR_INVALID_COMMAND:
54- return ;
55-
56- default :
57- break ;
58- }
59-
60- Serial.print (" Failure (code " );
61- Serial.print ((int )error);
62- Serial.println (" )" );
63-
64- while (1 ) {
65- delay (2000 );
66- } ;
67- }
You can’t perform that action at this time.
0 commit comments