reworked inputgpiointerface
This commit is contained in:
@@ -23,8 +23,8 @@ using namespace nlohmann;
|
|||||||
class GPIOInterface
|
class GPIOInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GPIOInterface(std::string config_path) = 0;
|
GPIOInterface(std::string config_path);
|
||||||
~GPIOInterface();
|
virtual ~GPIOInterface();
|
||||||
|
|
||||||
static void write_pin(char address, char data)
|
static void write_pin(char address, char data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,8 +10,12 @@
|
|||||||
class InputGPIOInterface
|
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);
|
return read_pin(this->input_data_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,15 @@
|
|||||||
|
|
||||||
#include "GPIOInterface.hpp"
|
#include "GPIOInterface.hpp"
|
||||||
|
|
||||||
|
#define MATRIX_SIZE 8
|
||||||
class InputGPIOInterface : GPIOInterface
|
class InputGPIOInterface : GPIOInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool read_input_data();
|
||||||
|
|
||||||
|
private:
|
||||||
void write_input_row(char data);
|
void write_input_row(char data);
|
||||||
void write_input_col(char data);
|
void write_input_col(char data);
|
||||||
bool read_input_data();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char input_row_address;
|
char input_row_address;
|
||||||
|
|||||||
Reference in New Issue
Block a user