118#ifndef _NMEA2000_CAN_H_
119#define _NMEA2000_CAN_H_
135#define USE_N2K_MCP_CAN 1
142#define USE_N2K_DUE_CAN 2
150#define USE_N2K_TEENSY_CAN 3
157#define USE_N2K_AVR_CAN 4
165#define USE_N2K_SOCKET_CAN 5
172#define USE_N2K_MBED_CAN 6
178#define USE_N2K_ESP32_CAN 7
185#define USE_N2K_TEENSYX_CAN 8
191#define USE_N2K_ARDUINO_CAN 9
200#if !defined(USE_N2K_CAN)
202#define USE_N2K_CAN USE_N2K_MBED_CAN
203#elif defined(__SAM3X8E__)
204#define USE_N2K_CAN USE_N2K_DUE_CAN
205#elif defined(__ATMEGA32U4__)
206#define USE_N2K_CAN USE_N2K_TEENSY_CAN
207#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined (__MK66FX1M0__)
208#ifndef USE_NMEA2000_TEENSYX_FOR_TEENSY_3X
209 #define USE_N2K_CAN USE_N2K_TEENSY_CAN
211 #define USE_N2K_CAN USE_N2K_TEENSYX_CAN
213#elif defined(__AVR_AT90CAN32__)||defined(__AVR_AT90CAN64__)||defined(__AVR_AT90CAN128__)|| \
214 defined(__AVR_ATmega32C1__)||defined(__AVR_ATmega64C1__)||defined(__AVR_ATmega16M1__)||defined(__AVR_ATmega32M1__)|| defined(__AVR_ATmega64M1__)
215#define USE_N2K_CAN USE_N2K_AVR_CAN
216#elif defined(__linux__)||defined(__linux)||defined(linux)
217#define USE_N2K_CAN USE_N2K_SOCKET_CAN
218#elif defined(ARDUINO_ARCH_ESP32) || defined(ESP32)
219#define USE_N2K_CAN USE_N2K_ESP32_CAN
220#elif defined(__IMXRT1062__)
221#define USE_N2K_CAN USE_N2K_TEENSYX_CAN
222#elif defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_MINIMA)
223#define USE_N2K_CAN USE_N2K_ARDUINO_CAN
225#define USE_N2K_CAN USE_N2K_MCP_CAN
229#if USE_N2K_CAN == USE_N2K_DUE_CAN
231#include <NMEA2000_due.h>
232#ifndef NMEA2000_ARDUINO_DUE_CAN_BUS
233 #define NMEA2000_ARDUINO_DUE_CAN_BUS
237#elif USE_N2K_CAN == USE_N2K_TEENSY_CAN
239#include <NMEA2000_teensy.h>
240#ifndef NMEA2000_TEENSY_VER
241#error Update NMEA2000_Teensy for the latest version!
243#ifndef NMEA2000_TEENSY_DEF_TIMEOUT
244#define NMEA2000_TEENSY_DEF_TIMEOUT 4
246#ifndef NMEA2000_TEENSY_CAN_BUS
247#define NMEA2000_TEENSY_CAN_BUS 0
249tNMEA2000 &
NMEA2000=*(
new tNMEA2000_teensy(NMEA2000_TEENSY_DEF_TIMEOUT,NMEA2000_TEENSY_CAN_BUS));
251#elif USE_N2K_CAN == USE_N2K_TEENSYX_CAN
253#include <NMEA2000_Teensyx.h>
254tNMEA2000 &
NMEA2000=*(
new tNMEA2000_Teensyx(NMEA2000_TEENSYX_CAN_BUS,NMEA2000_TEENSYX_TX_PIN,NMEA2000_TEENSYX_RX_PIN));
256#elif USE_N2K_CAN == USE_N2K_AVR_CAN
259#include <NMEA2000_avr.h>
262#elif USE_N2K_CAN == USE_N2K_SOCKET_CAN
264#ifndef SOCKET_CAN_PORT
265 #define SOCKET_CAN_PORT NULL
267#include <NMEA2000_SocketCAN.h>
270#elif USE_N2K_CAN == USE_N2K_MBED_CAN
272#include <NMEA2000_mbed.h>
274tmbedStream serStream;
276#elif USE_N2K_CAN == USE_N2K_ESP32_CAN
277#include <NMEA2000_esp32.h>
280#elif USE_N2K_CAN == USE_N2K_ARDUINO_CAN
281#include <NMEA2000_ArduinoCAN.h>
291#if defined(__STM32F1__)
292#include <MapleIntCompatibility.h>
298#if !defined(N2k_CAN_INT_PIN)
305#define N2k_CAN_INT_PIN 0xff
312#ifndef MCP_CAN_RX_BUFFER_SIZE
313#define MCP_CAN_RX_BUFFER_SIZE 1
317#include <NMEA2000_mcp.h>
318#if !defined(N2k_SPI_CS_PIN)
325#define N2k_SPI_CS_PIN 53
328#if !defined(USE_MCP_CAN_CLOCK_SET)
333#define USE_MCP_CAN_CLOCK_SET 16
336#if USE_MCP_CAN_CLOCK_SET == 8
341#define MCP_CAN_CLOCK_SET MCP_8MHz
347#define MCP_CAN_CLOCK_SET MCP_16MHz
This File contains the class tN2kMsg and all necessary functions to handle a NMEA2000 Message.
This file contains the class tNMEA2000, which consists the main functionality of the library.
#define N2k_CAN_INT_PIN
Definition of the CAN Interrupt Pin This defines the number of the CAN Interrupt PIN....
#define N2k_SPI_CS_PIN
Definition of the SPI ChipSelectPin for the CAN Transceiver This defines the the I/O Pin uses for the...
#define MCP_CAN_CLOCK_SET
The Clock frequency for the MCP CAN is 16MHz.
#define MCP_CAN_RX_BUFFER_SIZE
Definition of the MCP RX Buffer Size Value of 1 is a small buffer size to save memory.
tNMEA2000 device class definition.