adds set data_pin and run_pin
This commit is contained in:
@@ -30,14 +30,15 @@ namespace config_path
|
|||||||
|
|
||||||
const char sound_path[] = "sounds";
|
const char sound_path[] = "sounds";
|
||||||
const char fire_pin[] = "fire_pin";
|
const char fire_pin[] = "fire_pin";
|
||||||
const char address_pins[] = "address_pins";
|
|
||||||
const char enable_pins[] = "enable_pins";
|
|
||||||
|
|
||||||
const char flipper_path[] = "flippers";
|
const char flipper_path[] = "flippers";
|
||||||
|
|
||||||
const char solenoid_path[] = "solenoids";
|
const char solenoid_path[] = "solenoids";
|
||||||
|
|
||||||
const char lamps_path[] = "lamps";
|
const char lamps_path[] = "lamps";
|
||||||
|
const char address_pins[] = "address_pins";
|
||||||
|
const char enable_pins[] = "enable_pins";
|
||||||
|
const char data_pin[] = "data_pin";
|
||||||
|
|
||||||
const char display_board[] = "display_board";
|
const char display_board[] = "display_board";
|
||||||
const char run_pin[] = "run";
|
const char run_pin[] = "run";
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ LampFactory::LampFactory(nlohmann::json &object, std::shared_ptr<DriverBoardPinC
|
|||||||
{
|
{
|
||||||
this->set_address_pins();
|
this->set_address_pins();
|
||||||
this->set_mux_pins();
|
this->set_mux_pins();
|
||||||
|
|
||||||
|
auto controller = std::dynamic_pointer_cast<detail::DriverBoardPinController>(this->pin_controller);
|
||||||
|
|
||||||
|
auto data_pin = this->get_address_pin(this->object.at(config_path::data_pin));
|
||||||
|
controller->set_data_pin(data_pin);
|
||||||
|
|
||||||
|
auto run_pin = this->get_address_pin(this->object.at(config_path::run_pin));
|
||||||
|
controller->set_run_pin(run_pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, std::shared_ptr<items::Lamp>> LampFactory::getItemMap()
|
std::map<std::string, std::shared_ptr<items::Lamp>> LampFactory::getItemMap()
|
||||||
@@ -63,7 +71,7 @@ uint8_t LampFactory::get_address_pin(nlohmann::json & pin_object)
|
|||||||
|
|
||||||
void LampFactory::set_mux_pins()
|
void LampFactory::set_mux_pins()
|
||||||
{
|
{
|
||||||
auto address_pins = this->object.at(config_path::address_pins);
|
auto address_pins = this->object.at(config_path::enable_pins);
|
||||||
|
|
||||||
std::array<uint8_t, 13> pins;
|
std::array<uint8_t, 13> pins;
|
||||||
|
|
||||||
@@ -75,6 +83,5 @@ void LampFactory::set_mux_pins()
|
|||||||
std::dynamic_pointer_cast<detail::DriverBoardPinController>(this->pin_controller)->set_mux_pins(pins);
|
std::dynamic_pointer_cast<detail::DriverBoardPinController>(this->pin_controller)->set_mux_pins(pins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user