mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 23:48:11 +01:00
more clang
This commit is contained in:
parent
fcb7362d96
commit
99d35fa6ad
2 changed files with 21 additions and 22 deletions
|
@ -326,57 +326,56 @@ void ExtEepromComponent::set_memory_type(EEEDeviceType device_type) {
|
|||
break;
|
||||
case EEE_24XX01:
|
||||
this->device_type_text_ = "24XX01";
|
||||
this->set_device_config_(128, 1, 8, 5); // 128
|
||||
this->set_device_config_(128, 1, 8, 5); // 128
|
||||
break;
|
||||
case EEE_24XX02:
|
||||
this->device_type_text_ = "24XX02";
|
||||
this->set_device_config_(256, 1, 8, 5); // 256
|
||||
this->set_device_config_(256, 1, 8, 5); // 256
|
||||
break;
|
||||
case EEE_24XX04:
|
||||
this->device_type_text_ = "24XX04";
|
||||
this->set_device_config_(512, 1, 16, 5); // 512
|
||||
this->set_device_config_(512, 1, 16, 5); // 512
|
||||
break;
|
||||
case EEE_24XX08:
|
||||
this->device_type_text_ = "24XX08";
|
||||
this->set_device_config_(1024, 1, 16, 5); // 1024
|
||||
this->set_device_config_(1024, 1, 16, 5); // 1024
|
||||
break;
|
||||
case EEE_24XX16:
|
||||
this->device_type_text_ = "24XX16";
|
||||
this->set_device_config_(2048, 1, 16, 1); // 2048
|
||||
this->set_device_config_(2048, 1, 16, 1); // 2048
|
||||
break;
|
||||
case EEE_24XX32:
|
||||
this->device_type_text_ = "24XX32";
|
||||
this->set_device_config_(4096, 2, 32, 5); // 4096
|
||||
this->set_device_config_(4096, 2, 32, 5); // 4096
|
||||
break;
|
||||
case EEE_24XX64:
|
||||
this->device_type_text_ = "24XX64";
|
||||
this->set_device_config_(8192, 2, 32, 5); // 8192
|
||||
this->set_device_config_(8192, 2, 32, 5); // 8192
|
||||
break;
|
||||
case EEE_24XX128:
|
||||
this->device_type_text_ = "24XX128";
|
||||
this->set_device_config_(16384, 2, 64, 5); // 16384
|
||||
this->set_device_config_(16384, 2, 64, 5); // 16384
|
||||
break;
|
||||
case EEE_24XX256:
|
||||
this->device_type_text_ = "24XX256";
|
||||
this->set_device_config_(32768, 2, 64, 5); // 32768
|
||||
this->set_device_config_(32768, 2, 64, 5); // 32768
|
||||
break;
|
||||
case EEE_24XX512:
|
||||
this->device_type_text_ = "24XX512";
|
||||
this->set_device_config_(65536, 2, 64, 5); // 65536
|
||||
this->set_device_config_(65536, 2, 64, 5); // 65536
|
||||
break;
|
||||
case EEE_24XX1025:
|
||||
this->device_type_text_ = "24XX1025";
|
||||
this->set_device_config_(128000, 2, 128, 5); // 128000
|
||||
this->set_device_config_(128000, 2, 128, 5); // 128000
|
||||
break;
|
||||
case EEE_24XX2048:
|
||||
this->device_type_text_ = "24XX2048";
|
||||
this->set_device_config_(262144, 2, 256, 5); // 262144
|
||||
this->set_device_config_(262144, 2, 256, 5); // 262144
|
||||
break;
|
||||
}
|
||||
}
|
||||
void ExtEepromComponent::set_device_config_(uint32_t mem_size, uint8_t address_bytes, uint16_t page_size,
|
||||
uint8_t write_time_ms)
|
||||
{
|
||||
uint8_t write_time_ms) {
|
||||
this->set_memory_size_(mem_size);
|
||||
this->set_address_size_bytes_(address_bytes);
|
||||
this->set_page_size_(page_size);
|
||||
|
|
|
@ -76,14 +76,14 @@ class ExtEepromComponent : public i2c::I2CDevice, public Component {
|
|||
private:
|
||||
void write_block_(uint8_t deviceaddr, uint32_t memaddr, const uint8_t *obj, uint8_t size);
|
||||
void set_device_config_(uint32_t mem_size, uint8_t address_bytes, uint16_t page_size, uint8_t write_time_ms);
|
||||
void set_memory_size_(uint32_t mem_size); // Set the size of memory in bytes
|
||||
uint32_t get_memory_size_(); // Return size of memory in bytes
|
||||
void set_page_size_(uint16_t page_size); // Set the size of the page we can write a page at a time
|
||||
uint16_t get_page_size_(); // Get the size of the page we can read a page at a time
|
||||
void set_address_size_bytes_(uint8_t address_size_bytes); // Set the number of bytes to use for device address
|
||||
uint8_t get_address_size_bytes_(); // Get the number of bytes to use for device address
|
||||
void set_page_write_time_(uint8_t write_time_ms); // Set the number of ms required per page write
|
||||
uint8_t get_page_write_time_(); // Get the number of ms required per page write
|
||||
void set_memory_size_(uint32_t mem_size); // Set the size of memory in bytes
|
||||
uint32_t get_memory_size_(); // Return size of memory in bytes
|
||||
void set_page_size_(uint16_t page_size); // Set the size of the page we can write a page at a time
|
||||
uint16_t get_page_size_(); // Get the size of the page we can read a page at a time
|
||||
void set_address_size_bytes_(uint8_t address_size_bytes); // Set the number of bytes to use for device address
|
||||
uint8_t get_address_size_bytes_(); // Get the number of bytes to use for device address
|
||||
void set_page_write_time_(uint8_t write_time_ms); // Set the number of ms required per page write
|
||||
uint8_t get_page_write_time_(); // Get the number of ms required per page write
|
||||
uint32_t memory_size_bytes_{0};
|
||||
uint16_t memory_page_size_bytes_{0};
|
||||
uint8_t address_size_bytes_{0};
|
||||
|
|
Loading…
Reference in a new issue