mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-01 02:28:28 +02:00
CCS811 support (#536)
* CCS811 * Move define, add test * Remove sun artifact * Lint * Lint
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user