Zephyr Project API  3.1.0
A Scalable Open Source RTOS
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
7#ifndef ZEPHYR_INCLUDE_DRIVERS_CAN_TRANSCEIVER_H_
8#define ZEPHYR_INCLUDE_DRIVERS_CAN_TRANSCEIVER_H_
9
10#include <zephyr/device.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
33typedef int (*can_transceiver_enable_t)(const struct device *dev);
34
39typedef int (*can_transceiver_disable_t)(const struct device *dev);
40
41__subsystem struct can_transceiver_driver_api {
42 can_transceiver_enable_t enable;
43 can_transceiver_disable_t disable;
44};
45
61static inline int can_transceiver_enable(const struct device *dev)
62{
63 const struct can_transceiver_driver_api *api =
64 (const struct can_transceiver_driver_api *)dev->api;
65
66 return api->enable(dev);
67}
68
82static inline int can_transceiver_disable(const struct device *dev)
83{
84 const struct can_transceiver_driver_api *api =
85 (const struct can_transceiver_driver_api *)dev->api;
86
87 return api->disable(dev);
88}
89
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* ZEPHYR_INCLUDE_DRIVERS_CAN_TRANSCEIVER_H_ */
static int can_transceiver_enable(const struct device *dev)
Enable CAN transceiver.
Definition: transceiver.h:61
static int can_transceiver_disable(const struct device *dev)
Disable CAN transceiver.
Definition: transceiver.h:82
Runtime device structure (in ROM) per driver instance.
Definition: device.h:456
const void * api
Definition: device.h:462