8#ifndef USB_PD_DRIVER_H_
9#define USB_PD_DRIVER_H_
17#include "../../../../src/system/bsp/pd/usb_pd.h"
18#include "../../../../src/system/bsp/pd/config.h"
20#define PD_POWER_SUPPLY_TURN_ON_DELAY 250 * MSEC_US
21#define PD_POWER_SUPPLY_TURN_OFF_DELAY 100 * MSEC_US
24#define PD_OPERATING_POWER_MW (2250ull)
26#define PD_MIN_CURRENT_MA (100ull)
27#define PD_MIN_VOLTAGE_MV (5000ull)
28#define PD_MIN_POWER_MW (PD_MIN_VOLTAGE_MV * PD_MIN_CURRENT_MA / 1000)
30#define PD_MAX_CURRENT_MA (5000ull)
31#define PD_MAX_VOLTAGE_MV (20000ull)
32#define PD_MAX_POWER_MW (PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA / 1000)
34#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_COMM_CAP)
36#define usleep(us) (delay_us(us))
37#define msleep(ms) (delay_ms(ms))
41 uint16_t requestedVoltage_mV;
42 uint16_t requestedCurrent_mA;
64 void force_set_to_source(
int force);
70 void set_source_role_wanted(
const int wanted);
77 void set_allow_power_sourcing(
const int allowPowerSourcing);
82 void set_battery_level(
const uint8_t battLevelPercent);
87 void supsend_usb_pd(
int shouldSuspend);
92 int is_activating_otg();
95 int should_stop_vbus_charge();
97 void pd_power_supply_reset();
99 extern uint8_t get_pd_source_cnt();
100 extern uint32_t get_pd_source(
const uint8_t index);
102 extern uint32_t get_available_pd_current_mA();
103 extern uint32_t get_available_pd_voltage_mV();
106 extern void reset_cache();
108 extern void reset_source_capabilities();
111 int is_pd_conector();
117 __typeof__(a) temp_a = (a); \
118 __typeof__(b) temp_b = (b); \
120 temp_a > temp_b ? temp_a : temp_b; \
126 __typeof__(a) temp_a = (a); \
127 __typeof__(b) temp_b = (b); \
129 temp_a < temp_b ? temp_a : temp_b; \
Definition: usb_pd_driver.h:46
Definition: usb_pd_driver.h:40