mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 00:48:19 +01:00
Extend mcp3204 to support 8 channels (mcp3208 variant) (#3332)
This commit is contained in:
parent
3297267a16
commit
2b91c23bf3
2 changed files with 2 additions and 2 deletions
|
@ -20,7 +20,7 @@ void MCP3204::dump_config() {
|
|||
}
|
||||
|
||||
float MCP3204::read_data(uint8_t pin) {
|
||||
uint8_t adc_primary_config = 0b00000110 & 0b00000111;
|
||||
uint8_t adc_primary_config = 0b00000110 | (pin >> 2);
|
||||
uint8_t adc_secondary_config = pin << 6;
|
||||
this->enable();
|
||||
this->transfer_byte(adc_primary_config);
|
||||
|
|
|
@ -17,7 +17,7 @@ CONFIG_SCHEMA = sensor.SENSOR_SCHEMA.extend(
|
|||
{
|
||||
cv.GenerateID(): cv.declare_id(MCP3204Sensor),
|
||||
cv.GenerateID(CONF_MCP3204_ID): cv.use_id(MCP3204),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=3),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=7),
|
||||
}
|
||||
).extend(cv.polling_component_schema("60s"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue