Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

Commit e672e29

Browse files
committed
Remove additional SPI.begin in examples
1 parent af2e820 commit e672e29

File tree

3 files changed

+0
-13
lines changed

3 files changed

+0
-13
lines changed

examples/CAN_SpeedTest/CAN_SpeedTest.ino

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ unsigned long oldTime = 0;
99

1010
void setup() {
1111
Serial.begin(115200);
12-
SPI.begin();
1312

1413
mcp2515.reset();
1514
mcp2515.setBitrate(CAN_125KBPS);
@@ -19,7 +18,6 @@ void setup() {
1918
}
2019

2120
void loop() {
22-
2321
if (mcp2515.readMessage(&canMsg) == MCP2515::ERROR_OK) {
2422
cntr++;
2523
}
@@ -30,5 +28,4 @@ void loop() {
3028
Serial.println(" msg/sec");
3129
cntr = 0;
3230
}
33-
3431
}

examples/CAN_read/CAN_read.ino

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ MCP2515 mcp2515(10);
77

88
void setup() {
99
Serial.begin(115200);
10-
SPI.begin();
1110

1211
mcp2515.reset();
1312
mcp2515.setBitrate(CAN_125KBPS);
@@ -18,22 +17,17 @@ void setup() {
1817
}
1918

2019
void loop() {
21-
2220
if (mcp2515.readMessage(&canMsg) == MCP2515::ERROR_OK) {
23-
2421
Serial.print(canMsg.can_id, HEX); // print ID
2522
Serial.print(" ");
2623
Serial.print(canMsg.can_dlc, HEX); // print DLC
2724
Serial.print(" ");
2825

2926
for (int i = 0; i<canMsg.can_dlc; i++) { // print the data
30-
3127
Serial.print(canMsg.data[i],HEX);
3228
Serial.print(" ");
33-
3429
}
3530

3631
Serial.println();
3732
}
38-
3933
}

examples/CAN_write/CAN_write.ino

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ MCP2515 mcp2515(10);
77

88

99
void setup() {
10-
1110
canMsg1.can_id = 0x0F6;
1211
canMsg1.can_dlc = 8;
1312
canMsg1.data[0] = 0x8E;
@@ -32,7 +31,6 @@ void setup() {
3231

3332
while (!Serial);
3433
Serial.begin(115200);
35-
SPI.begin();
3634

3735
mcp2515.reset();
3836
mcp2515.setBitrate(CAN_125KBPS);
@@ -42,12 +40,10 @@ void setup() {
4240
}
4341

4442
void loop() {
45-
4643
mcp2515.sendMessage(&canMsg1);
4744
mcp2515.sendMessage(&canMsg2);
4845

4946
Serial.println("Messages sent");
5047

5148
delay(100);
52-
5349
}

0 commit comments

Comments
 (0)