Added wiringPi substitute for testing purposes on other systems.

This commit is contained in:
Johannes Wendel
2019-07-17 09:36:33 +02:00
parent 5e5c196a25
commit 9cc3a7eb91
6 changed files with 58 additions and 6 deletions

View File

@@ -99,7 +99,7 @@
"priority" : 2
},
{
"name" : "1st button",
"name" : "1st Button",
"address" : 35,
"priority" : 2
},

View File

@@ -249,7 +249,7 @@
"address" : 59,
"name" : "1st Button"
},
{ // todo!
{ "todo" : "whatever",
"address" : 60,
"name" : "Flipper Relay"
},
@@ -324,6 +324,6 @@
{
"address" : 78,
"name" : "100000 Points"
},
}
]
}

View File

@@ -20,7 +20,7 @@
#include "output/items/Lamp.h"
#include "output/items/Sound.h"
#include "output/items/Display.h"
#include <output/items/Flipper.h>
#include "output/items/Flipper.h"
namespace flippR_driver

View File

@@ -9,8 +9,14 @@
#include "utility/config.h"
#ifndef NOT_PI
#include "wiringPi/wiringPi.h"
#include "wiringPi/mcp23017.h"
#endif
#ifdef NOT_PI
#include "utility/wiringPiTesting.hpp"
#endif
#include "json/json.hpp"

View File

@@ -68,12 +68,18 @@ void OutputDriver::rotate_all_lamps() const
void OutputDriver::activate_all_flipper_relays() const
{
for(auto flipper_relay : this->flippers)
{
flipper_relay.second->activate();
}
}
void OutputDriver::deactivate_all_flipper_relays() const
{
for(auto flipper_relay : this->flippers)
{
flipper_relay.second->deactivate();
}
}
std::vector<std::shared_ptr<Sound>> OutputDriver::get_sounds() const

View File

@@ -0,0 +1,40 @@
//
// Created by johannes on 17.07.19.
//
#ifndef FLIPPR_DRIVER_WIRINGPITESTING_H
#define FLIPPR_DRIVER_WIRINGPITESTING_H
#include <iostream>
#define INPUT 0
#define OUTPUT 1
static int wiringPiSetup()
{
std::cout << "WiringPiSetup() called" << std::endl;
}
void pinMode(int pin, int mode)
{
std::cout << "Set pin " << pin << " into mode " << mode << std::endl;
}
int digitalRead(int pin)
{
std::cout << "Reading pin " << pin << std::endl;
}
void digitalWrite(int pin, int value)
{
std::cout << "Writing pin " << pin << " with value " << value << std::endl;
}
int mcp23017Setup(const int pinBase, const int i2cAddress)
{
std::cout << "mcp23017Setup called with pinBase " << pinBase << " and i2cAddress " << i2cAddress << std::endl;
}
#endif //FLIPPR_DRIVER_WIRINGPITESTING_H