Commanders
Arduino buttons/bus library
CANCommanderClass Class Reference

#include "CANCommander.hpp"

Inheritance diagram for CANCommanderClass:
Commander

Public Member Functions

 CANCommanderClass ()
 
void begin (uint8_t inSPIpin, uint8_t inSpeed, uint8_t inInterrupt, uint16_t inId)
 
unsigned long loop ()
 

Static Public Member Functions

static CANCommanderClass & GetCurrent ()
 

Detailed Description

This Commanders receive orders from the CAN bus, and translate it into Commanders events.

This CAN bus used a MCP2515 chip, and use the library mcp_can for that. This library uses also the SPI bus to get data.

A sample of the library Commanders give a sender of CAN events to Commanders.

To work, the sender must send a message with the form of

IIIIEDD

where IIII is an unsigned long (four bytes) for the event id, E is the event type (see values of COMMANDERS_EVENT_TYPE), and DD the associated data.

Events thrown:

reason id type data
message received id type data

Constructor & Destructor Documentation

CANCommanderClass::CANCommanderClass ( )
inline

Default constructor.

Member Function Documentation

void CANCommanderClass::begin ( uint8_t  inSPIpin,
uint8_t  inSpeed,
uint8_t  inInterrupt,
uint16_t  inId 
)

Initialize the instance.

Parameters
inSPIpinpin for SPI to get data.
inSpeedThe speed can be (of course, use the defines from mcp_can_dfs.h)
Value Speed (define name)
1 CAN_5KBPS
2 CAN_10KBPS
3 CAN_20KBPS
4 CAN_25KBPS
5 CAN_31K25BPS
6 CAN_33KBPS
7 CAN_40KBPS
8 CAN_50KBPS
9 CAN_80KBPS
10 CAN_83K3BPS
11 CAN_95KBPS
12 CAN_100KBPS
13 CAN_125KBPS
14 CAN_200KBPS
15 CAN_250KBPS
16 CAN_500KBPS
17 CAN_666KBPS
18 CAN_1000KBPS
Parameters
inInterruptinterrupt number for the reception.
inIdCAN id. Only the messages with this ID in the header will be read.
static CANCommanderClass& CANCommanderClass::GetCurrent ( )
inlinestatic

Get the current instance of DccCommanderClass

Remarks
This is an internal function.
unsigned long CANCommanderClass::loop ( )
virtual

Main loop function.

Reimplemented from Commander.


The documentation for this class was generated from the following files: