]> www.fi.muni.cz Git - bike-lights.git/commitdiff
pattern.c: make patterns accessible from other modules
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 14 Nov 2012 00:11:36 +0000 (01:11 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 14 Nov 2012 00:11:36 +0000 (01:11 +0100)
firmware/lights.h
firmware/pattern.c

index 243700f9fa44b65171e7633f2d0fa99f24cfa4c3..9fe2cebd3b10f6d3882b00016ff4b2b04c5d0b6f 100644 (file)
@@ -57,9 +57,19 @@ extern volatile unsigned char ambient_zone;
 void ambient_adc(uint16_t adc_val);
 
 /* pattern.c */
+typedef struct {
+       unsigned char mode: 3;
+       unsigned char duration: 5;
+} pattern_t;
+
+#define PATTERN_END { 0, 0 }
+extern pattern_t off_pattern[];
+extern pattern_t on_pattern[];
+
 void pattern_init();
 void patterns_next_tick();
 void led_set_status(unsigned char status);
+void led_set_pattern(unsigned char led, pattern_t *pattern);
 
 /* buttons.c */
 void init_buttons();
index 78f988034fad04bfe0432aeac18d0a566f23c31c..2e06b67e476fca2c35dad4fe0ef7e39648bff413 100644 (file)
@@ -2,20 +2,19 @@
 
 #include "lights.h"
 
-typedef struct {
-       unsigned char mode: 3;
-       unsigned char duration: 5;
-} pattern_t;
-
 static unsigned char led_counters[N_LEDS];
 static pattern_t *led_patterns[N_LEDS];
 
-#define PATTERN_END { 0, 0 }
 pattern_t off_pattern[] = {
        { 0, 0x1F },
        PATTERN_END
 };
 
+pattern_t on_pattern[] = {
+       { 1, 0x1F },
+       PATTERN_END
+};
+
 pattern_t blink_pattern[] = {
        { 1, 0x4 },
        { 0, 0x8 },