game timer

This commit is contained in:
Mitchell Marino 2026-04-04 16:35:47 -05:00
parent 4c52bff3e7
commit 8fed43c086
2 changed files with 21 additions and 1 deletions

@ -1 +1 @@
Subproject commit b3bcb4108da4d9f745405ec6bb08d94545eeca30
Subproject commit 75052174a60977d440780f94051ae69d1fba1dd5

View File

@ -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()) {