refactored matrix_config to input_config
This commit is contained in:
@@ -42,32 +42,32 @@ void InputGPIOInterface::write_col(char data)
|
||||
}
|
||||
|
||||
|
||||
InputGPIOInterface::InputGPIOInterface(std::istream& matrix_config_stream)
|
||||
InputGPIOInterface::InputGPIOInterface(std::istream& input_config_stream)
|
||||
{
|
||||
init_members(matrix_config_stream);
|
||||
init_members(input_config_stream);
|
||||
|
||||
init_pins();
|
||||
}
|
||||
|
||||
void InputGPIOInterface::init_members(std::istream &matrix_config_stream)
|
||||
void InputGPIOInterface::init_members(std::istream &input_config_stream)
|
||||
{
|
||||
json matrix_config;
|
||||
matrix_config_stream >> matrix_config;
|
||||
json input_config;
|
||||
input_config_stream >> input_config;
|
||||
|
||||
try {
|
||||
json matrix_config_input = matrix_config.at("input");
|
||||
json matrix_config_input = input_config.at("input");
|
||||
|
||||
json row_json = matrix_config.at("row");
|
||||
json row_json = input_config.at("row");
|
||||
row_address_A = row_json.at("A").get<json::number_integer_t>();
|
||||
row_address_B = row_json.at("B").get<json::number_integer_t>();
|
||||
row_address_C = row_json.at("C").get<json::number_integer_t>();
|
||||
|
||||
json col_json = matrix_config.at("col");
|
||||
json col_json = input_config.at("col");
|
||||
col_address_A = col_json.at("A").get<json::number_integer_t>();
|
||||
col_address_B = col_json.at("B").get<json::number_integer_t>();
|
||||
col_address_C = col_json.at("C").get<json::number_integer_t>();
|
||||
|
||||
data_address = matrix_config.at("data").get<nlohmann::json::number_integer_t>();
|
||||
data_address = input_config.at("data").get<nlohmann::json::number_integer_t>();
|
||||
} catch (json::type_error& e) {
|
||||
CLOG(ERROR, INPUT_LOGGER) << "ERROR";
|
||||
} catch (json::out_of_range& e) {
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
class InputGPIOInterface : public IInputGPIOInterface, GPIOInterface
|
||||
{
|
||||
public:
|
||||
InputGPIOInterface(std::istream& matrix_config_stream);
|
||||
InputGPIOInterface(std::istream& input_config_stream);
|
||||
bool read_data(char pin);
|
||||
|
||||
private:
|
||||
void init_members(std::istream& matrix_config_stream);
|
||||
void init_members(std::istream& input_config_stream);
|
||||
void init_pins();
|
||||
void write_row(char data);
|
||||
void write_col(char data);
|
||||
|
||||
Reference in New Issue
Block a user