mirror of
https://github.com/esphome/esphome.git
synced 2025-02-24 20:12:30 +01:00
Conforming to CLANG standards
This commit is contained in:
parent
b063fa17f8
commit
543a4ba7a4
3 changed files with 11 additions and 11 deletions
|
@ -8,15 +8,15 @@ namespace esphome {
|
||||||
namespace mcp3204 {
|
namespace mcp3204 {
|
||||||
|
|
||||||
class MCP3204 : public Component,
|
class MCP3204 : public Component,
|
||||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST,
|
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST,
|
||||||
spi::CLOCK_POLARITY_LOW,
|
spi::CLOCK_POLARITY_LOW,
|
||||||
spi::CLOCK_PHASE_LEADING,
|
spi::CLOCK_PHASE_LEADING,
|
||||||
spi::DATA_RATE_1MHZ> {
|
spi::DATA_RATE_1MHZ> {
|
||||||
public:
|
public:
|
||||||
MCP3204() = default;
|
MCP3204() = default;
|
||||||
|
|
||||||
void set_reference_voltage(float reference_voltage)
|
void set_reference_voltage(float reference_voltage)
|
||||||
{
|
{
|
||||||
this->reference_voltage_ = reference_voltage;
|
this->reference_voltage_ = reference_voltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ CONFIG_SCHEMA = (
|
||||||
{
|
{
|
||||||
cv.GenerateID(CONF_MCP3204_ID): cv.use_id(MCP3204),
|
cv.GenerateID(CONF_MCP3204_ID): cv.use_id(MCP3204),
|
||||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=7),
|
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=7),
|
||||||
cv.Optional(CONF_DIFF_MODE, default = 'false'): cv.boolean,
|
cv.Optional(CONF_DIFF_MODE, default="false"): cv.boolean,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.extend(cv.polling_component_schema("60s"))
|
.extend(cv.polling_component_schema("60s"))
|
||||||
|
|
|
@ -17,13 +17,13 @@ void MCP3204Sensor::dump_config() {
|
||||||
ESP_LOGCONFIG(TAG, " DIFFERENTIAL MODE: %u", this->diffmode_);
|
ESP_LOGCONFIG(TAG, " DIFFERENTIAL MODE: %u", this->diffmode_);
|
||||||
LOG_UPDATE_INTERVAL(this);
|
LOG_UPDATE_INTERVAL(this);
|
||||||
}
|
}
|
||||||
float MCP3204Sensor::sample()
|
float MCP3204Sensor::sample()
|
||||||
{
|
{
|
||||||
return this->parent_->read_data(this->pin_, this->diffmode_);
|
return this->parent_->read_data(this->pin_, this->diffmode_);
|
||||||
}
|
}
|
||||||
void MCP3204Sensor::update()
|
void MCP3204Sensor::update()
|
||||||
{
|
{
|
||||||
this->publish_state(this->sample());
|
this->publish_state(this->sample());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mcp3204
|
} // namespace mcp3204
|
||||||
|
|
Loading…
Add table
Reference in a new issue