working on gpio interface and refactored author names
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* BlockingQueue.hpp
|
||||
*
|
||||
* 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_
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* DisplayGPIOInterface.cpp
|
||||
*
|
||||
* Created on: Nov 9, 2018
|
||||
* Author: johannes
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#include "DisplayGPIOInterface.h"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* DisplayGPIOInterface.h
|
||||
*
|
||||
* Created on: Nov 9, 2018
|
||||
* Author: johannes
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef SRC_UTILITY_DISPLAYGPIOINTERFACE_H_
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* GPIOInterface.cpp
|
||||
*
|
||||
* 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"
|
||||
@@ -29,6 +29,11 @@ void GPIOInterface::initialize_input_pin(char address)
|
||||
pinMode(address, INPUT);
|
||||
}
|
||||
|
||||
void GPIOInterface::initialize_output_pin(char address)
|
||||
{
|
||||
pinMode(address, OUTPUT);
|
||||
}
|
||||
|
||||
void GPIOInterface::write_pin(char address, char data)
|
||||
{
|
||||
digitalWrite(address, data);
|
||||
@@ -39,10 +44,6 @@ bool GPIOInterface::read_pin(char address)
|
||||
return PULLDOWN == digitalRead(address);
|
||||
}
|
||||
|
||||
void GPIOInterface::initialize_output_pin(char address)
|
||||
{
|
||||
pinMode(address, OUTPUT);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* TODO
|
||||
*
|
||||
* 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_
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* BlockingQueue.hpp
|
||||
*
|
||||
* 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_
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* InputGPIOInterface.h
|
||||
*
|
||||
* 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_
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* InputGPIOInterface.cpp
|
||||
*
|
||||
* 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>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* InputGPIOInterface.h
|
||||
*
|
||||
* 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_
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* LoggerFactory.hpp
|
||||
*
|
||||
* 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_
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* OutputGPIOInterface.h
|
||||
*
|
||||
* 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"
|
||||
@@ -18,18 +18,56 @@ OutputGPIOInterface::OutputGPIOInterface(std::istream &output_config_stream)
|
||||
json output_config;
|
||||
output_config_stream >> output_config;
|
||||
|
||||
parse_pin_bases(output_config);
|
||||
parse_output_config(output_config);
|
||||
|
||||
initialize_i2c_addresses(output_config);
|
||||
|
||||
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));
|
||||
mcp23017Setup(i2c_address_sounds, parse_i2c_address_sound_board(output_config));
|
||||
mcp23017Setup(pin_base_displays, parse_i2c_address_display_board(output_config));
|
||||
parse_pins_driver_board(output_config.at("driver_board"));
|
||||
parse_pins_sound(output_config.at("sound_board"));
|
||||
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)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* OutputGPIOInterface.h
|
||||
*
|
||||
* 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_
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <mcp23017.h>
|
||||
#include <mutex>
|
||||
|
||||
#include <map>
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace utility
|
||||
@@ -23,6 +23,7 @@ namespace utility
|
||||
|
||||
class OutputGPIOInterface : public GPIOInterface
|
||||
{
|
||||
using namespace nlohmann;
|
||||
|
||||
public:
|
||||
OutputGPIOInterface(std::istream &output_config_stream);
|
||||
@@ -40,27 +41,23 @@ public:
|
||||
void write_display(output::items::IDisplay &display);
|
||||
|
||||
private:
|
||||
void parse_pin_bases(json &output_config_stream);
|
||||
void initialize_i2c_addresses(json &output_config);
|
||||
|
||||
char parse_i2c_address_driver_board(json &output_config_stream);
|
||||
char parse_i2c_address_sound_board(json &output_config_stream);
|
||||
char parse_i2c_address_display_board(json &output_config_stream);
|
||||
void parse_output_config(json &output_config);
|
||||
void parse_pins_driver_board(json &driver_board_config);
|
||||
void parse_pins_sound(json &sound_board_config);
|
||||
void parse_pins_display(json &display_board_config);
|
||||
void initialize_i2c_addresses();
|
||||
|
||||
void initialize_pins();
|
||||
void initialize_all_pins(u_int8_t pin_base);
|
||||
|
||||
void activate(output::items::IOutputItem outputItem);
|
||||
|
||||
private:
|
||||
std::mutex output_item_mutex;
|
||||
|
||||
unsigned int pin_base_driver_board;
|
||||
unsigned int pin_base_sounds;
|
||||
unsigned int pin_base_displays;
|
||||
|
||||
|
||||
|
||||
|
||||
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}};
|
||||
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}};
|
||||
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}};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* BlockingQueue.hpp
|
||||
*
|
||||
* 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"
|
||||
|
||||
Reference in New Issue
Block a user