ESPHome 2025.5.0
Loading...
Searching...
No Matches
apds9960.h
Go to the documentation of this file.
1#pragma once
2
6#ifdef USE_SENSOR
8#endif
9#ifdef USE_BINARY_SENSOR
11#endif
12
13namespace esphome {
14namespace apds9960 {
15
17#ifdef USE_SENSOR
18 SUB_SENSOR(red)
19 SUB_SENSOR(green)
20 SUB_SENSOR(blue)
21 SUB_SENSOR(clear)
22 SUB_SENSOR(proximity)
23#endif
24
25#ifdef USE_BINARY_SENSOR
26 SUB_BINARY_SENSOR(up_direction)
27 SUB_BINARY_SENSOR(right_direction)
28 SUB_BINARY_SENSOR(down_direction)
29 SUB_BINARY_SENSOR(left_direction)
30#endif
31
32 public:
33 void setup() override;
34 void dump_config() override;
35 float get_setup_priority() const override;
36 void update() override;
37 void loop() override;
38
39 void set_led_drive(uint8_t level) { this->led_drive_ = level; }
40 void set_proximity_gain(uint8_t gain) { this->proximity_gain_ = gain; }
41 void set_ambient_gain(uint8_t gain) { this->ambient_gain_ = gain; }
42 void set_gesture_led_drive(uint8_t level) { this->gesture_led_drive_ = level; }
43 void set_gesture_gain(uint8_t gain) { this->gesture_gain_ = gain; }
44 void set_gesture_wait_time(uint8_t wait_time) { this->gesture_wait_time_ = wait_time; }
45
46 protected:
47 bool is_color_enabled_() const;
48 bool is_proximity_enabled_() const;
49 bool is_gesture_enabled_() const;
50 void read_color_data_(uint8_t status);
51 void read_proximity_data_(uint8_t status);
52 void read_gesture_data_();
53 void report_gesture_(int gesture);
54 void process_dataset_(int up, int down, int left, int right);
55
56 uint8_t led_drive_;
62
72 uint32_t gesture_start_{0};
73};
74
75} // namespace apds9960
76} // namespace esphome
uint8_t status
Definition bl0942.h:8
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:51
This class simplifies creating components that periodically check a state.
Definition component.h:301
void read_proximity_data_(uint8_t status)
Definition apds9960.cpp:208
bool is_gesture_enabled_() const
Definition apds9960.cpp:398
void report_gesture_(int gesture)
Definition apds9960.cpp:277
void read_color_data_(uint8_t status)
Definition apds9960.cpp:174
enum esphome::apds9960::APDS9960::ErrorCode NONE
void process_dataset_(int up, int down, int left, int right)
Definition apds9960.cpp:315
bool is_proximity_enabled_() const
Definition apds9960.cpp:389
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
AlsGain501 gain
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7