Classes
can.h File Reference

Header-Datei für das allgemeine CAN Interface. More...

#include <avr/pgmspace.h>
#include <stdint.h>
#include <stdbool.h>
#include "config.h"
Include dependency graph for can.h:

Go to the source code of this file.

Classes

struct  can_error_register_t
 Inhalt der Fehler-Register. More...
 
struct  can_filter_t
 Datenstruktur zur Aufnahme von CAN-Filtern. More...
 
struct  can_t
 Datenstruktur zum Aufnehmen von CAN Nachrichten. More...
 

Bitdefinitionen

#define CAN_ALL_FILTER   0xff
 Symbol um auf alle Filter zuzugreifen. More...
 
enum  can_bitrate_t {
  BITRATE_10_KBPS = 0, BITRATE_20_KBPS = 1, BITRATE_50_KBPS = 2, BITRATE_100_KBPS = 3,
  BITRATE_125_KBPS = 4, BITRATE_250_KBPS = 5, BITRATE_500_KBPS = 6, BITRATE_1_MBPS = 7,
  BITRATE_10_KBPS = 0, BITRATE_20_KBPS = 1, BITRATE_50_KBPS = 2, BITRATE_100_KBPS = 3,
  BITRATE_125_KBPS = 4, BITRATE_250_KBPS = 5, BITRATE_500_KBPS = 6, BITRATE_1_MBPS = 7
}
 Bitraten fuer den CAN-Bus. More...
 
#define ONLY_NON_RTR   2
 
#define ONLY_RTR   3
 
#define SUPPORT_EXTENDED_CANID   1
 Unterstuetzung fuer Extended-IDs aktivieren. More...
 
#define SUPPORT_TIMESTAMPS   0
 Unterstützung für Zeitstempel aktivieren. More...
 

Bits des Filters fuer den MCP2515 umformatieren

prog_uint8_t can_filter[] =
{
MCP2515_FILTER_EXTENDED(0), // Filter 0
MCP2515_FILTER_EXTENDED(0), // Filter 1
MCP2515_FILTER_EXTENDED(0), // Filter 2
MCP2515_FILTER_EXTENDED(0), // Filter 3
MCP2515_FILTER_EXTENDED(0), // Filter 4
MCP2515_FILTER_EXTENDED(0), // Filter 5
MCP2515_FILTER_EXTENDED(0), // Maske 0
MCP2515_FILTER_EXTENDED(0), // Maske 1
};
See also
can_static_filter()
Warning
Do not use this Makro for Variables, only for static values known at compile-time.
bool can_check_bus_off (void)
 
bool can_check_free_buffer (void)
 Ueberprueft ob ein Puffer zum Versenden einer Nachricht frei ist. More...
 
bool can_check_message (void)
 Ueberpruefen ob neue CAN Nachrichten vorhanden sind. More...
 
bool can_disable_filter (uint8_t number)
 Filter deaktivieren. More...
 
uint8_t can_get_filter (uint8_t number, can_filter_t *filter)
 
uint8_t can_get_message (can_t *msg)
 Liest eine Nachricht aus den Empfangspuffern des CAN Controllers. More...
 
bool can_init (can_bitrate_t bitrate)
 Initialisierung des CAN Interfaces. More...
 
enum  can_mode_t {
  LISTEN_ONLY_MODE, LOOPBACK_MODE, NORMAL_MODE, SLEEP_MODE,
  LISTEN_ONLY_MODE, LOOPBACK_MODE, NORMAL_MODE, SLEEP_MODE
}
 Modus des CAN Interfaces. More...
 
can_error_register_t can_read_error_register (void)
 Reads the Contents of the CAN Error Counter. More...
 
void can_reset_bus_off (void)
 
uint8_t can_send_message (const can_t *msg)
 Verschickt eine Nachricht über den CAN Bus. More...
 
bool can_set_filter (uint8_t number, const can_filter_t *filter)
 Setzen eines Filters. More...
 
void can_set_mode (can_mode_t mode)
 Setzt den Operations-Modus. More...
 
void can_sleep (void)
 Put CAN interface to sleep and wake up. More...
 
void can_static_filter (const uint8_t *filter_array)
 Setzt die Werte für alle Filter. More...
 
void can_wakeup (void)
 
#define MCP2515_FILTER(id)
 
#define MCP2515_FILTER_EXTENDED(id)
 

Detailed Description

Header-Datei für das allgemeine CAN Interface.

Definition in file can.h.

Macro Definition Documentation

◆ MCP2515_FILTER

#define MCP2515_FILTER (   id)
Value:
(uint8_t)((uint32_t) id >> 3), \
(uint8_t)((uint32_t) id << 5), \
0, \
0

Definition at line 165 of file can.h.

◆ MCP2515_FILTER_EXTENDED

#define MCP2515_FILTER_EXTENDED (   id)
Value:
(uint8_t) ((uint32_t) (id) >> 21), \
(uint8_t)((((uint32_t) (id) >> 13) & 0xe0) | (1<<3) | \
(((uint32_t) (id) >> 16) & 0x3)), \
(uint8_t) ((uint32_t) (id) >> 8), \
(uint8_t) ((uint32_t) (id))

Definition at line 157 of file can.h.

◆ ONLY_NON_RTR

#define ONLY_NON_RTR   2

Definition at line 76 of file can.h.

◆ ONLY_RTR

#define ONLY_RTR   3

Definition at line 77 of file can.h.

Function Documentation

◆ can_wakeup()

void can_wakeup ( void  )
MCP2515_FILTER_EXTENDED
#define MCP2515_FILTER_EXTENDED(id)
Definition: can.h:157
uavcan::uint32_t
std::uint32_t uint32_t
Definition: std.hpp:26
uavcan::uint8_t
std::uint8_t uint8_t
Definition: std.hpp:24


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:03