working on gpio interface and refactored author names

This commit is contained in:
Jonas Zeunert
2018-11-23 13:46:09 +01:00
parent 972f16b0f7
commit 00e640f469
63 changed files with 127 additions and 91 deletions

View File

@@ -1,5 +1,5 @@
{ {
"displays" : "display_board" :
{ {
}, },
@@ -7,7 +7,7 @@
{ {
"i2c_address" : 32, "i2c_address" : 32,
"pin_base" : 65, "pin_base" : 65,
"latch-select" : "pin-select" :
{ {
"A" : 0, "A" : 0,
"B" : 1, "B" : 1,
@@ -15,7 +15,7 @@
}, },
"data" : 3, "data" : 3,
"CL" : 4, "CL" : 4,
"mux-select" : "latch-select" :
{ {
"A" : 5, "A" : 5,
"B" : 6, "B" : 6,

View File

@@ -2,7 +2,7 @@
* InputEvent.h * InputEvent.h
* *
* Created on: Apr 5, 2018 * Created on: Apr 5, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef INPUTEVENT_H_ #ifndef INPUTEVENT_H_

View File

@@ -6,7 +6,7 @@
* Please be aware that handle must be implemented thread safe! * Please be aware that handle must be implemented thread safe!
* *
* Created on: Apr 5, 2018 * Created on: Apr 5, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef INPUTEVENTHANDLER_H_ #ifndef INPUTEVENTHANDLER_H_

View File

@@ -2,7 +2,7 @@
* IEventHandler.h * IEventHandler.h
* *
* Created on: Jun 13, 2018 * Created on: Jun 13, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_IEVENTHANDLER_H_ #ifndef SRC_IEVENTHANDLER_H_

View File

@@ -2,7 +2,7 @@
* IInputDriver.h * IInputDriver.h
* *
* Created on: Jun 14, 2018 * Created on: Jun 14, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_INPUT_IINPUTDRIVER_H_ #ifndef SRC_INPUT_IINPUTDRIVER_H_

View File

@@ -2,7 +2,7 @@
* IOutputDriver.h * IOutputDriver.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_IOUTPUTDRIVER_H_ #ifndef _SRC_OUTPUT_IOUTPUTDRIVER_H_

View File

@@ -2,7 +2,7 @@
* ILamp.h * ILamp.h
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_ILAMP_H_ #ifndef _SRC_OUTPUT_ILAMP_H_

View File

@@ -2,7 +2,7 @@
* IOutputDisplay.h * IOutputDisplay.h
* *
* Created on: Nov 20, 2018 * Created on: Nov 20, 2018
* Author: johannes * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_OUTPUT_IOUTPUTDISPLAY_H_ #ifndef SRC_OUTPUT_IOUTPUTDISPLAY_H_

View File

@@ -2,7 +2,7 @@
* ISolenoid.h * ISolenoid.h
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_ISOLENOID_H_ #ifndef _SRC_OUTPUT_ISOLENOID_H_

View File

@@ -2,7 +2,7 @@
* ISound.h * ISound.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_ISOUND_H_ #ifndef _SRC_OUTPUT_ISOUND_H_

View File

@@ -2,7 +2,7 @@
* Detector.cpp * Detector.cpp
* *
* Created on: Apr 5, 2018 * Created on: Apr 5, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "Detector.h" #include "Detector.h"

View File

@@ -8,7 +8,7 @@
* The other cycles over the queue and notifies input event handlers. * The other cycles over the queue and notifies input event handlers.
* *
* Created on: Apr 5, 2018 * Created on: Apr 5, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef DETECTOR_H_ #ifndef DETECTOR_H_

View File

@@ -2,7 +2,7 @@
* ErrorEvent.h * ErrorEvent.h
* *
* Created on: Aug 8, 2018 * Created on: Aug 8, 2018
* Author: johannes * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_INPUT_ERROREVENT_HPP_ #ifndef SRC_INPUT_ERROREVENT_HPP_

View File

@@ -2,7 +2,7 @@
* Event.cpp * Event.cpp
* *
* Created on: Jun 15, 2018 * Created on: Jun 15, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "input/Event.h" #include "input/Event.h"

View File

@@ -2,7 +2,7 @@
* EventHandler.cpp * EventHandler.cpp
* *
* Created on: Jun 14, 2018 * Created on: Jun 14, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "input/EventHandler.h" #include "input/EventHandler.h"
#include "utility/config.h" #include "utility/config.h"

View File

@@ -2,7 +2,7 @@
* EventNotifier.cpp * EventNotifier.cpp
* *
* Created on: May 17, 2018 * Created on: May 17, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include <boost/thread.hpp> #include <boost/thread.hpp>

View File

@@ -2,7 +2,7 @@
* InputEventNotifier.h * InputEventNotifier.h
* *
* Created on: May 17, 2018 * Created on: May 17, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_INPUT_EVENTNOTIFIER_H_ #ifndef SRC_INPUT_EVENTNOTIFIER_H_

View File

@@ -2,7 +2,7 @@
* IDetector.h * IDetector.h
* *
* Created on: Jun 13, 2018 * Created on: Jun 13, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_INPUT_IDETECTOR_H_ #ifndef SRC_INPUT_IDETECTOR_H_

View File

@@ -2,7 +2,7 @@
* IEventNotifier.h * IEventNotifier.h
* *
* Created on: Jun 13, 2018 * Created on: Jun 13, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_INPUT_IEVENTNOTIFIER_H_ #ifndef SRC_INPUT_IEVENTNOTIFIER_H_

View File

@@ -2,7 +2,7 @@
* InputDriver.cpp * InputDriver.cpp
* *
* Created on: Jun 15, 2018 * Created on: Jun 15, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "InputDriver.h" #include "InputDriver.h"

View File

@@ -2,7 +2,7 @@
* InputDriver.hpp * InputDriver.hpp
* *
* Created on: May 31, 2018 * Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_INPUT_INPUTDRIVER_H_ #ifndef SRC_INPUT_INPUTDRIVER_H_
#define SRC_INPUT_INPUTDRIVER_H_ #define SRC_INPUT_INPUTDRIVER_H_

View File

@@ -2,7 +2,7 @@
* InputDriverFactory.cpp * InputDriverFactory.cpp
* *
* Created on: Jun 14, 2018 * Created on: Jun 14, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */

View File

@@ -2,7 +2,7 @@
* InputFactory.h * InputFactory.h
* *
* Created on: Apr 5, 2018 * Created on: Apr 5, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef INPUTFACTORY_H_ #ifndef INPUTFACTORY_H_

View File

@@ -2,7 +2,7 @@
* DisplayController.cpp * DisplayController.cpp
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "DisplayController.h" #include "DisplayController.h"

View File

@@ -2,7 +2,7 @@
* DisplayController.h * DisplayController.h
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_DISPLAYCONTROLLER_H_ #ifndef _SRC_OUTPUT_DISPLAYCONTROLLER_H_

View File

@@ -2,7 +2,7 @@
* IDisplayController.h * IDisplayController.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_IDISPLAYCONTROLLER_H_ #ifndef _SRC_OUTPUT_IDISPLAYCONTROLLER_H_

View File

@@ -2,7 +2,7 @@
* OutputDriver.cpp * OutputDriver.cpp
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "OutputDriver.h" #include "OutputDriver.h"

View File

@@ -2,7 +2,7 @@
* OutputDriver.h * OutputDriver.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_OUTPUTDRIVER_H_ #ifndef _SRC_OUTPUT_OUTPUTDRIVER_H_

View File

@@ -2,7 +2,7 @@
* Display.h * Display.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_DISPLAY_H_ #ifndef _SRC_OUTPUT_DISPLAY_H_

View File

@@ -2,7 +2,7 @@
* IDisplay.h * IDisplay.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_IDISPLAY_H_ #ifndef _SRC_OUTPUT_IDISPLAY_H_

View File

@@ -2,7 +2,7 @@
* ICabinetItem.h * ICabinetItem.h
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_ICABINETITEM_H_ #ifndef _SRC_OUTPUT_ICABINETITEM_H_

View File

@@ -2,7 +2,7 @@
* CabinetItem.h * CabinetItem.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_CABINETITEM_H_ #ifndef _SRC_OUTPUT_CABINETITEM_H_
@@ -25,11 +25,11 @@ namespace items
class OutputItem : public IOutputItem class OutputItem : public IOutputItem
{ {
public: public:
OutputItem(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin_address, std::string name); OutputItem(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, u_int8_t address, std::string name);
virtual ~OutputItem(); virtual ~OutputItem();
public: public:
const unsigned int address, i2c_address, data_pin_address; const u_int8_t address;
const std::string name; const std::string name;
protected: protected:

View File

@@ -2,7 +2,7 @@
* Lamp.cpp * Lamp.cpp
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "Lamp.h" #include "Lamp.h"

View File

@@ -2,7 +2,7 @@
* Lamp.h * Lamp.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_LAMP_H_ #ifndef _SRC_OUTPUT_LAMP_H_
@@ -21,7 +21,7 @@ namespace items
class Lamp : public OutputItem, ILamp class Lamp : public OutputItem, ILamp
{ {
public: public:
Lamp(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin, std::string name); Lamp(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, u_int8_t address, std::string name);
virtual ~Lamp() = default; virtual ~Lamp() = default;
void activate(); void activate();

View File

@@ -2,7 +2,7 @@
* Solenoid.cpp * Solenoid.cpp
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "Solenoid.h" #include "Solenoid.h"

View File

@@ -2,7 +2,7 @@
* Solenoid.h * Solenoid.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_SOLENOID_H_ #ifndef _SRC_OUTPUT_SOLENOID_H_

View File

@@ -2,7 +2,7 @@
* Sound.cpp * Sound.cpp
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "Sound.h" #include "Sound.h"

View File

@@ -2,7 +2,7 @@
* Sound.h * Sound.h
* *
* Created on: Aug 2, 2018 * Created on: Aug 2, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef _SRC_OUTPUT_SOUND_H_ #ifndef _SRC_OUTPUT_SOUND_H_

View File

@@ -2,7 +2,7 @@
* BlockingQueue.hpp * BlockingQueue.hpp
* *
* Created on: May 17, 2018 * Created on: May 17, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_UTILITIES_BLOCKINGQUEUE_HPP_ #ifndef SRC_UTILITIES_BLOCKINGQUEUE_HPP_

View File

@@ -2,7 +2,7 @@
* DisplayGPIOInterface.cpp * DisplayGPIOInterface.cpp
* *
* Created on: Nov 9, 2018 * Created on: Nov 9, 2018
* Author: johannes * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "DisplayGPIOInterface.h" #include "DisplayGPIOInterface.h"

View File

@@ -2,7 +2,7 @@
* DisplayGPIOInterface.h * DisplayGPIOInterface.h
* *
* Created on: Nov 9, 2018 * Created on: Nov 9, 2018
* Author: johannes * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_UTILITY_DISPLAYGPIOINTERFACE_H_ #ifndef SRC_UTILITY_DISPLAYGPIOINTERFACE_H_

View File

@@ -2,7 +2,7 @@
* GPIOInterface.cpp * GPIOInterface.cpp
* *
* Created on: Jun 15, 2018 * Created on: Jun 15, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "GPIOInterface.h" #include "GPIOInterface.h"
@@ -29,6 +29,11 @@ void GPIOInterface::initialize_input_pin(char address)
pinMode(address, INPUT); pinMode(address, INPUT);
} }
void GPIOInterface::initialize_output_pin(char address)
{
pinMode(address, OUTPUT);
}
void GPIOInterface::write_pin(char address, char data) void GPIOInterface::write_pin(char address, char data)
{ {
digitalWrite(address, data); digitalWrite(address, data);
@@ -39,10 +44,6 @@ bool GPIOInterface::read_pin(char address)
return PULLDOWN == digitalRead(address); return PULLDOWN == digitalRead(address);
} }
void GPIOInterface::initialize_output_pin(char address)
{
pinMode(address, OUTPUT);
}
} }
} }

View File

@@ -7,7 +7,7 @@
* TODO * TODO
* *
* Created on: May 6, 2018 * Created on: May 6, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_UTILITIES_GPIOINTERFACE_H_ #ifndef SRC_UTILITIES_GPIOINTERFACE_H_

View File

@@ -2,7 +2,7 @@
* BlockingQueue.hpp * BlockingQueue.hpp
* *
* Created on: May 17, 2018 * Created on: May 17, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_UTILITIES_IBLOCKINGQUEUE_H_ #ifndef SRC_UTILITIES_IBLOCKINGQUEUE_H_

View File

@@ -2,7 +2,7 @@
* InputGPIOInterface.h * InputGPIOInterface.h
* *
* Created on: May 31, 2018 * Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_UTILITIES_IINPUTGPIOINTERFACE_H_ #ifndef SRC_UTILITIES_IINPUTGPIOINTERFACE_H_

View File

@@ -2,7 +2,7 @@
* InputGPIOInterface.cpp * InputGPIOInterface.cpp
* *
* Created on: May 31, 2018 * Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include <fstream> #include <fstream>

View File

@@ -2,7 +2,7 @@
* InputGPIOInterface.h * InputGPIOInterface.h
* *
* Created on: May 31, 2018 * Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_UTILITIES_INPUTGPIOINTERFACE_H_ #ifndef SRC_UTILITIES_INPUTGPIOINTERFACE_H_

View File

@@ -2,7 +2,7 @@
* LoggerFactory.hpp * LoggerFactory.hpp
* *
* Created on: Jun 19, 2018 * Created on: Jun 19, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_UTILITIES_LOGGERFACTORY_HPP_ #ifndef SRC_UTILITIES_LOGGERFACTORY_HPP_

View File

@@ -2,7 +2,7 @@
* OutputGPIOInterface.h * OutputGPIOInterface.h
* *
* Created on: May 31, 2018 * Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "OutputGPIOInterface.h" #include "OutputGPIOInterface.h"
@@ -18,18 +18,56 @@ OutputGPIOInterface::OutputGPIOInterface(std::istream &output_config_stream)
json output_config; json output_config;
output_config_stream >> output_config; output_config_stream >> output_config;
parse_pin_bases(output_config); parse_output_config(output_config);
initialize_i2c_addresses(output_config); initialize_i2c_addresses(output_config);
initialize_pins(); initialize_pins();
} }
void OutputGPIOInterface::initialize_i2c_addresses(json &output_config) void OutputGPIOInterface::parse_output_config(json &output_config)
{ {
mcp23017Setup(i2c_address_driver_board, parse_i2c_address_driver_board(output_config)); parse_pins_driver_board(output_config.at("driver_board"));
mcp23017Setup(i2c_address_sounds, parse_i2c_address_sound_board(output_config)); parse_pins_sound(output_config.at("sound_board"));
mcp23017Setup(pin_base_displays, parse_i2c_address_display_board(output_config)); parse_pins_sound(output_config.at("display_board"));
}
void OutputGPIOInterface::parse_pins_driver_board(json &driver_board_config)
{
}
void OutputGPIOInterface::parse_pins_sound(json &sound_board_config)
{
}
void OutputGPIOInterface::parse_pins_display(json &display_board_config)
{
}
void OutputGPIOInterface::initialize_pins()
{
// Since this are all outputs we just initialize everything as output conveniently
initialize_all_pins(pins_driver_board["pin_base"]);
initialize_all_pins(pins_sound_board["pin_base"]);
initialize_all_pins(pins_display_board["pin_base"]);
}
void OutputGPIOInterface::initialize_all_pins(u_int8_t pin_base)
{
for(int i = 0; i < 16; i++)
{
initialize_output_pin(pin_base + i);
}
}
void OutputGPIOInterface::initialize_i2c_addresses()
{
mcp23017Setup(pins_driver_board["pin_base"], pins_driver_board["i2c_address"]);
mcp23017Setup(pins_sound_board["pin_base"], pins_sound_board["i2c_address"]);
mcp23017Setup(pins_display_board["pin_base"], pins_display_board["i2c_address"]);
} }
void OutputGPIOInterface::activate_output_item(IOutputItem *item) void OutputGPIOInterface::activate_output_item(IOutputItem *item)

View File

@@ -2,7 +2,7 @@
* OutputGPIOInterface.h * OutputGPIOInterface.h
* *
* Created on: May 31, 2018 * Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#ifndef SRC_UTILITIES_OUTPUTGPIOINTERFACE_H_ #ifndef SRC_UTILITIES_OUTPUTGPIOINTERFACE_H_
@@ -15,7 +15,7 @@
#include <mcp23017.h> #include <mcp23017.h>
#include <mutex> #include <mutex>
#include <map>
namespace flippR_driver namespace flippR_driver
{ {
namespace utility namespace utility
@@ -23,6 +23,7 @@ namespace utility
class OutputGPIOInterface : public GPIOInterface class OutputGPIOInterface : public GPIOInterface
{ {
using namespace nlohmann;
public: public:
OutputGPIOInterface(std::istream &output_config_stream); OutputGPIOInterface(std::istream &output_config_stream);
@@ -40,27 +41,23 @@ public:
void write_display(output::items::IDisplay &display); void write_display(output::items::IDisplay &display);
private: private:
void parse_pin_bases(json &output_config_stream); void parse_output_config(json &output_config);
void initialize_i2c_addresses(json &output_config); void parse_pins_driver_board(json &driver_board_config);
void parse_pins_sound(json &sound_board_config);
char parse_i2c_address_driver_board(json &output_config_stream); void parse_pins_display(json &display_board_config);
char parse_i2c_address_sound_board(json &output_config_stream); void initialize_i2c_addresses();
char parse_i2c_address_display_board(json &output_config_stream);
void initialize_pins(); void initialize_pins();
void initialize_all_pins(u_int8_t pin_base);
void activate(output::items::IOutputItem outputItem); void activate(output::items::IOutputItem outputItem);
private: private:
std::mutex output_item_mutex; std::mutex output_item_mutex;
unsigned int pin_base_driver_board; std::map<std::string, u_int8_t> pins_driver_board = {{"i2c_address", 0}, {"pin_base", 0}, {"data", 0}. {"CL", 0}, {"latch-select-A", "0"}, {"latch-select-B", "0"}, {"latch-select-C", 0}, {"mux1", 0}, {"mux2", 0}, {"pin-select-A", 0}, {"pin-select-B", 0}, {"pin-select-C", 0}};
unsigned int pin_base_sounds; std::map<std::string, u_int8_t> pins_sound = {{"i2c_address", 0}, {"pin_base", 0}, {"fire", 0}. {"A", 0}, {"B", "0"}, {"C", "0"}, {"D", 0}, {"E", 0}, {"F", 0}, {"G", 0}};
unsigned int pin_base_displays; std::map<std::string, u_int8_t> pins_display = {{"i2c_address", 0}, {"pin_base", 0}, {"fire", 0}. {"A", 0}, {"B", "0"}, {"C", "0"}, {"D", 0}, {"E", 0}, {"F", 0}, {"G", 0}};
}; };
} }

View File

@@ -2,7 +2,7 @@
* BlockingQueue.hpp * BlockingQueue.hpp
* *
* Created on: May 17, 2018 * Created on: May 17, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "easylogging++.h" #include "easylogging++.h"

View File

@@ -2,7 +2,7 @@
* TestDetector.cpp * TestDetector.cpp
* *
* Created on: Jun 27, 2018 * Created on: Jun 27, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */

View File

@@ -2,7 +2,7 @@
* TestEventHandler.cpp * TestEventHandler.cpp
* *
* Created on: Jun 28, 2018 * Created on: Jun 28, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "catch.hpp" #include "catch.hpp"

View File

@@ -2,7 +2,7 @@
* TestEventNotifier.cpp * TestEventNotifier.cpp
* *
* Created on: Jun 19, 2018 * Created on: Jun 19, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */

View File

@@ -2,7 +2,7 @@
* TestInputDriver.cpp * TestInputDriver.cpp
* *
* Created on: May 31, 2018 * Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "catch.hpp" #include "catch.hpp"

View File

@@ -2,7 +2,7 @@
* tests-main.cpp * tests-main.cpp
* *
* Created on: May 6, 2018 * Created on: May 6, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#define CATCH_CONFIG_MAIN #define CATCH_CONFIG_MAIN

View File

@@ -2,7 +2,7 @@
* TestDisplay.cpp * TestDisplay.cpp
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */

View File

@@ -2,7 +2,7 @@
* TestDisplayController.cpp * TestDisplayController.cpp
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "catch.hpp" #include "catch.hpp"

View File

@@ -2,7 +2,7 @@
* TestLamp.cpp * TestLamp.cpp
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "catch.hpp" #include "catch.hpp"

View File

@@ -2,7 +2,7 @@
* TestOutputDriver.cpp * TestOutputDriver.cpp
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "catch.hpp" #include "catch.hpp"

View File

@@ -2,7 +2,7 @@
* TestCabinetItem.cpp * TestCabinetItem.cpp
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */

View File

@@ -2,7 +2,7 @@
* TestSolenoid.cpp * TestSolenoid.cpp
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */

View File

@@ -2,7 +2,7 @@
* TestSound.cpp * TestSound.cpp
* *
* Created on: Aug 7, 2018 * Created on: Aug 7, 2018
* Author: rhetenor * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/ */
#include "catch.hpp" #include "catch.hpp"