/* * clock.c * * Created on: Mar 26, 2026 * Author: ewars */ #include "clock.h" // define LED marking 12:00 or 00:00 __attribute__((section(".noinit"))) volatile uint8_t ledOffset = 0; void clock_LedOffset(uint8_t offset){ ledOffset = offset; } uint8_t clock_convert_hours(uint8_t hours){ int8_t h = 0; uint8_t led = 0; // input check if(hours < 24){ if(hours > 12){ h = hours - 12; } else{ h = hours; } led = 2 * h + ledOffset; if(led > 23){ led -= 24; } } return led; } uint8_t clock_convert_min_sec(uint8_t min_sec){ float led = 0; if(min_sec < 60){ led = (float) min_sec/(60/24); led += ledOffset; if(led > 23){ led -= 24; } } return (uint8_t) led; }