mirror of
https://github.com/Seeed-Studio/Seeed_Arduino_CAN.git
synced 2026-09-14 18:42:56 +00:00
Pretty printed the Arduino code with astyle
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
|
||||
/*SAMD core*/
|
||||
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
|
||||
#define SERIAL SerialUSB
|
||||
#define SERIAL SerialUSB
|
||||
#else
|
||||
#define SERIAL Serial
|
||||
#define SERIAL Serial
|
||||
#endif
|
||||
|
||||
#define SPI_CS_PIN 10
|
||||
@@ -15,38 +15,29 @@
|
||||
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
SERIAL.begin(115200);
|
||||
|
||||
while (CAN_OK != CAN.begin(CAN_500KBPS)) // init can bus : baudrate = 500k
|
||||
{
|
||||
while (CAN_OK != CAN.begin(CAN_500KBPS)) { // init can bus : baudrate = 500k
|
||||
SERIAL.println("CAN init failed, retry");
|
||||
delay(100);
|
||||
}
|
||||
SERIAL.println("CAN init ok");
|
||||
|
||||
if(CAN.mcpPinMode(MCP_RX0BF, MCP_PIN_OUT))
|
||||
{
|
||||
if (CAN.mcpPinMode(MCP_RX0BF, MCP_PIN_OUT)) {
|
||||
SERIAL.println("RX0BF is now an output");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
SERIAL.println("Could not switch RX0BF");
|
||||
}
|
||||
|
||||
if(CAN.mcpPinMode(MCP_RX1BF, MCP_PIN_OUT))
|
||||
{
|
||||
if (CAN.mcpPinMode(MCP_RX1BF, MCP_PIN_OUT)) {
|
||||
SERIAL.println("RX1BF is now an output");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
SERIAL.println("Could not switch RX1BF");
|
||||
}
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
void loop() {
|
||||
SERIAL.println("10");
|
||||
CAN.mcpDigitalWrite(MCP_RX0BF, HIGH);
|
||||
CAN.mcpDigitalWrite(MCP_RX1BF, LOW);
|
||||
@@ -58,5 +49,5 @@ void loop()
|
||||
}
|
||||
|
||||
/*********************************************************************************************************
|
||||
END FILE
|
||||
END FILE
|
||||
*********************************************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user