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:450
void shutdown()
call once at program end
Definition: power_delivery.cpp:408
void loop()
call often (update status)
Definition: power_delivery.cpp:354
void show_pd_status()
Debug power delivery status.
Definition: power_delivery.cpp:222
bool can_use_power()
Return true if we can use this source as power entry.
Definition: power_delivery.cpp:437
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:410
bool setup()
call once at program start, attach interrupts and init
Definition: power_delivery.cpp:321
int get_vbus_voltage()
use the vbus measure from negociator (close to USBC, 0 to N volts)
Definition: power_delivery.cpp:55
bool is_cable_detected()
Return true is a power cable is connected.
Definition: power_delivery.cpp:85
std::vector< PDOTypes > get_available_pd()
If the charger is PD compatible, return it's capabilities.
Definition: power_delivery.cpp:454
OTGParameters get_otg_parameters()
Return the desired OTG parameters.
Definition: power_delivery.cpp:441
bool is_power_available()
Return true if some power is available on VBUS.
Definition: power_delivery.cpp:435
bool is_switching_to_otg()
return true is the system is prepaping to switch to OTG mode
Definition: power_delivery.cpp:452
void start_threads()
Start polling threads.
Definition: power_delivery.cpp:341
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:94
void force_set_to_source_mode(const bool force)
force the system to source mode
Definition: power_delivery.cpp:439
Program scope.
Definition: control_fixed_modes.hpp:12
The requested OTG parameters.
Definition: power_delivery.h:84
uint16_t requestedCurrent_mA
Requested maximum current use for the OTG.
Definition: power_delivery.h:88
bool is_otg_requested() const
Return true if OTG is requested and should be turned on.
Definition: power_delivery.h:91
static OTGParameters get_default()
Return the default OTG targets.
Definition: power_delivery.h:96
uint16_t requestedVoltage_mV
Requested voltage for the OTG.
Definition: power_delivery.h:86
Define a USB PD PDO type.
Definition: power_delivery.h:67
uint32_t voltage_mv
Voltage of this PDO.
Definition: power_delivery.h:69
uint32_t maxCurrent_mA
Maximum current of this PDO.
Definition: power_delivery.h:71