Zephyr Project API 4.2.99
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
35__subsystem struct bc12_emul_driver_api {
36 int (*set_charging_partner)(const struct emul *emul, enum bc12_type partner_type);
37 int (*set_pd_partner)(const struct emul *emul, bool connected);
38};
57static inline int bc12_emul_set_charging_partner(const struct emul *target,
58 enum bc12_type partner_type)
59{
60 const struct bc12_emul_driver_api *backend_api =
61 (const struct bc12_emul_driver_api *)target->backend_api;
62
63 return backend_api->set_charging_partner(target, partner_type);
64}
65
81static inline int bc12_emul_set_pd_partner(const struct emul *target, bool connected)
82{
83 const struct bc12_emul_driver_api *backend_api =
84 (const struct bc12_emul_driver_api *)target->backend_api;
85
86 return backend_api->set_pd_partner(target, connected);
87}
88
89#ifdef __cplusplus
90}
91#endif
92
97#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:81
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:57
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:82
const void * backend_api
Address of the API structure exposed by the emulator instance.
Definition emul.h:103
Public APIs for the USB BC1.2 battery charging detect drivers.