Remove internal pin restriction from cd74hc4067 (#4179)

This commit is contained in:
Jesse Hills 2022-12-13 13:44:52 +13:00 committed by GitHub
parent eef578f4b8
commit db3096c6e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View file

@ -27,10 +27,10 @@ DEFAULT_DELAY = "2ms"
CONFIG_SCHEMA = cv.Schema( CONFIG_SCHEMA = cv.Schema(
{ {
cv.GenerateID(): cv.declare_id(CD74HC4067Component), cv.GenerateID(): cv.declare_id(CD74HC4067Component),
cv.Required(CONF_PIN_S0): pins.internal_gpio_output_pin_schema, cv.Required(CONF_PIN_S0): pins.gpio_output_pin_schema,
cv.Required(CONF_PIN_S1): pins.internal_gpio_output_pin_schema, cv.Required(CONF_PIN_S1): pins.gpio_output_pin_schema,
cv.Required(CONF_PIN_S2): pins.internal_gpio_output_pin_schema, cv.Required(CONF_PIN_S2): pins.gpio_output_pin_schema,
cv.Required(CONF_PIN_S3): pins.internal_gpio_output_pin_schema, cv.Required(CONF_PIN_S3): pins.gpio_output_pin_schema,
cv.Optional( cv.Optional(
CONF_DELAY, default=DEFAULT_DELAY CONF_DELAY, default=DEFAULT_DELAY
): cv.positive_time_period_milliseconds, ): cv.positive_time_period_milliseconds,

View file

@ -19,22 +19,22 @@ class CD74HC4067Component : public Component {
void activate_pin(uint8_t pin); void activate_pin(uint8_t pin);
/// set the pin connected to multiplexer control pin 0 /// set the pin connected to multiplexer control pin 0
void set_pin_s0(InternalGPIOPin *pin) { this->pin_s0_ = pin; } void set_pin_s0(GPIOPin *pin) { this->pin_s0_ = pin; }
/// set the pin connected to multiplexer control pin 1 /// set the pin connected to multiplexer control pin 1
void set_pin_s1(InternalGPIOPin *pin) { this->pin_s1_ = pin; } void set_pin_s1(GPIOPin *pin) { this->pin_s1_ = pin; }
/// set the pin connected to multiplexer control pin 2 /// set the pin connected to multiplexer control pin 2
void set_pin_s2(InternalGPIOPin *pin) { this->pin_s2_ = pin; } void set_pin_s2(GPIOPin *pin) { this->pin_s2_ = pin; }
/// set the pin connected to multiplexer control pin 3 /// set the pin connected to multiplexer control pin 3
void set_pin_s3(InternalGPIOPin *pin) { this->pin_s3_ = pin; } void set_pin_s3(GPIOPin *pin) { this->pin_s3_ = pin; }
/// set the delay needed after an input switch /// set the delay needed after an input switch
void set_switch_delay(uint32_t switch_delay) { this->switch_delay_ = switch_delay; } void set_switch_delay(uint32_t switch_delay) { this->switch_delay_ = switch_delay; }
private: private:
InternalGPIOPin *pin_s0_; GPIOPin *pin_s0_;
InternalGPIOPin *pin_s1_; GPIOPin *pin_s1_;
InternalGPIOPin *pin_s2_; GPIOPin *pin_s2_;
InternalGPIOPin *pin_s3_; GPIOPin *pin_s3_;
/// the currently active pin /// the currently active pin
uint8_t active_pin_; uint8_t active_pin_;
uint32_t switch_delay_; uint32_t switch_delay_;