Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
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
11
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
>
16
#include <
zephyr/drivers/usb/usb_bc12.h
>
17
18
#ifdef __cplusplus
19
extern
"C"
{
20
#endif
21
29
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
};
42
57
static
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
81
static
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
96
97
#endif
/* ZEPHYR_INCLUDE_DRIVERS_USB_EMUL_BC12_H_ */
emul.h
bc12_emul_set_pd_partner
static int bc12_emul_set_pd_partner(const struct emul *target, bool connected)
Set the portable device partner state.
Definition
emul_bc12.h:81
bc12_emul_set_charging_partner
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
bc12_type
BC1.2 charging partner type.
Definition
usb_bc12.h:72
emul
An emulator instance - represents the target emulated device/peripheral that is interacted with throu...
Definition
emul.h:82
emul::backend_api
const void * backend_api
Address of the API structure exposed by the emulator instance.
Definition
emul.h:103
usb_bc12.h
Public APIs for the USB BC1.2 battery charging detect drivers.
zephyr
drivers
usb
emul_bc12.h
Generated on
for Zephyr API by
1.17.0