From 8fed43c086c79174e223c4be9597d431130caf0f Mon Sep 17 00:00:00 2001 From: Mitchell M Date: Sat, 4 Apr 2026 16:35:47 -0500 Subject: [PATCH] game timer --- components/blk_box_lib | 2 +- main/main.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/components/blk_box_lib b/components/blk_box_lib index b3bcb41..7505217 160000 --- a/components/blk_box_lib +++ b/components/blk_box_lib @@ -1 +1 @@ -Subproject commit b3bcb4108da4d9f745405ec6bb08d94545eeca30 +Subproject commit 75052174a60977d440780f94051ae69d1fba1dd5 diff --git a/main/main.cpp b/main/main.cpp index ab12234..ff3f6ca 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -11,6 +11,7 @@ #include "blk_box_drivers/inputs.hpp" #include "blk_box_drivers/leds.hpp" #include "blk_box_drivers/char_lcd.hpp" +#include "blk_box_drivers/ssegs.hpp" #include "blk_box_drivers/helpers.hpp" extern "C" void app_main(void) { @@ -24,6 +25,9 @@ extern "C" void app_main(void) { LCDController::set_resting_cursor_mode(CursorMode::Show); LCDController::set_resting_cursor_pos(0, 0); + SSegController::enable_game_timer(); + SSegController::enable_module_timer(); + uint32_t i = 0; while (1) { @@ -48,6 +52,22 @@ extern "C" void app_main(void) { if (InputsController::has_switch_flip()) { SwitchFlip flip = InputsController::wait_switch_flip(); printf("Switch flipped: %d, new state: %d\n", raw_value(flip.get_switch()), flip.is_up()); + if (flip.get_switch() == Switch::S1) { + SSegController::set_game_time(SSegController::get_game_time() + 10000); + } + if (flip.get_switch() == Switch::S2) { + SSegController::set_module_time(SSegController::get_module_time() + 10000); + } + if (flip.get_switch() == Switch::S3) { + SSegController::start_game_timer(); + } + if (flip.get_switch() == Switch::S4) { + if (flip.is_up()) { + SSegController::start_module_timer(); + } else { + SSegController::stop_module_timer(); + } + } } if (InputsController::has_keypad_press()) {