Lely core libraries 2.3.4
can.h
Go to the documentation of this file.
1
22#ifndef LELY_IO_CAN_H_
23#define LELY_IO_CAN_H_
24
25#include <lely/io/io.h>
26
27// The CAN or CAN FD format frame struct from <lely/can/msg.h>.
28struct can_msg;
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42io_handle_t io_open_can(const char *path);
43
55int io_can_read(io_handle_t handle, struct can_msg *msg);
56
66int io_can_write(io_handle_t handle, const struct can_msg *msg);
67
77int io_can_start(io_handle_t handle);
78
88int io_can_stop(io_handle_t handle);
89
98
107int io_can_get_error(io_handle_t handle, int *perror);
108
116int io_can_get_ec(io_handle_t handle, uint16_t *ptxec, uint16_t *prxec);
117
127int io_can_get_bitrate(io_handle_t handle, uint32_t *pbitrate);
128
141int io_can_set_bitrate(io_handle_t handle, uint32_t bitrate);
142
152int io_can_get_txqlen(io_handle_t handle, size_t *ptxqlen);
153
164int io_can_set_txqlen(io_handle_t handle, size_t txqlen);
165
166#ifdef __cplusplus
167}
168#endif
169
170#endif // !LELY_IO_CAN_H_
int io_can_get_error(io_handle_t handle, int *perror)
Obtains and clears the current error number of a CAN device, and stores the value (any combination of...
Definition can.c:436
int io_can_set_txqlen(io_handle_t handle, size_t txqlen)
Sets the length of the transmission queue (in number of CAN frames) of a CAN device.
Definition can.c:626
int io_can_stop(io_handle_t handle)
Stops transmission and reception on a CAN device.
Definition can.c:354
int io_can_write(io_handle_t handle, const struct can_msg *msg)
Writes a single CAN or CAN FD frame.
Definition can.c:276
int io_can_get_txqlen(io_handle_t handle, size_t *ptxqlen)
Obtains the length of the transmission queue (in number of CAN frames) of a CAN device and stores the...
Definition can.c:589
io_handle_t io_open_can(const char *path)
Opens a CAN device.
Definition can.c:111
int io_can_read(io_handle_t handle, struct can_msg *msg)
Reads a single CAN or CAN FD frame.
Definition can.c:218
int io_can_get_ec(io_handle_t handle, uint16_t *ptxec, uint16_t *prxec)
Obtains the transmit and/or receive error count of a CAN device and stores the value in *ptxec and/or...
Definition can.c:458
int io_can_start(io_handle_t handle)
Starts transmission and reception on a CAN device.
Definition can.c:322
int io_can_set_bitrate(io_handle_t handle, uint32_t bitrate)
Sets the bitrate (in bit/s) of a CAN device.
Definition can.c:536
int io_can_get_state(io_handle_t handle)
Obtains the state of a CAN device.
Definition can.c:388
int io_can_get_bitrate(io_handle_t handle, uint32_t *pbitrate)
Obtains the bitrate (in bit/s) of a CAN device and stores the value in *pbitrate.
Definition can.c:498
This is the public header file of the I/O library.
A CAN or CAN FD format frame.
Definition msg.h:87
An I/O device handle.
Definition handle.h:33