reworked inputgpiointerface
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user