CCS811 support (#536)

* CCS811

* Move define, add test

* Remove sun artifact

* Lint

* Lint
This commit is contained in:
Otto Winter
2019-05-13 13:06:14 +02:00
committed by GitHub
parent 855e9367d4
commit 0281914507
9 changed files with 255 additions and 0 deletions
+7
View File
@@ -307,4 +307,11 @@ bool str_endswith(const std::string &full, const std::string &ending) {
return full.rfind(ending) == (full.size() - ending.size());
}
uint16_t encode_uint16(uint8_t msb, uint8_t lsb) { return (uint16_t(msb) << 8) | uint16_t(lsb); }
std::array<uint8_t, 2> decode_uint16(uint16_t value) {
uint8_t msb = (value >> 8) & 0xFF;
uint8_t lsb = (value >> 0) & 0xFF;
return {msb, lsb};
}
} // namespace esphome