Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Functions | Variables
lampda::power::powerDelivery Namespace Reference

Handles the power delivery capabilities (USB-PD). More...

Classes

struct  OTGParameters
 The requested OTG parameters. More...
 
struct  PDOTypes
 Define a USB PD PDO type. More...
 
struct  UsbPDData
 USB power delivery status storage. More...
 

Functions

void suspend_pd_state_machine ()
 Suspend the execution of the power delivery state machine.
 
void resume_pd_state_machine ()
 resume the execution of the power delivery state machine
 
int get_vbus_voltage ()
 use the vbus measure from negociator (close to USBC, 0 to N volts)
 
bool can_use_PD_full_power ()
 
bool is_usb_pd ()
 
bool is_cable_detected ()
 Return true is a power cable is connected.
 
bool is_standard_port ()
 return true if this voltage source is from a standard non pd port
 
void ic_interrupt ()
 
bool is_vbus_powered ()
 
void show_pd_status ()
 Debug power delivery status.
 
void interrupt_handle ()
 
void pd_run ()
 
bool setup ()
 call once at program start, attach interrupts and init
 
void start_threads ()
 Start polling threads.
 
void loop ()
 call often (update status)
 
void shutdown ()
 call once at program end
 
uint16_t get_max_input_current ()
 return the max current available for this source
 
bool is_power_available ()
 Return true if some power is available on VBUS.
 
bool can_use_power ()
 Return true if we can use this source as power entry.
 
void force_set_to_source_mode (const bool force)
 force the system to source mode
 
OTGParameters get_otg_parameters ()
 Return the desired OTG parameters.
 
void allow_otg (const bool)
 Call to allow or forbid OTG mode.
 
bool is_switching_to_otg ()
 return true is the system is prepaping to switch to OTG mode
 
std::vector< PDOTypesget_available_pd ()
 If the charger is PD compatible, return it's capabilities.
 

Variables

static bool isPowerSourceDetected_s = false
 
static uint32_t powerSourceDetectedTime_s = 0
 
static bool should_run_pd_state_machine = true
 
uint32_t lastPDdetected = 0
 
UsbPDData data
 
static bool isSetup = false
 

Detailed Description

Handles the power delivery capabilities (USB-PD).

Function Documentation

◆ interrupt_handle()

void lampda::power::powerDelivery::interrupt_handle ( )

HEADER FUNCTIONS BELOW