restored OUtputPinController
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
####################### OPTIONS #########################
|
||||
option(CROSS_COMPILE "Enables crosscompiling for raspberry pi" OFF)
|
||||
option(BUILD_SHARED_LIB "Build a shared lib instead of a static." OFF)
|
||||
option(ENABLE_TESTING "Enables testing." ON)
|
||||
option(CROSS_COMPILE "Enables crosscompiling for raspberry pi" OFF)
|
||||
option(BUILD_NETWORKING "Build socket communication executable." ON)
|
||||
option(BUILD_CLI "Makes a basic testing cli" OFF)
|
||||
|
||||
#################### CONFIGURATION ######################
|
||||
@@ -144,19 +145,15 @@ if(NOT CMAKE_THREAD_LIBS_INIT)
|
||||
endif()
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${Threads_LIBRARIES})
|
||||
|
||||
####################### POCO ##############################
|
||||
find_package(Poco REQUIRED COMPONENTS Foundation Net JSON )
|
||||
|
||||
if(NOT Poco_FOUND)
|
||||
message(FATAL_ERROR, "Could not find libPoco")
|
||||
endif()
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Poco::Foundation Poco::Net Poco::JSON)
|
||||
|
||||
|
||||
if(ENABLE_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif(ENABLE_TESTING)
|
||||
|
||||
if(BUILD_NETWORKING)
|
||||
add_subdirectory(networking)
|
||||
endif(BUILD_NETWORKING)
|
||||
|
||||
if(BUILD_CLI)
|
||||
add_subdirectory(cli)
|
||||
endif(BUILD_CLI)
|
||||
|
||||
23
FlippR-Driver/networking/CMakeLists.txt
Normal file
23
FlippR-Driver/networking/CMakeLists.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.6.2)
|
||||
project(flippR_driver_networking)
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/${OUTPUT_PATH}/cli)
|
||||
set(SOURCES
|
||||
input/SocketHandler.cpp
|
||||
output/OutputRequestHandler.cpp
|
||||
output/OutputRequestHandlerFactory.cpp
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE FlippR-Driver)
|
||||
|
||||
####################### POCO ##############################
|
||||
find_package(Poco REQUIRED COMPONENTS Foundation Net JSON )
|
||||
|
||||
if(NOT Poco_FOUND)
|
||||
message(FATAL_ERROR, "Could not find libPoco")
|
||||
endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Poco::Foundation Poco::Net Poco::JSON)
|
||||
33
FlippR-Driver/src/output/OutputPinController.cpp
Normal file
33
FlippR-Driver/src/output/OutputPinController.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* OutputGPIOInterface.h
|
||||
*
|
||||
* Created on: May 31, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#include "OutputPinController.h"
|
||||
|
||||
#include "utility/config.h"
|
||||
|
||||
#include "wiringPi/mcp23017.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
void OutputPinController::initialize_i2c_address(uint8_t i2c_address, uint8_t pin_base)
|
||||
{
|
||||
mcp23017Setup(pin_base, i2c_address);
|
||||
}
|
||||
|
||||
void OutputPinController::initialize_pins_output(uint8_t pin_base, std::map<std::string, uint8_t>::iterator begin, std::map<std::string, uint8_t>::iterator end)
|
||||
{
|
||||
for(; begin != end; begin++)
|
||||
{
|
||||
initialize_output_pin(pin_base + begin->second);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
41
FlippR-Driver/src/output/OutputPinController.h
Normal file
41
FlippR-Driver/src/output/OutputPinController.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* OutputGPIOInterface.h
|
||||
*
|
||||
* Created on: May 31, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef SRC_UTILITIES_OUTPUTGPIOINTERFACE_H_
|
||||
#define SRC_UTILITIES_OUTPUTGPIOINTERFACE_H_
|
||||
|
||||
#include "PinController.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
namespace items
|
||||
{
|
||||
class DriverBoardItem;
|
||||
}
|
||||
class OutputPinController : public PinController
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~OutputPinController() = default;
|
||||
|
||||
virtual void activate(items::DriverBoardItem &driver_board_item) = 0;
|
||||
virtual void deactivate(items::DriverBoardItem &driver_board_item) = 0;
|
||||
|
||||
protected:
|
||||
static void initialize_i2c_address(uint8_t i2c_address, uint8_t pin_base);
|
||||
static void initialize_pins_output(uint8_t pin_base, std::map<std::string, uint8_t>::iterator begin, std::map<std::string, uint8_t>::iterator end);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user