From 8f9cc64f2667c485b21e3b683cbf622099bdfbdd Mon Sep 17 00:00:00 2001 From: vegano1 Date: Wed, 17 Jan 2024 12:41:57 -0500 Subject: [PATCH] lint --- hepa-uv/core/tasks.cpp | 57 +++++++++++-------------- hepa-uv/firmware/main_rev1.cpp | 5 ++- include/hepa-uv/core/hepa_task.hpp | 19 ++++----- include/hepa-uv/core/messages.hpp | 3 +- include/hepa-uv/core/tasks.hpp | 11 +++-- include/hepa-uv/firmware/utility_gpio.h | 2 + 6 files changed, 43 insertions(+), 54 deletions(-) diff --git a/hepa-uv/core/tasks.cpp b/hepa-uv/core/tasks.cpp index 9e8516b03..c4105d7c5 100644 --- a/hepa-uv/core/tasks.cpp +++ b/hepa-uv/core/tasks.cpp @@ -4,48 +4,39 @@ #include "common/core/freertos_timer.hpp" #include "hepa-uv/core/can_task.hpp" #include "hepa-uv/firmware/gpio_drive_hardware.hpp" -#include "hepa-uv/firmware/utility_gpio.h" - #pragma GCC diagnostic push // NOLINTNEXTLINE(clang-diagnostic-unknown-warning-option) #pragma GCC diagnostic ignored "-Wvolatile" -#include "platform_specific_hal_conf.h" +#include "hepa-uv/firmware/utility_gpio.h" #pragma GCC diagnostic pop static auto tasks = hepauv_tasks::AllTask{}; static auto queues = hepauv_tasks::QueueClient{can::ids::NodeId::hepa_uv}; -static auto gpio_drive_pins = gpio_drive_hardware::GpioDrivePins { - .door_open = gpio::PinConfig{ - .port = DOOR_OPEN_MCU_PORT, - .pin = DOOR_OPEN_MCU_PIN, - .active_setting = DOOR_OPEN_MCU_AS - }, - .reed_switch = gpio::PinConfig{ - .port = REED_SW_MCU_PORT, - .pin = REED_SW_MCU_PIN, - .active_setting = REED_SW_MCU_AS - }, - .hepa_push_button = gpio::PinConfig{ - .port = HEPA_NO_MCU_PORT, - .pin = HEPA_NO_MCU_PIN, - }, - .uv_push_button = gpio::PinConfig{ - .port = UV_NO_MCU_PORT, - .pin = UV_NO_MCU_PIN, - }, - .hepa_on_off = gpio::PinConfig{ - .port = HEPA_ON_OFF_PORT, - .pin = HEPA_ON_OFF_PIN, - .active_setting = HEPA_ON_OFF_AS - }, - .uv_on_off = gpio::PinConfig{ - .port = UV_ON_OFF_MCU_PORT, - .pin = UV_ON_OFF_MCU_PIN, - .active_setting = UV_ON_OFF_AS - } -}; +static auto gpio_drive_pins = gpio_drive_hardware::GpioDrivePins{ + .door_open = gpio::PinConfig{.port = DOOR_OPEN_MCU_PORT, + .pin = DOOR_OPEN_MCU_PIN, + .active_setting = DOOR_OPEN_MCU_AS}, + .reed_switch = gpio::PinConfig{.port = REED_SW_MCU_PORT, + .pin = REED_SW_MCU_PIN, + .active_setting = REED_SW_MCU_AS}, + .hepa_push_button = + gpio::PinConfig{ + .port = HEPA_NO_MCU_PORT, + .pin = HEPA_NO_MCU_PIN, + }, + .uv_push_button = + gpio::PinConfig{ + .port = UV_NO_MCU_PORT, + .pin = UV_NO_MCU_PIN, + }, + .hepa_on_off = gpio::PinConfig{.port = HEPA_ON_OFF_PORT, + .pin = HEPA_ON_OFF_PIN, + .active_setting = HEPA_ON_OFF_AS}, + .uv_on_off = gpio::PinConfig{.port = UV_ON_OFF_MCU_PORT, + .pin = UV_ON_OFF_MCU_PIN, + .active_setting = UV_ON_OFF_AS}}; static auto hepa_task_builder = freertos_task::TaskStarter<512, hepa_task::HepaTask>{}; diff --git a/hepa-uv/firmware/main_rev1.cpp b/hepa-uv/firmware/main_rev1.cpp index 3438e7c1c..4fd8f7a59 100644 --- a/hepa-uv/firmware/main_rev1.cpp +++ b/hepa-uv/firmware/main_rev1.cpp @@ -20,9 +20,9 @@ #include "common/firmware/gpio.hpp" #include "common/firmware/iwdg.hpp" #include "common/firmware/utility_gpio.h" +#include "hepa-uv/core/messages.hpp" #include "hepa-uv/core/tasks.hpp" #include "hepa-uv/firmware/utility_gpio.h" -#include "hepa-uv/core/messages.hpp" static auto iWatchdog = iwdg::IndependentWatchDog{}; @@ -64,7 +64,8 @@ extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { case UV_NO_MCU_PIN: if (hepa_queue_client.hepa_queue != nullptr) { static_cast(hepa_queue_client.hepa_queue->try_write_isr( - interrupt_task_messages::GPIOInterruptChanged{.pin = GPIO_Pin })); + interrupt_task_messages::GPIOInterruptChanged{ + .pin = GPIO_Pin})); } // send to uv queue here break; diff --git a/include/hepa-uv/core/hepa_task.hpp b/include/hepa-uv/core/hepa_task.hpp index 8eb4850a1..e9cb2c7df 100644 --- a/include/hepa-uv/core/hepa_task.hpp +++ b/include/hepa-uv/core/hepa_task.hpp @@ -4,8 +4,8 @@ #include "common/core/bit_utils.hpp" #include "common/core/logging.h" #include "common/core/message_queue.hpp" -#include "messages.hpp" #include "hepa-uv/firmware/gpio_drive_hardware.hpp" +#include "messages.hpp" namespace hepa_task { @@ -13,16 +13,14 @@ using TaskMessage = interrupt_task_messages::TaskMessage; class HepaMessageHandler { public: - explicit HepaMessageHandler( - gpio_drive_hardware::GpioDrivePins& drive_pins) + explicit HepaMessageHandler(gpio_drive_hardware::GpioDrivePins &drive_pins) : drive_pins{drive_pins} {} HepaMessageHandler(const HepaMessageHandler &) = delete; HepaMessageHandler(const HepaMessageHandler &&) = delete; - auto operator=(const HepaMessageHandler &) - -> HepaMessageHandler & = delete; + auto operator=(const HepaMessageHandler &) -> HepaMessageHandler & = delete; auto operator=(const HepaMessageHandler &&) -> HepaMessageHandler && = delete; - ~HepaMessageHandler() { } + ~HepaMessageHandler() {} void handle_message(const TaskMessage &m) { std::visit([this](auto o) { this->visit(o); }, m); @@ -35,7 +33,7 @@ class HepaMessageHandler { void visit(const interrupt_task_messages::GPIOInterruptChanged &m) { if (m.pin == drive_pins.hepa_push_button.pin) { hepa_push_button = !hepa_push_button; - // handle state changes here + // handle state changes here if (hepa_push_button) { gpio::set(drive_pins.hepa_on_off); } else { @@ -50,7 +48,7 @@ class HepaMessageHandler { bool hepa_push_button = false; bool hepa_fan_on = false; - gpio_drive_hardware::GpioDrivePins& drive_pins; + gpio_drive_hardware::GpioDrivePins &drive_pins; }; /** @@ -62,8 +60,7 @@ class HepaTask { public: using Messages = TaskMessage; using QueueType = QueueImpl; - HepaTask(QueueType &queue) - : queue{queue} {} + HepaTask(QueueType &queue) : queue{queue} {} HepaTask(const HepaTask &c) = delete; HepaTask(const HepaTask &&c) = delete; auto operator=(const HepaTask &c) = delete; @@ -74,7 +71,7 @@ class HepaTask { * Task entry point. */ [[noreturn]] void operator()( - gpio_drive_hardware::GpioDrivePins* drive_pins) { + gpio_drive_hardware::GpioDrivePins *drive_pins) { auto handler = HepaMessageHandler{*drive_pins}; TaskMessage message{}; for (;;) { diff --git a/include/hepa-uv/core/messages.hpp b/include/hepa-uv/core/messages.hpp index c0e2ad3d1..a1186c04c 100644 --- a/include/hepa-uv/core/messages.hpp +++ b/include/hepa-uv/core/messages.hpp @@ -13,7 +13,6 @@ struct GPIOInterruptChanged { uint8_t state; }; -using TaskMessage = - std::variant; +using TaskMessage = std::variant; } // namespace interrupt_task_messages diff --git a/include/hepa-uv/core/tasks.hpp b/include/hepa-uv/core/tasks.hpp index b2c2ea790..78019b69e 100644 --- a/include/hepa-uv/core/tasks.hpp +++ b/include/hepa-uv/core/tasks.hpp @@ -16,11 +16,10 @@ void start_tasks(can::bus::CanBus& can_bus); struct QueueClient : can::message_writer::MessageWriter { QueueClient(can::ids::NodeId this_fw); - void send_interrupt_message( - const hepa_task::TaskMessage& m); + void send_interrupt_message(const hepa_task::TaskMessage& m); - freertos_message_queue::FreeRTOSMessageQueue< - hepa_task::TaskMessage>* hepa_queue{nullptr}; + freertos_message_queue::FreeRTOSMessageQueue* + hepa_queue{nullptr}; }; /** @@ -30,8 +29,8 @@ struct AllTask { can::message_writer_task::MessageWriterTask< freertos_message_queue::FreeRTOSMessageQueue>* can_writer{nullptr}; - hepa_task::HepaTask< - freertos_message_queue::FreeRTOSMessageQueue>* hepa_task_handler{nullptr}; + hepa_task::HepaTask* + hepa_task_handler{nullptr}; }; /** diff --git a/include/hepa-uv/firmware/utility_gpio.h b/include/hepa-uv/firmware/utility_gpio.h index 94ecf6713..d5eba50c0 100644 --- a/include/hepa-uv/firmware/utility_gpio.h +++ b/include/hepa-uv/firmware/utility_gpio.h @@ -18,7 +18,9 @@ void utility_gpio_init(); #pragma GCC diagnostic push // NOLINTNEXTLINE(clang-diagnostic-unknown-warning-option) +#include "platform_specific_hal_conf.h" #pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic pop /* ---- Generic Pins ---- */