mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-07 13:24:56 +02:00
Add change i2c address and allow multi conf for TB6612FNG (#5492)
This commit is contained in:
@@ -84,8 +84,7 @@ class GroveMotorDriveTB6612FNG : public Component, public i2c::I2CDevice {
|
||||
*************************************************************/
|
||||
void set_i2c_addr(uint8_t addr);
|
||||
|
||||
/*************************************************************
|
||||
Description
|
||||
/***********************************change_address
|
||||
Drive a motor.
|
||||
Parameter
|
||||
chl: MOTOR_CHA or MOTOR_CHB
|
||||
@@ -204,5 +203,13 @@ class GROVETB6612FNGMotorNoStandbyAction : public Action<Ts...>, public Parented
|
||||
void play(Ts... x) override { this->parent_->not_standby(); }
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
class GROVETB6612FNGMotorChangeAddressAction : public Action<Ts...>, public Parented<GroveMotorDriveTB6612FNG> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, address)
|
||||
|
||||
void play(Ts... x) override { this->parent_->set_i2c_addr(this->address_.value(x...)); }
|
||||
};
|
||||
|
||||
} // namespace grove_tb6612fng
|
||||
} // namespace esphome
|
||||
|
||||
Reference in New Issue
Block a user