You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
884 B
40 lines
884 B
#include "esphome/core/log.h"
|
|
#include "showcase_component.h"
|
|
#include <Arduino.h>
|
|
|
|
namespace esphome {
|
|
namespace showcase_component {
|
|
|
|
static const char *TAG = "showcase_component.component";
|
|
|
|
void ShowcaseComponent::setup() {
|
|
}
|
|
|
|
void ShowcaseComponent::loop() {
|
|
uint8_t data = 10;
|
|
this->read_register(0x0, &data, 0x1);
|
|
/* ESP_LOGI(TAG, "READ value: %d", data); */
|
|
if(data != 0){
|
|
if(data & 1){
|
|
this->s = Off;
|
|
// TODO: turn off leds
|
|
} else if ( data & 2 ){
|
|
this->s = Auto;
|
|
} else if ( data & 4 ){
|
|
this->s = On;
|
|
// TODO: turn on led
|
|
}
|
|
|
|
if(this->s == Auto && data & 8){
|
|
// TODO: turn on led
|
|
}
|
|
}
|
|
}
|
|
|
|
void ShowcaseComponent::dump_config(){
|
|
ESP_LOGCONFIG(TAG, "showcase component");
|
|
}
|
|
|
|
} // namespace empty_i2c_component
|
|
} // namespace esphome
|