can_trx.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 OTA keys S.A.
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef CAN_CAN_TRX_H
22 #define CAN_CAN_TRX_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 typedef enum {
32  TRX_NORMAL_MODE = 0,
33  TRX_SILENT_MODE,
34  TRX_SLEEP_MODE,
35  /* single wire can modes */
36  TRX_HIGH_SPEED_MODE,
37  TRX_HIGH_VOLTAGE_WAKE_UP_MODE
39 
43 typedef struct trx_driver trx_driver_t;
44 
48 typedef struct can_trx {
51 } can_trx_t;
52 
56 struct trx_driver {
65  int (*init)(can_trx_t *dev);
66 
76  int (*set_mode)(can_trx_t *dev, can_trx_mode_t mode);
77 };
78 
87 int can_trx_init(can_trx_t *dev);
88 
99 
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* CAN_CAN_TRX_H */
106 
can_trx::driver
const trx_driver_t * driver
driver
Definition: can_trx.h:49
can_trx::mode
can_trx_mode_t mode
current mode
Definition: can_trx.h:50
trx_driver::init
int(* init)(can_trx_t *dev)
initialize the trx device
Definition: can_trx.h:65
can_trx_init
int can_trx_init(can_trx_t *dev)
initialize a transceiver
can_trx
Generic transceiver descriptor.
Definition: can_trx.h:48
can_trx_t
struct can_trx can_trx_t
Generic transceiver descriptor.
trx_driver
Generic transceiver driver.
Definition: can_trx.h:56
can_trx_mode_t
can_trx_mode_t
trx transceiver mode
Definition: can_trx.h:31
can_trx_set_mode
int can_trx_set_mode(can_trx_t *dev, can_trx_mode_t mode)
transceiver set mode
trx_driver::set_mode
int(* set_mode)(can_trx_t *dev, can_trx_mode_t mode)
set mode interface
Definition: can_trx.h:76