Skip to content

Commit

Permalink
feat(hepa-uv): Add led hardware and push button led task.
Browse files Browse the repository at this point in the history
  • Loading branch information
vegano1 committed Jan 20, 2024
1 parent 2809beb commit 868ac67
Show file tree
Hide file tree
Showing 11 changed files with 690 additions and 4 deletions.
13 changes: 12 additions & 1 deletion hepa-uv/core/tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,32 @@ static auto hepa_task_builder =
static auto uv_task_builder =
freertos_task::TaskStarter<512, uv_task::UVTask>{};

static auto light_control_task_builder =
freertos_task::TaskStarter<512, light_control_task::LightControlTask>{};

/**
* Start hepa_uv tasks.
*/
void hepauv_tasks::start_tasks(
can::bus::CanBus& can_bus,
gpio_drive_hardware::GpioDrivePins& gpio_drive_pins) {
gpio_drive_hardware::GpioDrivePins& gpio_drive_pins,
light_control_task::LightControlInterface& led_hardware) {
auto& can_writer = can_task::start_writer(can_bus);
can_task::start_reader(can_bus);

auto& hepa_task = hepa_task_builder.start(5, "hepa_fan", gpio_drive_pins);
auto& uv_task = uv_task_builder.start(5, "uv_ballast", gpio_drive_pins);
auto& light_control_task = light_control_task_builder.start(5, "push_button_leds", led_hardware);

tasks.hepa_task_handler = &hepa_task;
tasks.uv_task_handler = &uv_task;
tasks.light_control_task_handler = &light_control_task;
tasks.can_writer = &can_writer;

queues.set_queue(&can_writer.get_queue());
queues.hepa_queue = &hepa_task.get_queue();
queues.uv_queue = &uv_task.get_queue();
queues.light_control_queue = &light_control_task.get_queue();
}

hepauv_tasks::QueueClient::QueueClient(can::ids::NodeId this_fw)
Expand All @@ -53,6 +60,10 @@ void hepauv_tasks::QueueClient::send_uv_message(const uv_task::TaskMessage& m) {
uv_queue->try_write(m);
}

void hepauv_tasks::QueueClient::send_light_control_message(const light_control_task::TaskMessage& m) {
light_control_queue->try_write(m);
}

/**
* Access to the tasks singleton
* @return
Expand Down
2 changes: 2 additions & 0 deletions hepa-uv/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(REVISIONS hepa-rev1)
# Add source files that should be checked by clang-tidy here
set(HEPA_UV_FW_LINTABLE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/freertos_idle_timer_task.cpp
${CMAKE_CURRENT_SOURCE_DIR}/light_control_task/light_control_hardware.cpp
${COMMON_EXECUTABLE_DIR}/system/iwdg.cpp
${CAN_FW_DIR}/hal_can_bus.cpp
${CAN_FW_DIR}/utils.c
Expand All @@ -23,6 +24,7 @@ set(HEPAUV_FW_NON_LINTABLE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stm32g4xx_it.c
${CMAKE_CURRENT_SOURCE_DIR}/clocking.c
${CMAKE_CURRENT_SOURCE_DIR}/utility_gpio.c
${CMAKE_CURRENT_SOURCE_DIR}/led_hardware.c
${CMAKE_CURRENT_SOURCE_DIR}/can.c
${CMAKE_CURRENT_SOURCE_DIR}/i2c_setup.c
${COMMON_EXECUTABLE_DIR}/errors/errors.c
Expand Down
Loading

0 comments on commit 868ac67

Please sign in to comment.