ESPHome 2026.2.4
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 void update() override;
36 void loop() override;
37
38 void set_led_drive(uint8_t level) { this->led_drive_ = level; }
39 void set_proximity_gain(uint8_t gain) { this->proximity_gain_ = gain; }
40 void set_ambient_gain(uint8_t gain) { this->ambient_gain_ = gain; }
41 void set_gesture_led_drive(uint8_t level) { this->gesture_led_drive_ = level; }
42 void set_gesture_gain(uint8_t gain) { this->gesture_gain_ = gain; }
43 void set_gesture_wait_time(uint8_t wait_time) { this->gesture_wait_time_ = wait_time; }
44
45 protected:
46 bool is_color_enabled_() const;
47 bool is_proximity_enabled_() const;
48 bool is_gesture_enabled_() const;
49 void read_color_data_(uint8_t status);
50 void read_proximity_data_(uint8_t status);
51 void read_gesture_data_();
52 void report_gesture_(int gesture);
53 void process_dataset_(int up, int down, int left, int right);
54
55 uint8_t led_drive_;
61
71 uint32_t gesture_start_{0};
72};
73
74} // namespace apds9960
75} // namespace esphome
uint8_t status
Definition bl0942.h:8
virtual void setup()
Where the component's initialization should happen.
This class simplifies creating components that periodically check a state.
Definition component.h:512
void read_proximity_data_(uint8_t status)
Definition apds9960.cpp:207
bool is_gesture_enabled_() const
Definition apds9960.cpp:396
void report_gesture_(int gesture)
Definition apds9960.cpp:276
void read_color_data_(uint8_t status)
Definition apds9960.cpp:173
enum esphome::apds9960::APDS9960::ErrorCode NONE
void process_dataset_(int up, int down, int left, int right)
Definition apds9960.cpp:314
bool is_proximity_enabled_() const
Definition apds9960.cpp:387
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