8#ifndef USB_PD_DRIVER_H_
9#define USB_PD_DRIVER_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);
71 void set_allow_power_sourcing(
const int allowPowerSourcing);
76 void set_battery_level(
const uint8_t battLevelPercent);
81 void supsend_usb_pd(
int shouldSuspend);
86 int is_activating_otg();
89 int should_stop_vbus_charge();
91 void pd_power_supply_reset();
93 extern uint8_t get_pd_source_cnt();
94 extern uint32_t get_pd_source(
const uint8_t index);
96 extern uint32_t get_available_pd_current_mA();
97 extern uint32_t get_available_pd_voltage_mV();
100 extern void reset_cache();
103 int is_pd_conector();
109 __typeof__(a) temp_a = (a); \
110 __typeof__(b) temp_b = (b); \
112 temp_a > temp_b ? temp_a : temp_b; \
118 __typeof__(a) temp_a = (a); \
119 __typeof__(b) temp_b = (b); \
121 temp_a < temp_b ? temp_a : temp_b; \
Definition: usb_pd_driver.h:46
Definition: usb_pd_driver.h:40