5#ifndef BSP_PD_POWER_DELIVERY_H
6#define BSP_PD_POWER_DELIVERY_H
14namespace powerDelivery {
void allow_otg(const bool allow)
Call to allow or forbid OTG mode.
Definition: power_delivery.cpp:460
void shutdown()
call once at program end
Definition: power_delivery.cpp:418
void loop()
call often (update status)
Definition: power_delivery.cpp:364
void show_pd_status()
Debug power delivery status.
Definition: power_delivery.cpp:214
bool can_use_power()
Return true if we can use this source as power entry.
Definition: power_delivery.cpp:447
void suspend_pd_state_machine()
Suspend the execution of the power delivery state machine.
Definition: power_delivery.cpp:42
uint16_t get_max_input_current()
return the max current available for this source
Definition: power_delivery.cpp:420
bool setup()
call once at program start, attach interrupts and init
Definition: power_delivery.cpp:313
int get_vbus_voltage()
use the vbus measure from negociator (close to USBC, 0 to N volts)
Definition: power_delivery.cpp:55
std::vector< PDOTypes > get_available_pd()
If the charger is PD compatible, return it's capabilities.
Definition: power_delivery.cpp:464
OTGParameters get_otg_parameters()
Return the desired OTG parameters.
Definition: power_delivery.cpp:451
bool is_power_available()
Return true if some power is available on VBUS.
Definition: power_delivery.cpp:445
bool is_switching_to_otg()
return true is the system is prepaping to switch to OTG mode
Definition: power_delivery.cpp:462
void start_threads()
Start polling threads.
Definition: power_delivery.cpp:333
void resume_pd_state_machine()
resume the execution of the power delivery state machine
Definition: power_delivery.cpp:48
bool is_standard_port()
return true if this voltage source is from a standard non pd port
Definition: power_delivery.cpp:86
void force_set_to_source_mode(const bool force)
force the system to source mode
Definition: power_delivery.cpp:449
Program scope.
Definition: control_fixed_modes.hpp:15
The requested OTG parameters.
Definition: power_delivery.h:81
uint16_t requestedCurrent_mA
Requested maximum current use for the OTG.
Definition: power_delivery.h:85
bool is_otg_requested() const
Return true if OTG is requested and should be turned on.
Definition: power_delivery.h:88
static OTGParameters get_default()
Return the default OTG targets.
Definition: power_delivery.h:93
uint16_t requestedVoltage_mV
Requested voltage for the OTG.
Definition: power_delivery.h:83
Define a USB PD PDO type.
Definition: power_delivery.h:64
uint32_t voltage_mv
Voltage of this PDO.
Definition: power_delivery.h:66
uint32_t maxCurrent_mA
Maximum current of this PDO.
Definition: power_delivery.h:68