Clear up Arduino examples for all Arduino boards

This commit is contained in:
Anson He
2020-12-10 17:10:14 +08:00
committed by Baozhu Zuo
parent 3ff9e1b4c3
commit c11356b4e5
13 changed files with 162 additions and 45 deletions
+13 -3
View File
@@ -23,15 +23,25 @@
#define SERIAL Serial
#endif
#define CAN_2518FD
//#define CAN_2515
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int SPI_CS_PIN = 9;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
+16 -2
View File
@@ -4,8 +4,22 @@
#include "mcp2515_can.h"
#include "mcp2518fd_can.h"
#define CAN_2518FD
#define SPI_CS_PIN BCM8
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#define SPI_CS_PIN 9
/*SAMD core*/
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
+17 -2
View File
@@ -11,8 +11,23 @@
#define SERIAL Serial
#endif
#define CAN_2518FD
#define SPI_CS_PIN BCM8
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#define SPI_CS_PIN 9
#ifdef CAN_2518FD
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
+13 -3
View File
@@ -12,14 +12,24 @@
#endif
#define CAN_2515
//#define CAN_2518FD
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int CAN_INT_PIN = BCM25;
const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
+14 -4
View File
@@ -11,15 +11,25 @@
#define SERIAL Serial
#endif
//#define CAN_2515
#define CAN_2518FD
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int CAN_INT_PIN = BCM25;
const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
@@ -12,15 +12,24 @@
#endif
#define CAN_2515
//#define CAN_2518FD
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int CAN_INT_PIN = BCM25;
const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
@@ -16,8 +16,8 @@
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = BCM8;
const int CAN_INT_PIN = BCM25;
const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;
#ifdef CAN_2518FD
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
+13 -4
View File
@@ -15,16 +15,25 @@
File myFile;
//#define CAN_2515
#define CAN_2518FD
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int CAN_INT_PIN = BCM25;
const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
+13 -4
View File
@@ -12,16 +12,25 @@
#endif
//#define CAN_2515
#define CAN_2518FD
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int CAN_INT_PIN = BCM25;
const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
+8 -8
View File
@@ -12,11 +12,10 @@
#define SERIAL Serial
#endif
#define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = BCM8;
const int SPI_CS_PIN = 9;
#ifdef CAN_2518FD
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
@@ -25,14 +24,15 @@ mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
void setup() {
SERIAL.begin(115200);
while(!Serial){};
CAN.setMode(0);
CAN.setMode(0); // Set FD Mode
while (0 != CAN.begin((byte)CAN_500K_1M)) { // init can bus : baudrate = 500k
SERIAL.println("CAN BUS Shield init fail");
SERIAL.println(" Init CAN BUS Shield again");
delay(100);
}
byte mode = CAN.getMode();
SERIAL.printf("CAN BUS get mode = %d\n\r",mode);
SERIAL.print("CAN BUS get mode = ");
SERIAL.println(mode);
SERIAL.println("CAN BUS Shield init ok!");
}
@@ -42,11 +42,11 @@ void loop() {
stmp[63] = stmp[63] + 1;
if (stmp[63] == 100) {
stmp[63] = 0;
stmp[63] = stmp[63] + 1;
stmp[62] = stmp[62] + 1;
if (stmp[6] == 100) {
stmp[6] = 0;
stmp[5] = stmp[6] + 1;
if (stmp[62] == 100) {
stmp[62] = 0;
stmp[61] = stmp[62] + 1;
}
}
+14 -4
View File
@@ -8,15 +8,25 @@
#define SERIAL Serial
#endif
//#define CAN_2515
#define CAN_2518FD
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int CAN_INT_PIN = BCM25;
const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
@@ -12,14 +12,24 @@
#define SERIAL Serial
#endif
//#define CAN_2518FD
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int SPI_CS_PIN = 9;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
@@ -2,8 +2,6 @@
// this demo will show you how to use mask and filter
#include <SPI.h>
#define CAN_2518FD
//#define CAN_2515
/*SAMD core*/
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
#define SERIAL SerialUSB
@@ -11,11 +9,24 @@
#define SERIAL Serial
#endif
#define CAN_2515
// #define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
// Set SPI CS Pin according to your hardware
// For Wio Terminal w/ MCP2518FD RPi Hat
// Channel 0 SPI_CS Pin: BCM 8
// Channel 1 SPI_CS Pin: BCM 7
// Interupt Pin: BCM25
// *****************************************
// For Arduino MCP2515 Hat:
// SPI_CS Pin: D9
#ifdef CAN_2518FD
#include "mcp2518fd_can.h"
const int SPI_CS_PIN = BCM8;
const int SPI_CS_PIN = 9;
mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#endif
@@ -23,7 +34,7 @@ mcp2518fd CAN(SPI_CS_PIN); // Set CS pin
#include "mcp2515_can.h"
const int SPI_CS_PIN = 9;
mcp2515_can CAN(SPI_CS_PIN); // Set CS pin
#endif
#endif
void setup() {