1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-22 12:58:15 +00:00
Otto Winter 8e75980ebd
Cleanup dashboard JS (#491)
* Cleanup dashboard JS

* Add vscode

* Save start_mark/end_mark

* Updates

* Updates

* Remove need for cv.nameable

It's a bit hacky but removes so much bloat from integrations

* Add enum helper

* Document APIs, and Improvements

* Fixes

* Fixes

* Update PULL_REQUEST_TEMPLATE.md

* Updates

* Updates

* Updates
2019-04-22 21:56:30 +02:00

44 lines
1.0 KiB
C++

#include "ttp229_lsf.h"
#include "esphome/core/log.h"
namespace esphome {
namespace ttp229_lsf {
static const char *TAG = "ttp229_lsf";
void TTP229LSFComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up ttp229...");
if (!this->parent_->raw_request_from(this->address_, 2)) {
this->error_code_ = COMMUNICATION_FAILED;
this->mark_failed();
return;
}
}
void TTP229LSFComponent::dump_config() {
ESP_LOGCONFIG(TAG, "ttp229:");
LOG_I2C_DEVICE(this);
switch (this->error_code_) {
case COMMUNICATION_FAILED:
ESP_LOGE(TAG, "Communication with TTP229 failed!");
break;
case NONE:
default:
break;
}
}
void TTP229LSFComponent::loop() {
uint16_t touched = 0;
if (!this->parent_->raw_receive_16(this->address_, &touched, 1)) {
this->status_set_warning();
return;
}
this->status_clear_warning();
touched = reverse_bits_16(touched);
for (auto *channel : this->channels_) {
channel->process(touched);
}
}
} // namespace ttp229_lsf
} // namespace esphome