VLCB
Loading...
Searching...
No Matches
CANSHIELD.h
Go to the documentation of this file.
1// Copyright (C) Sven Rosvall (sven@rosvall.ie)
2// This file is part of VLCB-Arduino project on https://github.com/SvenRosvall/VLCB-Arduino
3// Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
4// The full licence can be found at: http://creativecommons.org/licenses/by-nc-sa/4.0/
5
6#pragma once
7
8#include <Arduino.h>
9#include <LEDUserInterface.h>
10
11#include "CAN2515.h"
12
13namespace VLCB
14{
35{
36public:
37#ifdef ARDUINO_ARCH_RP2040
38 // If this is an RPi Pico then this file shall be compilable but this class shall not be instantiatable.
39 // The RPi Pico has a different SPI class and a different way to set the SPI pins. This is why this class
40 // is not useful for use with RPi Pico.
41 CANSHIELD() = delete;
42#endif
43
44 static byte getGreenLedPin();
45 static byte getYellowLedPin();
46 static byte getSwitchPin();
47
49 static void setupLEDUserInterface(VLCB::LEDUserInterface & ledUserInterface);
50
52 bool begin();
53
56 {
57 return &can2515;
58 }
59
62 {
63 return &can2515;
64 }
65
66 bool hasCanErrors();
67
70};
71
72}
Transport implementation for the MCP2515/25625 CAN controllers.
Definition CAN2515.h:29
Set up functions for the CANSHIELD board.
Definition CANSHIELD.h:35
static byte getSwitchPin()
Definition CANSHIELD.cpp:25
CAN2515 * getCAN2515()
Get the underlying CAN2515 object.
Definition CANSHIELD.h:61
static byte getYellowLedPin()
Definition CANSHIELD.cpp:20
bool hasCanErrors()
Definition CANSHIELD.cpp:47
static byte getGreenLedPin()
Definition CANSHIELD.cpp:15
static void setupLEDUserInterface(VLCB::LEDUserInterface &ledUserInterface)
Setup LED and switch pins for the LEDUserInterface object.
Definition CANSHIELD.cpp:30
CanTransport * getCanTransport()
Get the underlying CAN object.
Definition CANSHIELD.h:55
bool begin()
Prepare the board and CAN controller for operation.
Definition CANSHIELD.cpp:37
CAN2515 can2515
The underlying CAN2515 transport object.
Definition CANSHIELD.h:69
Interface base class for CAN transport implementations.
Definition CanTransport.h:35
User interface "service" that communicates with LEDs and a push button.
Definition LEDUserInterface.h:23
Definition AbstractEventTeachingService.cpp:13