From bbb0dc9b629575794a60895e61d0059b54aad01f Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Mon, 14 Aug 2023 22:02:20 +0200 Subject: [PATCH] Move away from using deprecated wiringPi library and use pigpio instead. --- MQTTThermostat/CMakeLists.txt | 2 +- MQTTThermostat/GPIOHeatingController.cpp | 12 ++++++------ MQTTThermostat/GPIOHeatingController.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MQTTThermostat/CMakeLists.txt b/MQTTThermostat/CMakeLists.txt index a3b9a09..19c0885 100644 --- a/MQTTThermostat/CMakeLists.txt +++ b/MQTTThermostat/CMakeLists.txt @@ -22,7 +22,7 @@ endif (HAS_AHT_SUPPORT) if (HAS_GPIO_SUPPORT) target_sources (mqttthermostat PRIVATE "GPIOHeatingController.cpp") -target_link_libraries (mqttthermostat PRIVATE wiringPi) +target_link_libraries (mqttthermostat PRIVATE pigpio) add_compile_definitions(HAS_GPIO_SUPPORT) endif (HAS_GPIO_SUPPORT) diff --git a/MQTTThermostat/GPIOHeatingController.cpp b/MQTTThermostat/GPIOHeatingController.cpp index 9eba3f8..ece65f1 100644 --- a/MQTTThermostat/GPIOHeatingController.cpp +++ b/MQTTThermostat/GPIOHeatingController.cpp @@ -2,24 +2,24 @@ #include #include "GPIOHeatingController.h" -#include "wiringPi.h" +#include using namespace std; GPIOHeatingController::GPIOHeatingController(uint32_t aPin) : mPin(aPin) { - wiringPiSetupGpio(); - pinMode(mPin, OUTPUT); + gpioInitialise(); + gpioSetMode(mPin, PI_OUTPUT); } void GPIOHeatingController::setHeatingActive(bool aActive) { if (aActive) { - digitalWrite(mPin, HIGH); + gpioWrite(mPin, 1); } else { - digitalWrite(mPin, LOW); + gpioWrite(mPin, 0); } -} \ No newline at end of file +} diff --git a/MQTTThermostat/GPIOHeatingController.h b/MQTTThermostat/GPIOHeatingController.h index f3eab9b..9c50829 100644 --- a/MQTTThermostat/GPIOHeatingController.h +++ b/MQTTThermostat/GPIOHeatingController.h @@ -9,4 +9,4 @@ public: private: uint32_t mPin; -}; \ No newline at end of file +}; -- 2.47.3