Skip to content

Commit

Permalink
Merge pull request #930 from OpenHD/2.4-evo-consti-dev
Browse files Browse the repository at this point in the history
add gpio26 control
  • Loading branch information
Consti10 committed Jun 30, 2023
2 parents bbb3e7a + 0993230 commit 2faa84d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions OpenHD/ohd_telemetry/src/gpio_control/RaspberryPiGPIOControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,24 @@ GPIOControl::GPIOControl() {

std::vector<openhd::Setting> GPIOControl::get_all_settings() {
std::vector<openhd::Setting> ret;
auto cb=[this](std::string,int value){
auto cb_gpio2=[this](std::string,int value){
if(!validate_gpio_setting_int(value))return false;
m_settings->unsafe_get_settings().gpio_2=value;
m_settings->persist();
configure_gpio(2,value);
return true;
};
ret.push_back(openhd::Setting{"GPIO_2",openhd::IntSetting{
static_cast<int>(m_settings->get_settings().gpio_2),cb}});
static_cast<int>(m_settings->get_settings().gpio_2),cb_gpio2}});
auto cb_gpio26=[this](std::string,int value){
if(!validate_gpio_setting_int(value))return false;
m_settings->unsafe_get_settings().gpio_2=value;
m_settings->persist();
configure_gpio(26,value);
return true;
};
ret.push_back(openhd::Setting{"GPIO_26",openhd::IntSetting{
static_cast<int>(m_settings->get_settings().gpio_26),cb_gpio26}});
return ret;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static constexpr int GPIO_LOW=2;

struct GPIOControlSettings {
int gpio_2 = GPIO_LEAVE_UNTOUCHED;
int gpio_26= GPIO_LEAVE_UNTOUCHED;
};

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GPIOControlSettings,gpio_2);
Expand Down

0 comments on commit 2faa84d

Please sign in to comment.