USB-PD sink protocol logic, independent of the PHY chip.
More...
#include <pd.h>
USB-PD sink protocol logic, independent of the PHY chip.
Everything except the getters and set_request_voltage() runs in the PHY task, which must also call check_transition_timeout_() and check_request_retry_() regularly; the protocol has no timers of its own.
Definition at line 106 of file pd.h.
◆ check_ams_()
| bool esphome::fusb302b::PowerDelivery::check_ams_ |
( |
| ) |
|
|
protected |
Returns true while an atomic message sequence is in progress.
Ends it after a timeout, which fails the request unless the source already accepted a new contract.
Definition at line 116 of file pd.cpp.
◆ check_request_retry_()
| void esphome::fusb302b::PowerDelivery::check_request_retry_ |
( |
| ) |
|
|
protected |
Sends the last request again once tSinkRequest has passed after the source answered Wait.
Definition at line 128 of file pd.cpp.
◆ check_transition_timeout_()
| void esphome::fusb302b::PowerDelivery::check_transition_timeout_ |
( |
| ) |
|
|
protected |
Falls back to default power when the source accepted a request but did not report the new supply ready in time.
Definition at line 160 of file pd.cpp.
◆ clear_contract_()
| void esphome::fusb302b::PowerDelivery::clear_contract_ |
( |
| ) |
|
|
protected |
◆ get_request_voltage()
| uint8_t esphome::fusb302b::PowerDelivery::get_request_voltage |
( |
| ) |
const |
|
inline |
Definition at line 111 of file pd.h.
◆ get_state()
| PdState esphome::fusb302b::PowerDelivery::get_state |
( |
| ) |
const |
|
inline |
Definition at line 113 of file pd.h.
◆ handle_message_()
| void esphome::fusb302b::PowerDelivery::handle_message_ |
( |
const PdMsg & | msg | ) |
|
|
protected |
◆ handle_transmit_failed_()
| void esphome::fusb302b::PowerDelivery::handle_transmit_failed_ |
( |
| ) |
|
|
protected |
Called by the PHY when the chip gave up on a message after its retries without receiving a GoodCRC.
Definition at line 169 of file pd.cpp.
◆ is_connected()
| bool esphome::fusb302b::PowerDelivery::is_connected |
( |
| ) |
const |
|
inline |
Definition at line 114 of file pd.h.
◆ make_control_msg_()
◆ make_data_msg_()
◆ on_request_failed()
| virtual void esphome::fusb302b::PowerDelivery::on_request_failed |
( |
| ) |
|
|
protectedpure virtual |
Called when a request ended without a new contract: it was rejected, the source kept answering Wait or did not answer in time, or it could not be sent.
A contract already in place stays valid.
Implemented in esphome::fusb302b::FUSB302B.
◆ on_soft_reset_received()
| virtual void esphome::fusb302b::PowerDelivery::on_soft_reset_received |
( |
| ) |
|
|
protectedpure virtual |
◆ on_source_caps_received()
| virtual void esphome::fusb302b::PowerDelivery::on_source_caps_received |
( |
| ) |
|
|
protectedpure virtual |
◆ on_state_changed()
| virtual void esphome::fusb302b::PowerDelivery::on_state_changed |
( |
| ) |
|
|
protectedpure virtual |
◆ on_transition_timeout()
| virtual void esphome::fusb302b::PowerDelivery::on_transition_timeout |
( |
| ) |
|
|
protectedpure virtual |
Called after an accepted request was not followed by PS_RDY in time and the state fell back to default power; the PHY sends a soft reset so the source offers its capabilities again.
Implemented in esphome::fusb302b::FUSB302B.
◆ reset_protocol_()
| void esphome::fusb302b::PowerDelivery::reset_protocol_ |
( |
| ) |
|
|
protected |
◆ send_message()
| virtual bool esphome::fusb302b::PowerDelivery::send_message |
( |
const PdMsg & | msg | ) |
|
|
protectedpure virtual |
◆ set_ams_()
| void esphome::fusb302b::PowerDelivery::set_ams_ |
( |
bool | active | ) |
|
|
protected |
◆ set_contract_()
| void esphome::fusb302b::PowerDelivery::set_contract_ |
( |
const PdContract & | contract | ) |
|
|
protected |
◆ set_request_voltage()
| void esphome::fusb302b::PowerDelivery::set_request_voltage |
( |
uint8_t | voltage | ) |
|
|
inline |
Definition at line 108 of file pd.h.
◆ set_state_()
| void esphome::fusb302b::PowerDelivery::set_state_ |
( |
PdState | state | ) |
|
|
protected |
◆ set_state_and_contract_()
| void esphome::fusb302b::PowerDelivery::set_state_and_contract_ |
( |
PdState | state, |
|
|
const PdContract & | contract ) |
|
protected |
Stores both before calling on_state_changed() once, so the main loop never sees the new state with the old contract.
Definition at line 98 of file pd.cpp.
◆ ams_start_
| uint32_t esphome::fusb302b::PowerDelivery::ams_start_ {0} |
|
protected |
Definition at line 160 of file pd.h.
◆ contract_
| std::atomic<uint32_t> esphome::fusb302b::PowerDelivery::contract_ {0} |
|
protected |
Definition at line 156 of file pd.h.
◆ request_voltage_
| std::atomic<uint8_t> esphome::fusb302b::PowerDelivery::request_voltage_ {5} |
|
protected |
Definition at line 157 of file pd.h.
◆ retry_request_pending_
| bool esphome::fusb302b::PowerDelivery::retry_request_pending_ {false} |
|
protected |
Definition at line 162 of file pd.h.
◆ state_
Definition at line 155 of file pd.h.
◆ wait_received_ms_
| uint32_t esphome::fusb302b::PowerDelivery::wait_received_ms_ {0} |
|
protected |
Definition at line 161 of file pd.h.
The documentation for this class was generated from the following files:
- esphome/components/fusb302b/pd.h
- esphome/components/fusb302b/pd.cpp