ESPHome  2022.6.2
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
esphome::apds9960::APDS9960 Class Reference

#include <apds9960.h>

Inheritance diagram for esphome::apds9960::APDS9960:
esphome::PollingComponent esphome::i2c::I2CDevice esphome::Component

Public Member Functions

void setup () override
void dump_config () override
float get_setup_priority () const override
void update () override
void loop () override
void set_red_channel (sensor::Sensor *red_channel)
void set_green_channel (sensor::Sensor *green_channel)
void set_blue_channel (sensor::Sensor *blue_channel)
void set_clear_channel (sensor::Sensor *clear_channel)
void set_up_direction (binary_sensor::BinarySensor *up_direction)
void set_right_direction (binary_sensor::BinarySensor *right_direction)
void set_down_direction (binary_sensor::BinarySensor *down_direction)
void set_left_direction (binary_sensor::BinarySensor *left_direction)
void set_proximity (sensor::Sensor *proximity)
- Public Member Functions inherited from esphome::PollingComponent
 PollingComponent ()
 PollingComponent (uint32_t update_interval)
 Initialize this polling component with the given update interval in ms. More...
virtual void set_update_interval (uint32_t update_interval)
 Manually set the update interval in ms for this polling object. More...
void call_setup () override
virtual uint32_t get_update_interval () const
 Get the update interval in ms of this sensor. More...
- Public Member Functions inherited from esphome::Component
float get_actual_setup_priority () const
void set_setup_priority (float priority)
virtual float get_loop_priority () const
 priority of loop(). More...
void call ()
virtual void on_shutdown ()
virtual void on_safe_shutdown ()
uint32_t get_component_state () const
virtual void mark_failed ()
 Mark this component as failed. More...
bool is_failed ()
virtual bool can_proceed ()
bool status_has_warning ()
bool status_has_error ()
void status_set_warning ()
void status_set_error ()
void status_clear_warning ()
void status_clear_error ()
void status_momentary_warning (const std::string &name, uint32_t length=5000)
void status_momentary_error (const std::string &name, uint32_t length=5000)
bool has_overridden_loop () const
void set_component_source (const char *source)
 Set where this component was loaded from for some debug messages. More...
const char * get_component_source () const
 Get the integration where this component was declared as a string. More...
- Public Member Functions inherited from esphome::i2c::I2CDevice
 I2CDevice ()=default
void set_i2c_address (uint8_t address)
void set_i2c_bus (I2CBus *bus)
I2CRegister reg (uint8_t a_register)
ErrorCode read (uint8_t *data, size_t len)
ErrorCode read_register (uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
ErrorCode write (const uint8_t *data, uint8_t len, bool stop=true)
ErrorCode write_register (uint8_t a_register, const uint8_t *data, size_t len, bool stop=true)
bool read_bytes (uint8_t a_register, uint8_t *data, uint8_t len)
bool read_bytes_raw (uint8_t *data, uint8_t len)
template<size_t N>
optional< std::array< uint8_t, N > > read_bytes (uint8_t a_register)
template<size_t N>
optional< std::array< uint8_t, N > > read_bytes_raw ()
bool read_bytes_16 (uint8_t a_register, uint16_t *data, uint8_t len)
bool read_byte (uint8_t a_register, uint8_t *data, bool stop=true)
optional< uint8_t > read_byte (uint8_t a_register)
bool read_byte_16 (uint8_t a_register, uint16_t *data)
bool write_bytes (uint8_t a_register, const uint8_t *data, uint8_t len, bool stop=true)
bool write_bytes (uint8_t a_register, const std::vector< uint8_t > &data)
template<size_t N>
bool write_bytes (uint8_t a_register, const std::array< uint8_t, N > &data)
bool write_bytes_16 (uint8_t a_register, const uint16_t *data, uint8_t len)
bool write_byte (uint8_t a_register, uint8_t data, bool stop=true)
bool write_byte_16 (uint8_t a_register, uint16_t data)

Protected Types


Protected Member Functions

bool is_color_enabled_ () const
bool is_proximity_enabled_ () const
bool is_gesture_enabled_ () const
void read_color_data_ (uint8_t status)
void read_proximity_data_ (uint8_t status)
void read_gesture_data_ ()
void report_gesture_ (int gesture)
void process_dataset_ (int up, int down, int left, int right)
- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
virtual void call_dump_config ()
void set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a unique name. More...
void set_interval (uint32_t interval, std::function< void()> &&f)
bool cancel_interval (const std::string &name)
 Cancel an interval function. More...
void set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult()> &&f, float backoff_increase_factor=1.0f)
 Set an retry function with a unique name. More...
void set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult()> &&f, float backoff_increase_factor=1.0f)
bool cancel_retry (const std::string &name)
 Cancel a retry function. More...
void set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a unique name. More...
void set_timeout (uint32_t timeout, std::function< void()> &&f)
bool cancel_timeout (const std::string &name)
 Cancel a timeout function. More...
void defer (const std::string &name, std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
bool cancel_defer (const std::string &name)
 Cancel a defer callback using the specified name, name must not be empty. More...

Protected Attributes

sensor::Sensorred_channel_ {nullptr}
sensor::Sensorgreen_channel_ {nullptr}
sensor::Sensorblue_channel_ {nullptr}
sensor::Sensorclear_channel_ {nullptr}
binary_sensor::BinarySensorup_direction_ {nullptr}
binary_sensor::BinarySensorright_direction_ {nullptr}
binary_sensor::BinarySensordown_direction_ {nullptr}
binary_sensor::BinarySensorleft_direction_ {nullptr}
sensor::Sensorproximity_ {nullptr}
enum esphome::apds9960::APDS9960::ErrorCode NONE
bool gesture_up_started_ {false}
bool gesture_down_started_ {false}
bool gesture_left_started_ {false}
bool gesture_right_started_ {false}
uint32_t gesture_start_ {0}
- Protected Attributes inherited from esphome::PollingComponent
uint32_t update_interval_
- Protected Attributes inherited from esphome::Component
uint32_t component_state_ {0x0000}
 State of this component. More...
float setup_priority_override_ {NAN}
const char * component_source_ = nullptr
- Protected Attributes inherited from esphome::i2c::I2CDevice
uint8_t address_ {0x00}
I2CBusbus_ {nullptr}

Detailed Description

Definition at line 11 of file apds9960.h.

Member Enumeration Documentation

◆ ErrorCode


Definition at line 48 of file apds9960.h.

Member Function Documentation

◆ dump_config()

void esphome::apds9960::APDS9960::dump_config ( )

Reimplemented from esphome::Component.

Definition at line 124 of file apds9960.cpp.

◆ get_setup_priority()

float esphome::apds9960::APDS9960::get_setup_priority ( ) const

Reimplemented from esphome::Component.

Definition at line 368 of file apds9960.cpp.

◆ is_color_enabled_()

bool esphome::apds9960::APDS9960::is_color_enabled_ ( ) const

Definition at line 119 of file apds9960.cpp.

◆ is_gesture_enabled_()

bool esphome::apds9960::APDS9960::is_gesture_enabled_ ( ) const

Definition at line 370 of file apds9960.cpp.

◆ is_proximity_enabled_()

bool esphome::apds9960::APDS9960::is_proximity_enabled_ ( ) const

Definition at line 369 of file apds9960.cpp.

◆ loop()

void esphome::apds9960::APDS9960::loop ( )

Reimplemented from esphome::Component.

Definition at line 160 of file apds9960.cpp.

◆ process_dataset_()

void esphome::apds9960::APDS9960::process_dataset_ ( int  up,
int  down,
int  left,
int  right 

Definition at line 295 of file apds9960.cpp.

◆ read_color_data_()

void esphome::apds9960::APDS9960::read_color_data_ ( uint8_t  status)

Definition at line 162 of file apds9960.cpp.

◆ read_gesture_data_()

void esphome::apds9960::APDS9960::read_gesture_data_ ( )

Definition at line 210 of file apds9960.cpp.

◆ read_proximity_data_()

void esphome::apds9960::APDS9960::read_proximity_data_ ( uint8_t  status)

Definition at line 194 of file apds9960.cpp.

◆ report_gesture_()

void esphome::apds9960::APDS9960::report_gesture_ ( int  gesture)

Definition at line 259 of file apds9960.cpp.

◆ set_blue_channel()

void esphome::apds9960::APDS9960::set_blue_channel ( sensor::Sensor blue_channel)

Definition at line 21 of file apds9960.h.

◆ set_clear_channel()

void esphome::apds9960::APDS9960::set_clear_channel ( sensor::Sensor clear_channel)

Definition at line 22 of file apds9960.h.

◆ set_down_direction()

void esphome::apds9960::APDS9960::set_down_direction ( binary_sensor::BinarySensor down_direction)

Definition at line 25 of file apds9960.h.

◆ set_green_channel()

void esphome::apds9960::APDS9960::set_green_channel ( sensor::Sensor green_channel)

Definition at line 20 of file apds9960.h.

◆ set_left_direction()

void esphome::apds9960::APDS9960::set_left_direction ( binary_sensor::BinarySensor left_direction)

Definition at line 26 of file apds9960.h.

◆ set_proximity()

void esphome::apds9960::APDS9960::set_proximity ( sensor::Sensor proximity)

Definition at line 27 of file apds9960.h.

◆ set_red_channel()

void esphome::apds9960::APDS9960::set_red_channel ( sensor::Sensor red_channel)

Definition at line 19 of file apds9960.h.

◆ set_right_direction()

void esphome::apds9960::APDS9960::set_right_direction ( binary_sensor::BinarySensor right_direction)

Definition at line 24 of file apds9960.h.

◆ set_up_direction()

void esphome::apds9960::APDS9960::set_up_direction ( binary_sensor::BinarySensor up_direction)

Definition at line 23 of file apds9960.h.

◆ setup()

void esphome::apds9960::APDS9960::setup ( )

Reimplemented from esphome::Component.

Definition at line 17 of file apds9960.cpp.

◆ update()

void esphome::apds9960::APDS9960::update ( )

Implements esphome::PollingComponent.

Definition at line 151 of file apds9960.cpp.

Field Documentation

◆ blue_channel_

sensor::Sensor* esphome::apds9960::APDS9960::blue_channel_ {nullptr}

Definition at line 41 of file apds9960.h.

◆ clear_channel_

sensor::Sensor* esphome::apds9960::APDS9960::clear_channel_ {nullptr}

Definition at line 42 of file apds9960.h.

◆ down_direction_

binary_sensor::BinarySensor* esphome::apds9960::APDS9960::down_direction_ {nullptr}

Definition at line 45 of file apds9960.h.

◆ gesture_down_started_

bool esphome::apds9960::APDS9960::gesture_down_started_ {false}

Definition at line 54 of file apds9960.h.

◆ gesture_left_started_

bool esphome::apds9960::APDS9960::gesture_left_started_ {false}

Definition at line 55 of file apds9960.h.

◆ gesture_right_started_

bool esphome::apds9960::APDS9960::gesture_right_started_ {false}

Definition at line 56 of file apds9960.h.

◆ gesture_start_

uint32_t esphome::apds9960::APDS9960::gesture_start_ {0}

Definition at line 57 of file apds9960.h.

◆ gesture_up_started_

bool esphome::apds9960::APDS9960::gesture_up_started_ {false}

Definition at line 53 of file apds9960.h.

◆ green_channel_

sensor::Sensor* esphome::apds9960::APDS9960::green_channel_ {nullptr}

Definition at line 40 of file apds9960.h.

◆ left_direction_

binary_sensor::BinarySensor* esphome::apds9960::APDS9960::left_direction_ {nullptr}

Definition at line 46 of file apds9960.h.


enum esphome::apds9960::APDS9960::ErrorCode esphome::apds9960::APDS9960::NONE

◆ proximity_

sensor::Sensor* esphome::apds9960::APDS9960::proximity_ {nullptr}

Definition at line 47 of file apds9960.h.

◆ red_channel_

sensor::Sensor* esphome::apds9960::APDS9960::red_channel_ {nullptr}

Definition at line 39 of file apds9960.h.

◆ right_direction_

binary_sensor::BinarySensor* esphome::apds9960::APDS9960::right_direction_ {nullptr}

Definition at line 44 of file apds9960.h.

◆ up_direction_

binary_sensor::BinarySensor* esphome::apds9960::APDS9960::up_direction_ {nullptr}

Definition at line 43 of file apds9960.h.

The documentation for this class was generated from the following files: