Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
emul_bc12.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Google LLC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_DRIVERS_USB_EMUL_BC12_H_
13#define ZEPHYR_INCLUDE_DRIVERS_USB_EMUL_BC12_H_
14
15#include <zephyr/drivers/emul.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
34__subsystem struct bc12_emul_driver_api {
35 int (*set_charging_partner)(const struct emul *emul, enum bc12_type partner_type);
36 int (*set_pd_partner)(const struct emul *emul, bool connected);
37};
56static inline int bc12_emul_set_charging_partner(const struct emul *target,
57 enum bc12_type partner_type)
58{
59 const struct bc12_emul_driver_api *backend_api =
60 (const struct bc12_emul_driver_api *)target->backend_api;
61
62 return backend_api->set_charging_partner(target, partner_type);
63}
64
80static inline int bc12_emul_set_pd_partner(const struct emul *target, bool connected)
81{
82 const struct bc12_emul_driver_api *backend_api =
83 (const struct bc12_emul_driver_api *)target->backend_api;
84
85 return backend_api->set_pd_partner(target, connected);
86}
87
88#ifdef __cplusplus
89}
90#endif
91
96#endif /* ZEPHYR_INCLUDE_DRIVERS_USB_EMUL_BC12_H_ */
static int bc12_emul_set_pd_partner(const struct emul *target, bool connected)
Set the portable device partner state.
Definition emul_bc12.h:80
static int bc12_emul_set_charging_partner(const struct emul *target, enum bc12_type partner_type)
Set the charging partner type connected to the BC1.2 device.
Definition emul_bc12.h:56
bc12_type
BC1.2 charging partner type.
Definition usb_bc12.h:72
An emulator instance - represents the target emulated device/peripheral that is interacted with throu...
Definition emul.h:80
const void * backend_api
Address of the API structure exposed by the emulator instance.
Definition emul.h:100
Public APIs for the USB BC1.2 battery charging detect drivers.