From 73fef2af546d67c7217445c149b74d7be92b531f Mon Sep 17 00:00:00 2001 From: Stefan Rupp Date: Fri, 14 Mar 2014 03:21:39 +0100 Subject: [PATCH] some basic patters. with bugs included. --- ledcontroller.c | 1 - main.c | 8 +++- rgbyteclock.c | 122 ++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 103 insertions(+), 28 deletions(-) diff --git a/ledcontroller.c b/ledcontroller.c index 72324f2..2081a1b 100644 --- a/ledcontroller.c +++ b/ledcontroller.c @@ -236,5 +236,4 @@ void ledcontroller_set_channel(uint8_t channel, uint16_t value) void ledcontroller_clear(void) { memset(ledbuffer, 0x00, sizeof(ledbuffer)); - led_flush(); } diff --git a/main.c b/main.c index 7b5c1c5..233b9d9 100644 --- a/main.c +++ b/main.c @@ -23,13 +23,17 @@ int main(void) { timer_init(); - //rtc_init(0); + rtc_init(0); //spi_slave_init(); ledcontroller_init(); sei(); + //lcd_init(); - DDRC |= (1< 11) { l_mins_next = 0; } + if (l_hours_next > 11) { l_hours_next = 0; } + + uint16_t d_m1, d_m2; + uint16_t d_h1, d_h2; + + d_m2 = ((mins%5)*0x7ffUL)/4; + d_h2 = ((hours%5)*0xfffUL)/4; + d_m1 = ((4-(mins%5))*0x7ffUL)/4; + d_h1 = ((4-(hours%5))*0xfffUL)/4; + + + ledcontroller_clear(); + for (int led=0;led<12;led++) { + led_set(led, 0x000f, 0, 0); + } + if (l_mins != l_hours) { + led_set(l_mins, 0xf, d_m1, 0); + led_set(l_hours, 0xf, 0, d_h1); + led_set(l_mins_next, 0xf, d_m2, 0); + led_set(l_hours_next, 0xf, 0, d_h2); + } + else { + led_set(l_mins, 0xf, d_m1, d_h1); + led_set(l_mins_next, 0xf, d_m2, d_h2); + } + led_flush(); + } + } +} + + +void rgbyteclock(void) +{ + //rgbyteclock_rounds(); + //rgbyteclock_secwatch(); + rgbyteclock_secwatch_glide(); +}