From: Jan "Yenya" Kasprzak Date: Wed, 29 Aug 2012 22:41:52 +0000 (+0200) Subject: number pattern X-Git-Tag: gedasymbols-20120913~33 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=bike-lights.git;a=commitdiff_plain;h=118fdccc786d1661fbc3821eb9872ca2eed1f860 number pattern --- diff --git a/pattern.c b/pattern.c index 0691170..c2942e5 100644 --- a/pattern.c +++ b/pattern.c @@ -91,6 +91,15 @@ void pattern_init() test_running = 0; } +static pattern_t *number_pattern(unsigned char num) +{ + if (num >= 9) + num = 9; + + return pattern_num + sizeof(pattern_num)/sizeof(pattern_t) + - 1 - 2*num; +} + static inline pattern_t *pattern_select(unsigned char n) { if (n < N_PWMLEDS && !pwmled_enabled(n)) @@ -107,8 +116,7 @@ static inline pattern_t *pattern_select(unsigned char n) return mode1_pattern; } } - return pattern_num + sizeof(pattern_num)/sizeof(pattern_t) - - 1 - 2*(1+ambient_zone); + return number_pattern(1+ambient_zone); } static void led_set_mode(unsigned char n, unsigned char mode)