Nut/OS  4.10.3
API Reference
CAN Devices
Collaboration diagram for CAN Devices:

Data Structures

struct  _CANFRAME
 CAN frame structure. More...
struct  _CANINFO
 CAN controller information structure. More...
struct  ifcan
 CAN interface structure. More...

Defines

#define CAN_IF_2A   0x01
#define CAN_IF_2B   0x02
#define CAN_SPEED_10K   0
 10 kbit/s, max. cable length 5000 m
#define CAN_SPEED_20K   1
 20 kbit/s, max. cable length 2500 m
#define CAN_SPEED_50K   2
 50 kbit/s, max. cable length 1000 m
#define CAN_SPEED_100K   3
 100 kbit/s, max. cable length 600 m
#define CAN_SPEED_125K   4
 125 kbit/s, max. cable length 500 m
#define CAN_SPEED_250K   5
 250 kbit/s, max. cable length 250 m
#define CAN_SPEED_500K   6
 500 kbit/s, max. cable length 100 m
#define CAN_SPEED_800K   7
 800 kbit/s, max. cable length 50 m
#define CAN_SPEED_1M   8
 1 Mbit/s, max. cable length 25 m
#define CAN_SPEED_CUSTOM   255

Typedefs

typedef struct _CANFRAME CANFRAME
 CAN frame type.
typedef struct _CANINFO CANINFO
 CAN controller information type.
typedef struct ifcan IFCAN
 Canbus interface type.

Functions

uint8_t CAN_SetSpeed (NUTDEVICE *dev, uint32_t baudrate)
void CAN_SetFilter (NUTDEVICE *dev, uint8_t *ac, uint8_t *am)
void CAN_TxFrame (NUTDEVICE *dev, CANFRAME *frame)
uint8_t CAN_TryTxFrame (NUTDEVICE *dev, CANFRAME *frame)
uint8_t CAN_TxFree (NUTDEVICE *dev)
uint8_t CAN_RxFrame (NUTDEVICE *dev, CANFRAME *frame)
uint8_t CAN_TryRxFrame (NUTDEVICE *dev, CANFRAME *frame)
uint8_t CAN_RxAvail (NUTDEVICE *dev)
void CAN_SetRxTimeout (NUTDEVICE *dev, uint32_t timeout)

Define Documentation

#define CAN_IF_2A   0x01

Definition at line 76 of file can_dev.h.

#define CAN_IF_2B   0x02

Definition at line 77 of file can_dev.h.

#define CAN_SPEED_10K   0

10 kbit/s, max. cable length 5000 m

Definition at line 83 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_20K   1

20 kbit/s, max. cable length 2500 m

Definition at line 84 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_50K   2

50 kbit/s, max. cable length 1000 m

Definition at line 85 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_100K   3

100 kbit/s, max. cable length 600 m

Definition at line 86 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_125K   4

125 kbit/s, max. cable length 500 m

Definition at line 87 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_250K   5

250 kbit/s, max. cable length 250 m

Definition at line 88 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_500K   6

500 kbit/s, max. cable length 100 m

Definition at line 89 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_800K   7

800 kbit/s, max. cable length 50 m

Definition at line 90 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_1M   8

1 Mbit/s, max. cable length 25 m

Definition at line 91 of file can_dev.h.

Referenced by AtCanSetBaudrate(), SJAInit(), and SJASetBaudrate().

#define CAN_SPEED_CUSTOM   255

Definition at line 92 of file can_dev.h.

Referenced by AtCanSetBaudrate().


Typedef Documentation

typedef struct _CANFRAME CANFRAME

CAN frame type.

Definition at line 112 of file can_dev.h.

typedef struct _CANINFO CANINFO

CAN controller information type.

Definition at line 131 of file can_dev.h.

typedef struct ifcan IFCAN

Canbus interface type.

Definition at line 158 of file can_dev.h.


Function Documentation

uint8_t CAN_SetSpeed ( NUTDEVICE dev,
uint32_t  baudrate 
)

Definition at line 83 of file can_dev.c.

References _NUTDEVICE::dev_icb.

void CAN_SetFilter ( NUTDEVICE dev,
uint8_t ac,
uint8_t am 
)

Definition at line 88 of file can_dev.c.

References _NUTDEVICE::dev_icb.

void CAN_TxFrame ( NUTDEVICE dev,
CANFRAME frame 
)

Definition at line 94 of file can_dev.c.

References _NUTDEVICE::dev_icb.

uint8_t CAN_TryTxFrame ( NUTDEVICE dev,
CANFRAME frame 
)

Definition at line 99 of file can_dev.c.

References _NUTDEVICE::dev_icb.

uint8_t CAN_TxFree ( NUTDEVICE dev)

Definition at line 108 of file can_dev.c.

References _NUTDEVICE::dev_icb.

uint8_t CAN_RxFrame ( NUTDEVICE dev,
CANFRAME frame 
)

Definition at line 113 of file can_dev.c.

References _NUTDEVICE::dev_icb.

uint8_t CAN_TryRxFrame ( NUTDEVICE dev,
CANFRAME frame 
)

Definition at line 118 of file can_dev.c.

References _NUTDEVICE::dev_icb.

uint8_t CAN_RxAvail ( NUTDEVICE dev)

Definition at line 127 of file can_dev.c.

References _NUTDEVICE::dev_icb.

void CAN_SetRxTimeout ( NUTDEVICE dev,
uint32_t  timeout 
)

Sets the CAN receive timeout

Parameters:
devPointer to the device structure
timeoutTimeout in milliseconds, NUT_WAIT_INFINITE = no time-out
Warning:
Timeout values are given in milliseconds and are limited to the granularity of the system timer. To disable timeout, set the parameter to NUT_WAIT_INFINITE.

Definition at line 142 of file can_dev.c.

References _NUTDEVICE::dev_icb.