Lamp factory adaption
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <output/items/Lamp.h>
|
||||
#include <output/detail/DriverBoardPinController.h>
|
||||
#include "LampFactory.h"
|
||||
#include "output/items/detail/Lamp.h"
|
||||
|
||||
@@ -35,5 +36,28 @@ std::map<std::string, std::shared_ptr<items::Lamp>> LampFactory::getItemMap()
|
||||
return lamp_map;
|
||||
}
|
||||
|
||||
void LampFactory::set_address_pins()
|
||||
{
|
||||
auto address_pins = this->object.at(config_path::address_pins);
|
||||
|
||||
std::array<uint8_t, 3> pins;
|
||||
|
||||
pins.at(0) = address_pins.at("A0");
|
||||
pins.at(1) = address_pins.at("A1");
|
||||
pins.at(2) = address_pins.at("A2");
|
||||
|
||||
std::dynamic_pointer_cast<detail::DriverBoardPinController>(this->pin_controller)->set_address_pins(pins);
|
||||
}
|
||||
|
||||
uint8_t LampFactory::get_address_pin(nlohmann::json & pin_object)
|
||||
{
|
||||
auto address = pin_object.at(config_path::item_address).get<uint8_t>();
|
||||
auto extender = pin_object.at(config_path::item_extender).get<std::string>();
|
||||
auto pin_base = this->get_extender_pin_base(extender);
|
||||
|
||||
return address + pin_base;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user