618
|
1 |
#ifndef CANFESTIVAL_H_
|
|
2 |
#define CANFESTIVAL_H_
|
|
3 |
|
|
4 |
#include "timerscfg.h"
|
|
5 |
#include "can_driver.h"
|
|
6 |
#include "data.h"
|
|
7 |
#include "timers_driver.h"
|
|
8 |
|
|
9 |
|
|
10 |
/** @defgroup userapi User API */
|
|
11 |
|
|
12 |
/** @defgroup can CAN management
|
|
13 |
* @ingroup userapi
|
|
14 |
*/
|
|
15 |
|
|
16 |
/**
|
|
17 |
* @brief Send a CAN message
|
|
18 |
* @param port CanFestival file descriptor
|
|
19 |
* @param *m The CAN message to send
|
|
20 |
* @return 0 if succes
|
|
21 |
*/
|
|
22 |
UNS8 canSend(CAN_PORT port, Message *m);
|
|
23 |
|
|
24 |
/**
|
|
25 |
* @ingroup can
|
|
26 |
* @brief Open a CANOpen device
|
|
27 |
* @param *board Pointer to the board structure that contains busname and baudrate
|
|
28 |
* @param *d Pointer to the CAN object data structure
|
|
29 |
* @return
|
|
30 |
* - CanFestival file descriptor is returned upon success.
|
|
31 |
* - NULL is returned if the CANOpen board can't be opened.
|
|
32 |
*/
|
|
33 |
CAN_PORT canOpen(s_BOARD *board, CO_Data * d);
|
|
34 |
|
|
35 |
/**
|
|
36 |
* @ingroup can
|
|
37 |
* @brief Close a CANOpen device
|
|
38 |
* @param *d Pointer to the CAN object data structure
|
|
39 |
* @return
|
|
40 |
* - 0 is returned upon success.
|
|
41 |
* - errorcode if error. (if implemented)
|
|
42 |
*/
|
|
43 |
int canClose(CO_Data * d);
|
|
44 |
|
|
45 |
/**
|
|
46 |
* @ingroup can
|
|
47 |
* @brief Change the CANOpen device baudrate
|
|
48 |
* @param port CanFestival file descriptor
|
|
49 |
* @param *baud The new baudrate to assign
|
|
50 |
* @return
|
|
51 |
* - 0 is returned upon success or if not supported by the CAN driver.
|
|
52 |
* - errorcode from the CAN driver is returned if an error occurs. (if implemented in the CAN driver)
|
|
53 |
*/
|
|
54 |
UNS8 canChangeBaudRate(CAN_PORT port, char* baud);
|
|
55 |
|
|
56 |
#endif
|