Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
transceiver.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Vestas Wind Systems A/S
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_DRIVERS_CAN_TRANSCEIVER_H_
14#define ZEPHYR_INCLUDE_DRIVERS_CAN_TRANSCEIVER_H_
15
16#include <zephyr/drivers/can.h>
17#include <zephyr/device.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
31
37
42typedef int (*can_transceiver_enable_t)(const struct device *dev, can_mode_t mode);
43
48typedef int (*can_transceiver_disable_t)(const struct device *dev);
49
59
61
77static inline int can_transceiver_enable(const struct device *dev, can_mode_t mode)
78{
79 return DEVICE_API_GET(can_transceiver, dev)->enable(dev, mode);
80}
81
96static inline int can_transceiver_disable(const struct device *dev)
97{
98 return DEVICE_API_GET(can_transceiver, dev)->disable(dev);
99}
100
104
105#ifdef __cplusplus
106}
107#endif
108
109#endif /* ZEPHYR_INCLUDE_DRIVERS_CAN_TRANSCEIVER_H_ */
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1425
Header file for Controller Area Network (CAN) controller driver API.
uint32_t can_mode_t
Provides a type to hold CAN controller configuration flags.
Definition can.h:122
int(* can_transceiver_enable_t)(const struct device *dev, can_mode_t mode)
Callback API upon enabling CAN transceiver.
Definition transceiver.h:42
int(* can_transceiver_disable_t)(const struct device *dev)
Callback API upon disabling CAN transceiver.
Definition transceiver.h:48
static int can_transceiver_enable(const struct device *dev, can_mode_t mode)
Enable CAN transceiver.
Definition transceiver.h:77
static int can_transceiver_disable(const struct device *dev)
Disable CAN transceiver.
Definition transceiver.h:96
<span class="mlabel">Driver Operations</span> CAN Transceiver driver operations
Definition transceiver.h:53
can_transceiver_disable_t disable
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition transceiver.h:57
can_transceiver_enable_t enable
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition transceiver.h:55
Runtime device structure (in ROM) per driver instance.
Definition device.h:513