36 SUB_TEXT_SENSOR(contract)
42 void setup()
override;
44 void dump_config()
override;
45 void on_shutdown()
override;
50 void request_voltage(
int voltage);
53 template<
typename F>
void add_on_state_callback(F &&callback) {
58 template<
typename F>
void add_on_request_failed_callback(F &&callback) {
87 bool measure_cc_(uint8_t meas_switch, uint8_t &level);
Helper for FreeRTOS static task management.
FUSB302B USB Type-C / Power Delivery sink controller.
std::atomic< bool > event_queue_overflow_
LazyCallbackManager< void(PdState, PdState)> state_callback_
static constexpr uint8_t EVENT_QUEUE_SIZE
void publish_contract_(PackedContract contract)
void start_source_cap_wait_(SourceCapStep step)
bool read_message_(PdMsg &msg, bool &is_sop)
void on_transition_timeout() override
void on_source_caps_received() override
InternalGPIOPin * interrupt_pin_
void check_source_caps_()
void handle_hard_reset_()
std::array< uint8_t, EVENT_QUEUE_SIZE > event_queue_
void publish_state_(PdState state)
static constexpr uint8_t EVENT_REQUEST_FAILED
LazyCallbackManager< void()> request_failed_callback_
uint32_t published_contract_
std::atomic< uint8_t > dropped_request_failures_
std::atomic< uint8_t > event_queue_tail_
uint32_t source_cap_step_start_
void on_state_changed() override
bool waiting_for_source_caps_
static void gpio_intr(FUSB302B *arg)
void start_negotiation_()
std::atomic< uint8_t > event_queue_head_
SourceCapStep source_cap_step_
@ SOURCE_CAP_STEP_GET_SENT
@ SOURCE_CAP_STEP_SOFT_RESET_SENT
bool cc_ambiguous_logged_
void queue_event_(uint8_t event)
static void task_func(void *arg)
void on_request_failed() override
bool send_message(const PdMsg &msg) override
void source_caps_failed_()
void on_soft_reset_received() override
bool measure_cc_(uint8_t meas_switch, uint8_t &level)
USB-PD sink protocol logic, independent of the PHY chip.
This Class provides the methods to read/write bytes from/to an i2c device.
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
A contract packed into one word so it can be shared between tasks as an atomic.