34 void setup()
override;
87 bool measure_cc_(uint8_t meas_switch, uint8_t &level);
136#ifdef USE_TEXT_SENSOR
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 add_on_request_failed_callback(F &&callback)
Called when a voltage request was rejected, got no answer, or was dropped because the component faile...
void start_source_cap_wait_(SourceCapStep step)
text_sensor::TextSensor * contract_text_sensor_
bool read_message_(PdMsg &msg, bool &is_sop)
void on_transition_timeout() override
void set_voltage_sensor(sensor::Sensor *sensor)
void request_voltage(int voltage)
Negotiate a new contract with the highest source voltage that does not exceed voltage.
void on_source_caps_received() override
InternalGPIOPin * interrupt_pin_
void check_source_caps_()
float get_setup_priority() const override
void handle_hard_reset_()
std::array< uint8_t, EVENT_QUEUE_SIZE > event_queue_
FUSB302B(InternalGPIOPin *interrupt_pin)
void publish_state_(PdState state)
static constexpr uint8_t EVENT_REQUEST_FAILED
void on_shutdown() override
void set_contract_text_sensor(text_sensor::TextSensor *sensor)
LazyCallbackManager< void()> request_failed_callback_
sensor::Sensor * voltage_sensor_
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_()
void set_current_sensor(sensor::Sensor *sensor)
std::atomic< uint8_t > event_queue_head_
SourceCapStep source_cap_step_
@ SOURCE_CAP_STEP_GET_SENT
@ SOURCE_CAP_STEP_SOFT_RESET_SENT
sensor::Sensor * current_sensor_
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 add_on_state_callback(F &&callback)
Callbacks receive each new state in order, with the state before it.
void source_caps_failed_()
void on_soft_reset_received() override
void dump_config() 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.
Base-class for all sensors.
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.