reworked inputgpiointerface

This commit is contained in:
Jonas Zeunert
2018-05-31 16:11:46 +02:00
parent 9ab84bb060
commit fffaa9ccc8
3 changed files with 10 additions and 4 deletions

View File

@@ -23,8 +23,8 @@ using namespace nlohmann;
class GPIOInterface
{
public:
GPIOInterface(std::string config_path) = 0;
~GPIOInterface();
GPIOInterface(std::string config_path);
virtual ~GPIOInterface();
static void write_pin(char address, char data)
{

View File

@@ -10,8 +10,12 @@
class InputGPIOInterface
{
bool InputGPIOInterface::read_input_data()
bool InputGPIOInterface::read_input_data(char pin)
{
// setting address to read
write_input_row(pin / MATRIX_SIZE);
write_input_col(pin % MATRIX_SIZE);
return read_pin(this->input_data_address);
}

View File

@@ -10,13 +10,15 @@
#include "GPIOInterface.hpp"
#define MATRIX_SIZE 8
class InputGPIOInterface : GPIOInterface
{
public:
bool read_input_data();
private:
void write_input_row(char data);
void write_input_col(char data);
bool read_input_data();
private:
char input_row_address;