Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
BC1.2 driver APIs

BC1.2 driver APIs. More...

Data Structures

struct  bc12_partner_state
 BC1.2 detected partner state. More...
 

Typedefs

typedef void(* bc12_callback_t) (const struct device *dev, struct bc12_partner_state *state, void *user_data)
 BC1.2 callback for charger configuration.
 

Enumerations

enum  bc12_role { BC12_DISCONNECTED , BC12_PORTABLE_DEVICE , BC12_CHARGING_PORT }
 BC1.2 device role. More...
 
enum  bc12_type {
  BC12_TYPE_NONE , BC12_TYPE_SDP , BC12_TYPE_DCP , BC12_TYPE_CDP ,
  BC12_TYPE_PROPRIETARY , BC12_TYPE_UNKNOWN , BC12_TYPE_COUNT
}
 BC1.2 charging partner type. More...
 

Functions

int bc12_set_role (const struct device *dev, enum bc12_role role)
 Set the BC1.2 role.
 
int bc12_set_result_cb (const struct device *dev, bc12_callback_t cb, void *user_data)
 Register a callback for BC1.2 results.
 

BC1.2 constants

#define BC12_CHARGER_VOLTAGE_UV   5000 * 1000
 BC1.2 USB charger voltage.
 
#define BC12_CHARGER_MIN_CURR_UA   2500
 BC1.2 USB charger minimum current.
 
#define BC12_CHARGER_MAX_CURR_UA   1500 * 1000
 BC1.2 USB charger maximum current.
 

Detailed Description

BC1.2 driver APIs.

Macro Definition Documentation

◆ BC12_CHARGER_MAX_CURR_UA

#define BC12_CHARGER_MAX_CURR_UA   1500 * 1000

#include <zephyr/drivers/usb/usb_bc12.h>

BC1.2 USB charger maximum current.

◆ BC12_CHARGER_MIN_CURR_UA

#define BC12_CHARGER_MIN_CURR_UA   2500

#include <zephyr/drivers/usb/usb_bc12.h>

BC1.2 USB charger minimum current.

Set to match the Isusp of 2.5 mA parameter. This is returned by the driver when either BC1.2 detection fails, or the attached partner is a SDP (standard downstream port).

The application may increase the current draw after determining the USB device state of suspended/unconfigured/configured. Suspended: 2.5 mA Unconfigured: 100 mA Configured: 500 mA (USB 2.0)

◆ BC12_CHARGER_VOLTAGE_UV

#define BC12_CHARGER_VOLTAGE_UV   5000 * 1000

#include <zephyr/drivers/usb/usb_bc12.h>

BC1.2 USB charger voltage.

Typedef Documentation

◆ bc12_callback_t

typedef void(* bc12_callback_t) (const struct device *dev, struct bc12_partner_state *state, void *user_data)

#include <zephyr/drivers/usb/usb_bc12.h>

BC1.2 callback for charger configuration.

Parameters
devBC1.2 device which is notifying of the new charger state.
stateCurrent state of the BC1.2 client, including BC1.2 type detected, voltage, and current limits. If NULL, then the partner charger is disconnected or the BC1.2 device is operating in host mode.
user_dataRequester supplied data which is passed along to the callback.

Enumeration Type Documentation

◆ bc12_role

enum bc12_role

#include <zephyr/drivers/usb/usb_bc12.h>

BC1.2 device role.

Enumerator
BC12_DISCONNECTED 
BC12_PORTABLE_DEVICE 
BC12_CHARGING_PORT 

◆ bc12_type

enum bc12_type

#include <zephyr/drivers/usb/usb_bc12.h>

BC1.2 charging partner type.

Enumerator
BC12_TYPE_NONE 

No partner connected.

BC12_TYPE_SDP 

Standard Downstream Port.

BC12_TYPE_DCP 

Dedicated Charging Port.

BC12_TYPE_CDP 

Charging Downstream Port.

BC12_TYPE_PROPRIETARY 

Proprietary charging port.

BC12_TYPE_UNKNOWN 

Unknown charging port, BC1.2 detection failed.

BC12_TYPE_COUNT 

Count of valid BC12 types.

Function Documentation

◆ bc12_set_result_cb()

int bc12_set_result_cb ( const struct device dev,
bc12_callback_t  cb,
void *  user_data 
)

#include <zephyr/drivers/usb/usb_bc12.h>

Register a callback for BC1.2 results.

Parameters
devPointer to the device structure for the BC1.2 driver instance.
cbFunction pointer for the result callback.
user_dataRequester supplied data which is passed along to the callback.
Return values
0If successful.
-EIOgeneral input/output error.

◆ bc12_set_role()

int bc12_set_role ( const struct device dev,
enum bc12_role  role 
)

#include <zephyr/drivers/usb/usb_bc12.h>

Set the BC1.2 role.

Parameters
devPointer to the device structure for the BC1.2 driver instance.
roleNew role for the BC1.2 device.
Return values
0If successful.
-EIOgeneral input/output error.