-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathcoal_can.h
62 lines (53 loc) · 1.6 KB
/
coal_can.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*********************************************************************
* _ _ _
* _ __ | |_ _ | | __ _ | |__ ___
* | '__|| __|(_)| | / _` || '_ \ / __|
* | | | |_ _ | || (_| || |_) |\__ \
* |_| \__|(_)|_| \__,_||_.__/ |___/
*
* www.rt-labs.com
* Copyright 2017 rt-labs AB, Sweden.
*
* This software is dual-licensed under GPLv3 and a commercial
* license. See the file LICENSE.md distributed with this software for
* full license information.
********************************************************************/
#ifndef COAL_CAN_H
#define COAL_CAN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "coal_can_sys.h"
#ifndef OS_CHANNEL
typedef void os_channel_t;
#endif
typedef struct os_channel_state
{
bool overrun;
bool error_passive;
bool bus_off;
} os_channel_state_t;
os_channel_t * os_channel_open (const char * name, void * callback, void * arg);
int os_channel_send (
os_channel_t * channel,
uint32_t id,
const void * data,
size_t dlc);
int os_channel_send_rtr (os_channel_t * channel, uint32_t id, size_t dlc);
int os_channel_receive (
os_channel_t * channel,
uint32_t * id,
void * data,
size_t * dlc);
int os_channel_set_bitrate (os_channel_t * channel, int bitrate);
int os_channel_set_filter (os_channel_t * channel, uint8_t * filter, size_t size);
int os_channel_bus_on (os_channel_t * channel);
int os_channel_bus_off (os_channel_t * channel);
int os_channel_get_state (os_channel_t * channel, os_channel_state_t * state);
#ifdef __cplusplus
}
#endif
#endif /* COAL_CAN_H */