68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
//
|
|
// Created by rhetenor on 14.12.18.
|
|
//
|
|
|
|
#include "SoundBoardPinController.h"
|
|
|
|
#include "utility/config.h"
|
|
|
|
namespace flippR_driver
|
|
{
|
|
namespace output
|
|
{
|
|
namespace detail
|
|
{
|
|
|
|
SoundBoardPinController::SoundBoardPinController(std::shared_ptr<std::mutex> output_item_mutex, const uint8_t & fire_address) :
|
|
output_item_mutex(std::move(output_item_mutex)),
|
|
fire_address(fire_address)
|
|
{
|
|
CLOG(INFO, OUTPUT_LOGGER) << "Created SoundBoardPinController";
|
|
}
|
|
|
|
void SoundBoardPinController::activate(const items::detail::Sound &sound)
|
|
{
|
|
std::lock_guard<std::mutex> guard(*output_item_mutex);
|
|
|
|
write_sound_address(sound.get_address());
|
|
|
|
fire_sound();
|
|
}
|
|
|
|
void SoundBoardPinController::deactivate(const items::detail::Sound &sound)
|
|
{
|
|
std::lock_guard<std::mutex> guard(*output_item_mutex);
|
|
|
|
write_sound_address(0);
|
|
|
|
fire_sound();
|
|
}
|
|
|
|
|
|
void SoundBoardPinController::write_sound_address(const uint8_t & address) const
|
|
{
|
|
// write_pin(pins_sound.at("A"), address & 0b0000001u);
|
|
// write_pin(pins_sound.at("B"), address & 0b0000010u);
|
|
// write_pin(pins_sound.at("C"), address & 0b0000100u);
|
|
// write_pin(pins_sound.at("D"), address & 0b0001000u);
|
|
// write_pin(pins_sound.at("E"), address & 0b0010000u);
|
|
// write_pin(pins_sound.at("F"), address & 0b0100000u);
|
|
// write_pin(pins_sound.at("G"), address & 0b1000000u);
|
|
}
|
|
|
|
void SoundBoardPinController::fire_sound() const
|
|
{
|
|
// PinController::write_pin(pins_sound.at("fire"), true);
|
|
//
|
|
// PinController::write_pin(pins_sound.at("fire"), false);
|
|
}
|
|
|
|
void SoundBoardPinController::write_pin(const uint8_t & pin, const bool & value) const
|
|
{
|
|
// PinController::write_pin(pins_sound.at("pin_base") + pin, value);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|