mirror of
https://github.com/esphome/esphome.git
synced 2025-03-16 07:38:17 +00:00
Fixed crc function style
This commit is contained in:
parent
7d7060f83c
commit
f59b527bc8
@ -21,12 +21,10 @@ uint8_t i;
|
||||
{
|
||||
crc ^= *ptr++;
|
||||
for (i = 0; i < 8; i++)
|
||||
if ((crc & 0x01) != 0)
|
||||
{
|
||||
if ((crc & 0x01) != 0) {
|
||||
crc >>= 1;
|
||||
crc ^= 0xA001;
|
||||
}
|
||||
else
|
||||
} else
|
||||
crc >>= 1;
|
||||
}
|
||||
return crc;
|
||||
@ -74,7 +72,6 @@ void AM2320Component::dump_config() {
|
||||
float AM2320Component::get_setup_priority() const { return setup_priority::DATA; }
|
||||
|
||||
bool AM2320Component::read_bytes_(uint8_t a_register, uint8_t *data, uint8_t len, uint32_t conversion) {
|
||||
|
||||
if (!this->write_bytes(a_register, data, 2)) {
|
||||
ESP_LOGW(TAG, "Writing bytes for AM2320 failed!");
|
||||
return false;
|
||||
@ -85,7 +82,6 @@ bool AM2320Component::read_bytes_(uint8_t a_register, uint8_t *data, uint8_t len
|
||||
return this->parent_->raw_receive(this->address_, data, len);
|
||||
}
|
||||
|
||||
|
||||
bool AM2320Component::read_data_(uint8_t *data) {
|
||||
// Wake up
|
||||
this->write_bytes(0, data, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user