work on drivercontroller logik
This commit is contained in:
@@ -28,10 +28,11 @@ void DriverBoardPinController::activate(items::DriverBoardItem &driver_board_ite
|
|||||||
|
|
||||||
uint8_t address = driver_board_item.get_address();
|
uint8_t address = driver_board_item.get_address();
|
||||||
|
|
||||||
this->select_mux(address/8);
|
|
||||||
this->select_adress(address);
|
this->select_adress(address);
|
||||||
|
|
||||||
write_pin(this->data_pin, true);
|
write_pin(this->data_pin, true);
|
||||||
|
|
||||||
|
this->select_mux(address/8);
|
||||||
|
|
||||||
this->deselect_all_muxes();
|
this->deselect_all_muxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,10 +43,11 @@ void DriverBoardPinController::deactivate(items::DriverBoardItem &driver_board_i
|
|||||||
|
|
||||||
uint8_t address = driver_board_item.get_address();
|
uint8_t address = driver_board_item.get_address();
|
||||||
|
|
||||||
this->select_mux(address/8);
|
|
||||||
this->select_adress(address);
|
this->select_adress(address);
|
||||||
|
|
||||||
write_pin(this->data_pin, false);
|
write_pin(this->data_pin, false);
|
||||||
|
|
||||||
|
this->select_mux(address/8);
|
||||||
|
|
||||||
this->deselect_all_muxes();
|
this->deselect_all_muxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +59,33 @@ void DriverBoardPinController::select_adress(uint8_t address)
|
|||||||
write_pin(this->address_pins[2], address & 0b100);
|
write_pin(this->address_pins[2], address & 0b100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DriverBoardPinController::select_mux(uint8_t mux)
|
||||||
|
{
|
||||||
|
write_pin(this->mux_enable_pins[mux], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriverBoardPinController::deselect_all_muxes()
|
||||||
|
{
|
||||||
|
for(auto pin : mux_enable_pins)
|
||||||
|
{
|
||||||
|
write_pin(pin, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriverBoardPinController::clear()
|
||||||
|
{
|
||||||
|
write_pin(data_pin, 0);
|
||||||
|
for(auto mux : mux_enable_pins)
|
||||||
|
{
|
||||||
|
for(uint8_t i = 0; i<8; i++)
|
||||||
|
{
|
||||||
|
this->deselect_all_muxes();
|
||||||
|
select_mux(mux);
|
||||||
|
select_adress(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DriverBoardPinController::set_address_pins(std::array<uint8_t, 3> address_pins)
|
void DriverBoardPinController::set_address_pins(std::array<uint8_t, 3> address_pins)
|
||||||
{
|
{
|
||||||
this->address_pins = address_pins;
|
this->address_pins = address_pins;
|
||||||
@@ -110,32 +139,7 @@ void DriverBoardPinController::set_run_pin(uint8_t run_pin)
|
|||||||
write_pin(run_pin, 0);
|
write_pin(run_pin, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverBoardPinController::select_mux(uint8_t mux)
|
|
||||||
{
|
|
||||||
write_pin(this->mux_enable_pins[mux], 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DriverBoardPinController::deselect_all_muxes()
|
|
||||||
{
|
|
||||||
for(auto pin : mux_enable_pins)
|
|
||||||
{
|
|
||||||
write_pin(pin, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DriverBoardPinController::clear()
|
|
||||||
{
|
|
||||||
for(auto mux : mux_enable_pins)
|
|
||||||
{
|
|
||||||
for(uint8_t i = 0; i<8; i++)
|
|
||||||
{
|
|
||||||
select_mux(mux);
|
|
||||||
select_adress(i);
|
|
||||||
write_pin(data_pin, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user