VLCB
Loading...
Searching...
No Matches
PicoCANBus.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#ifndef ARDUINO_ARCH_RP2040
38 // If not an RPi Pico then this file shall be compilable but this class shall not be instantiatable.
39 PicoCANBus() = delete;
40#endif
41
42 static byte getGreenLedPin();
43 static byte getYellowLedPin();
44 static byte getSwitchPin();
45
47 static void setupLEDUserInterface(VLCB::LEDUserInterface & ledUserInterface);
48
50 bool begin();
51
54 {
55 return &can2515;
56 }
57
60 {
61 return &can2515;
62 }
63
64 bool hasCanErrors();
65
68};
69
70}
Transport implementation for the MCP2515/25625 CAN controllers.
Definition CAN2515.h:29
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
static void setupLEDUserInterface(VLCB::LEDUserInterface &ledUserInterface)
Setup LED and switch pins for the LEDUserInterface object.
Definition PicoCANBus.cpp:30
bool hasCanErrors()
Definition PicoCANBus.cpp:46
static byte getYellowLedPin()
Definition PicoCANBus.cpp:20
CAN2515 * getCAN2515()
Get the underlying CAN2515 object.
Definition PicoCANBus.h:59
bool begin()
Prepare the board and CAN controller for operation.
Definition PicoCANBus.cpp:37
CanTransport * getCanTransport()
Get the underlying CAN object.
Definition PicoCANBus.h:53
CAN2515 can2515
The underlying CAN2515 transport object.
Definition PicoCANBus.h:67
static byte getSwitchPin()
Definition PicoCANBus.cpp:25
static byte getGreenLedPin()
Definition PicoCANBus.cpp:15
PicoCANBus()=delete
Definition AbstractEventTeachingService.cpp:13