From 3fe0cddc550a7522f5b2c6ad514f93f3ad15715b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3r=C3=A1nt=20Pint=C3=A9r?= Date: Sun, 27 Oct 2024 23:33:15 +0100 Subject: [PATCH] Move Pin.hpp to kernel --- main/devices/UglyDucklingMk4.hpp | 6 +++--- main/devices/UglyDucklingMk5.hpp | 6 +++--- main/devices/UglyDucklingMk6.hpp | 2 +- main/devices/UglyDucklingMk7.hpp | 2 +- main/kernel/I2CManager.hpp | 6 +++--- main/{devices => kernel}/Pin.hpp | 12 ++++++------ main/kernel/drivers/BatteryDriver.hpp | 4 ++-- main/kernel/drivers/LedDriver.hpp | 4 ++-- main/kernel/drivers/SwitchManager.hpp | 4 ++-- main/peripherals/multiplexer/Xl9535.hpp | 2 +- 10 files changed, 24 insertions(+), 24 deletions(-) rename main/{devices => kernel}/Pin.hpp (95%) diff --git a/main/devices/UglyDucklingMk4.hpp b/main/devices/UglyDucklingMk4.hpp index a76849bb..dd3487d6 100644 --- a/main/devices/UglyDucklingMk4.hpp +++ b/main/devices/UglyDucklingMk4.hpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -15,7 +16,6 @@ #include #include -#include using namespace farmhub::kernel; using namespace farmhub::peripherals::chicken_door; @@ -59,8 +59,8 @@ class UglyDucklingMk4 : public DeviceDefinition { public: UglyDucklingMk4() : DeviceDefinition( - pins::STATUS, - pins::BOOT) { + pins::STATUS, + pins::BOOT) { } void registerDeviceSpecificPeripheralFactories(PeripheralManager& peripheralManager) override { diff --git a/main/devices/UglyDucklingMk5.hpp b/main/devices/UglyDucklingMk5.hpp index 7d1250a0..6ef9d5df 100644 --- a/main/devices/UglyDucklingMk5.hpp +++ b/main/devices/UglyDucklingMk5.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -13,7 +14,6 @@ #include #include -#include using namespace farmhub::kernel; using namespace farmhub::peripherals::chicken_door; @@ -79,8 +79,8 @@ class UglyDucklingMk5 : public DeviceDefinition { public: UglyDucklingMk5() : DeviceDefinition( - pins::STATUS, - pins::BOOT) { + pins::STATUS, + pins::BOOT) { } void registerDeviceSpecificPeripheralFactories(PeripheralManager& peripheralManager) override { diff --git a/main/devices/UglyDucklingMk6.hpp b/main/devices/UglyDucklingMk6.hpp index 4c7eb106..16e7fa37 100644 --- a/main/devices/UglyDucklingMk6.hpp +++ b/main/devices/UglyDucklingMk6.hpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -16,7 +17,6 @@ #include #include -#include using namespace farmhub::kernel; using namespace farmhub::peripherals::chicken_door; diff --git a/main/devices/UglyDucklingMk7.hpp b/main/devices/UglyDucklingMk7.hpp index 45a4b4cc..ad693ad5 100644 --- a/main/devices/UglyDucklingMk7.hpp +++ b/main/devices/UglyDucklingMk7.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include -#include using namespace farmhub::kernel; using namespace farmhub::peripherals::chicken_door; diff --git a/main/kernel/I2CManager.hpp b/main/kernel/I2CManager.hpp index 9178064c..b336cb75 100644 --- a/main/kernel/I2CManager.hpp +++ b/main/kernel/I2CManager.hpp @@ -8,14 +8,14 @@ #include #include -#include #include +#include namespace farmhub::kernel { using std::shared_ptr; -using farmhub::devices::PinPtr; +using farmhub::kernel::PinPtr; using GpioPair = std::pair; @@ -92,7 +92,7 @@ class I2CTransmission { return count; } - size_t write(const uint8_t *data, size_t quantity) { + size_t write(const uint8_t* data, size_t quantity) { Log.trace("Writing %d bytes to I2C device %s at address 0x%02x", quantity, device->name.c_str(), device->address); auto count = wire().write(data, quantity); diff --git a/main/devices/Pin.hpp b/main/kernel/Pin.hpp similarity index 95% rename from main/devices/Pin.hpp rename to main/kernel/Pin.hpp index d11d343a..86fb8198 100644 --- a/main/devices/Pin.hpp +++ b/main/kernel/Pin.hpp @@ -10,7 +10,7 @@ #include -namespace farmhub::devices { +namespace farmhub::kernel { class Pin; using PinPtr = std::shared_ptr; @@ -125,14 +125,14 @@ class InternalPin : public Pin { std::map InternalPin::INTERNAL_BY_NAME; std::map InternalPin::INTERNAL_BY_GPIO; -} // namespace farmhub::devices +} // namespace farmhub::kernel namespace ArduinoJson { -using farmhub::devices::Pin; -using farmhub::devices::PinPtr; -using farmhub::devices::InternalPin; -using farmhub::devices::InternalPinPtr; +using farmhub::kernel::InternalPin; +using farmhub::kernel::InternalPinPtr; +using farmhub::kernel::Pin; +using farmhub::kernel::PinPtr; template <> struct Converter { diff --git a/main/kernel/drivers/BatteryDriver.hpp b/main/kernel/drivers/BatteryDriver.hpp index 78d75395..a111a179 100644 --- a/main/kernel/drivers/BatteryDriver.hpp +++ b/main/kernel/drivers/BatteryDriver.hpp @@ -2,11 +2,11 @@ #include -#include #include +#include #include -using farmhub::devices::PinPtr; +using farmhub::kernel::PinPtr; namespace farmhub::kernel::drivers { diff --git a/main/kernel/drivers/LedDriver.hpp b/main/kernel/drivers/LedDriver.hpp index c04257ca..18c8046a 100644 --- a/main/kernel/drivers/LedDriver.hpp +++ b/main/kernel/drivers/LedDriver.hpp @@ -4,14 +4,14 @@ #include #include -#include #include #include +#include #include using namespace std::chrono; -using farmhub::devices::PinPtr; +using farmhub::kernel::PinPtr; namespace farmhub::kernel::drivers { diff --git a/main/kernel/drivers/SwitchManager.hpp b/main/kernel/drivers/SwitchManager.hpp index 98376631..55c10e0f 100644 --- a/main/kernel/drivers/SwitchManager.hpp +++ b/main/kernel/drivers/SwitchManager.hpp @@ -8,14 +8,14 @@ #include -#include #include #include +#include #include using namespace std::chrono; -using farmhub::devices::PinPtr; +using farmhub::kernel::PinPtr; namespace farmhub::kernel::drivers { diff --git a/main/peripherals/multiplexer/Xl9535.hpp b/main/peripherals/multiplexer/Xl9535.hpp index eb4ea1ac..a177f5ab 100644 --- a/main/peripherals/multiplexer/Xl9535.hpp +++ b/main/peripherals/multiplexer/Xl9535.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include