Skip to content

Commit

Permalink
Move Pin.hpp to kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
lptr committed Oct 27, 2024
1 parent f9cae6a commit 3fe0cdd
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions main/devices/UglyDucklingMk4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <kernel/FileSystem.hpp>
#include <kernel/Kernel.hpp>
#include <kernel/Pin.hpp>
#include <kernel/Service.hpp>
#include <kernel/drivers/BatteryDriver.hpp>
#include <kernel/drivers/Drv8801Driver.hpp>
Expand All @@ -15,7 +16,6 @@
#include <peripherals/valve/Valve.hpp>

#include <devices/DeviceDefinition.hpp>
#include <devices/Pin.hpp>

using namespace farmhub::kernel;
using namespace farmhub::peripherals::chicken_door;
Expand Down Expand Up @@ -59,8 +59,8 @@ class UglyDucklingMk4 : public DeviceDefinition<Mk4Config> {
public:
UglyDucklingMk4()
: DeviceDefinition<Mk4Config>(
pins::STATUS,
pins::BOOT) {
pins::STATUS,
pins::BOOT) {
}

void registerDeviceSpecificPeripheralFactories(PeripheralManager& peripheralManager) override {
Expand Down
6 changes: 3 additions & 3 deletions main/devices/UglyDucklingMk5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <kernel/FileSystem.hpp>
#include <kernel/Kernel.hpp>
#include <kernel/Pin.hpp>
#include <kernel/Service.hpp>
#include <kernel/drivers/BatteryDriver.hpp>
#include <kernel/drivers/Drv8874Driver.hpp>
Expand All @@ -13,7 +14,6 @@
#include <peripherals/valve/Valve.hpp>

#include <devices/DeviceDefinition.hpp>
#include <devices/Pin.hpp>

using namespace farmhub::kernel;
using namespace farmhub::peripherals::chicken_door;
Expand Down Expand Up @@ -79,8 +79,8 @@ class UglyDucklingMk5 : public DeviceDefinition<Mk5Config> {
public:
UglyDucklingMk5()
: DeviceDefinition<Mk5Config>(
pins::STATUS,
pins::BOOT) {
pins::STATUS,
pins::BOOT) {
}

void registerDeviceSpecificPeripheralFactories(PeripheralManager& peripheralManager) override {
Expand Down
2 changes: 1 addition & 1 deletion main/devices/UglyDucklingMk6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <kernel/FileSystem.hpp>
#include <kernel/Kernel.hpp>
#include <kernel/Pin.hpp>
#include <kernel/Service.hpp>
#include <kernel/drivers/BatteryDriver.hpp>
#include <kernel/drivers/Drv8833Driver.hpp>
Expand All @@ -16,7 +17,6 @@
#include <peripherals/valve/Valve.hpp>

#include <devices/DeviceDefinition.hpp>
#include <devices/Pin.hpp>

using namespace farmhub::kernel;
using namespace farmhub::peripherals::chicken_door;
Expand Down
2 changes: 1 addition & 1 deletion main/devices/UglyDucklingMk7.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <kernel/FileSystem.hpp>
#include <kernel/Kernel.hpp>
#include <kernel/Pin.hpp>
#include <kernel/Service.hpp>
#include <kernel/drivers/Bq27220Driver.hpp>
#include <kernel/drivers/Drv8833Driver.hpp>
Expand All @@ -14,7 +15,6 @@
#include <peripherals/valve/Valve.hpp>

#include <devices/DeviceDefinition.hpp>
#include <devices/Pin.hpp>

using namespace farmhub::kernel;
using namespace farmhub::peripherals::chicken_door;
Expand Down
6 changes: 3 additions & 3 deletions main/kernel/I2CManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include <Arduino.h>
#include <Wire.h>

#include <devices/Pin.hpp>
#include <kernel/Log.hpp>
#include <kernel/Pin.hpp>

namespace farmhub::kernel {

using std::shared_ptr;

using farmhub::devices::PinPtr;
using farmhub::kernel::PinPtr;

using GpioPair = std::pair<PinPtr, PinPtr>;

Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions main/devices/Pin.hpp → main/kernel/Pin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <ArduinoJson.h>

namespace farmhub::devices {
namespace farmhub::kernel {

class Pin;
using PinPtr = std::shared_ptr<Pin>;
Expand Down Expand Up @@ -125,14 +125,14 @@ class InternalPin : public Pin {
std::map<String, InternalPinPtr> InternalPin::INTERNAL_BY_NAME;
std::map<gpio_num_t, InternalPinPtr> 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<PinPtr> {
Expand Down
4 changes: 2 additions & 2 deletions main/kernel/drivers/BatteryDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#include <Arduino.h>

#include <devices/Pin.hpp>
#include <kernel/Log.hpp>
#include <kernel/Pin.hpp>
#include <kernel/Telemetry.hpp>

using farmhub::devices::PinPtr;
using farmhub::kernel::PinPtr;

namespace farmhub::kernel::drivers {

Expand Down
4 changes: 2 additions & 2 deletions main/kernel/drivers/LedDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#include <chrono>
#include <list>

#include <devices/Pin.hpp>
#include <kernel/Concurrent.hpp>
#include <kernel/Log.hpp>
#include <kernel/Pin.hpp>
#include <kernel/Task.hpp>

using namespace std::chrono;

using farmhub::devices::PinPtr;
using farmhub::kernel::PinPtr;

namespace farmhub::kernel::drivers {

Expand Down
4 changes: 2 additions & 2 deletions main/kernel/drivers/SwitchManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

#include <Arduino.h>

#include <devices/Pin.hpp>
#include <kernel/Concurrent.hpp>
#include <kernel/Log.hpp>
#include <kernel/Pin.hpp>
#include <kernel/Task.hpp>

using namespace std::chrono;

using farmhub::devices::PinPtr;
using farmhub::kernel::PinPtr;

namespace farmhub::kernel::drivers {

Expand Down
2 changes: 1 addition & 1 deletion main/peripherals/multiplexer/Xl9535.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <Arduino.h>
#include <Wire.h>

#include <devices/Pin.hpp>
#include <kernel/Pin.hpp>
#include <kernel/Component.hpp>
#include <kernel/Configuration.hpp>

Expand Down

0 comments on commit 3fe0cdd

Please sign in to comment.