Compare commits
	
		
			24 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 74c1208c90 | |||
| 46bb236221 | |||
| 58fab8adff | |||
| 4767404675 | |||
| 3961627775 | |||
| b5c35fa926 | |||
| 6a211a74f4 | |||
| 174b16b78f | |||
| 610d5102d9 | |||
| ff58cfa596 | |||
| 76d974f182 | |||
| 2396fa70fe | |||
| 1b7c6fa5a1 | |||
| 2321c17288 | |||
| 
						 | 
					1af698cde1 | ||
| 41a80b2047 | |||
| 456eb440ab | |||
| e0fb6d4482 | |||
| 883a3006f3 | |||
| d9b7a3c915 | |||
| 3a36dae76f | |||
| ab9eef310c | |||
| c8a88debc4 | |||
| 5976a5528b | 
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
				
			|||||||
PRG            = rgbyteclock
 | 
					PRG            = rgbyteclock
 | 
				
			||||||
OBJ            = rgbyteclock.o timer.o lcd.o main.o rtc.o spi.o ringbuffer.o crc.o ledcontroller.o led1642gw.o
 | 
					OBJ            = rgbyteclock.o timer.o lcd.o main.o rtc.o spi.o ringbuffer.o crc.o ledcontroller.o rgbyteclock_patterns.o led1642gw.o
 | 
				
			||||||
MCU_TARGET     = atmega164a
 | 
					MCU_TARGET     = atmega164a
 | 
				
			||||||
OPTIMIZE       = -Os
 | 
					OPTIMIZE       = -Os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,7 +25,8 @@ $(PRG).elf: $(OBJ)
 | 
				
			|||||||
	@echo
 | 
						@echo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# dependency:
 | 
					# dependency:
 | 
				
			||||||
rgbyteclock.o: timer.o lcd.o rgbyteclock.h rtc.o spi.o ledcontroller.o
 | 
					rgbyteclock_patterns.o: timer.o lcd.o rgbyteclock_patterns.h rtc.o spi.o ledcontroller.o
 | 
				
			||||||
 | 
					rgbyteclock.o: rgbyteclock_patterns.o
 | 
				
			||||||
main.o: rgbyteclock.o lcd.o spi.o ledcontroller.o rtc.o timer.o
 | 
					main.o: rgbyteclock.o lcd.o spi.o ledcontroller.o rtc.o timer.o
 | 
				
			||||||
ledcontroller.o: led1642gw.o
 | 
					ledcontroller.o: led1642gw.o
 | 
				
			||||||
led1642gw.o: led1642gw.h led1642gw_config.h
 | 
					led1642gw.o: led1642gw.h led1642gw_config.h
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,27 +4,43 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void rgbyteclock(void)
 | 
					void rgbyteclock(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	uint8_t gain = 0x2f;
 | 
						uint8_t gain = 0;
 | 
				
			||||||
	led_set_gain(gain);
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rgbyteclock_rounds();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//rgbyteclock_rounds_white();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (int led=0;led<12;led++) {
 | 
				
			||||||
 | 
						  led_set(led, 200*(12-led), 200*(led), 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						led_flush();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	while (1) {
 | 
						while (1) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		led_set(0, 4000, 0, 0);
 | 
						  PORTC |= (1<<PC5); // Test LED
 | 
				
			||||||
 | 
						  for (int led=0;led<12;led++) {
 | 
				
			||||||
 | 
						    led_set(led, 100*(12-led), 100*(led), 100);
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
	  led_flush();
 | 
						  led_flush();
 | 
				
			||||||
		timer_wait(500);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		led_set(1, 0, 10000, 0);
 | 
						  led_set_current_mode(0);
 | 
				
			||||||
 | 
						  for (gain=0;gain<=0x3f;gain+=8) {
 | 
				
			||||||
 | 
						    led_set_gain(gain);
 | 
				
			||||||
 | 
						    timer_wait(250);
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						  PORTC &= ~(1<<PC5); // Test LED
 | 
				
			||||||
 | 
						  for (int led=0;led<12;led++) {
 | 
				
			||||||
 | 
						    led_set(led, 100*(12-led), 100*(led), 100);
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
	  led_flush();
 | 
						  led_flush();
 | 
				
			||||||
		timer_wait(500);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		led_set(0, 0, 0, 0);
 | 
						  led_set_current_mode(1);
 | 
				
			||||||
		led_flush();
 | 
						  for (gain=0;gain<=0x3f;gain+=8) {
 | 
				
			||||||
		timer_wait(500);
 | 
						    led_set_gain(gain);
 | 
				
			||||||
 | 
						    timer_wait(250);
 | 
				
			||||||
		led_set(1, 0, 0, 0);
 | 
						  }
 | 
				
			||||||
		led_flush();
 | 
					 | 
				
			||||||
		timer_wait(500);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		PORTC ^= (1<<PC5); // Test LED
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,12 @@
 | 
				
			|||||||
#define RGBYTECLOCK_H
 | 
					#define RGBYTECLOCK_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <avr/io.h>
 | 
					#include <avr/io.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "timer.h"
 | 
				
			||||||
 | 
					#include "rtc.h"
 | 
				
			||||||
 | 
					#include "lcd.h"
 | 
				
			||||||
#include "ledcontroller.h"
 | 
					#include "ledcontroller.h"
 | 
				
			||||||
 | 
					#include "rgbyteclock_patterns.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void rgbyteclock(void);
 | 
					void rgbyteclock(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										270
									
								
								rgbyteclock_patterns.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										270
									
								
								rgbyteclock_patterns.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,270 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * "THE BEER-WARE LICENSE" (Revision 42):
 | 
				
			||||||
 | 
					 * <struppi@struppi.name> wrote this file. As long as you retain this notice you
 | 
				
			||||||
 | 
					 * can do whatever you want with this stuff. If we meet some day, and you think
 | 
				
			||||||
 | 
					 * this stuff is worth it, you can buy me a beer in return.
 | 
				
			||||||
 | 
					 * (c) 2014 Stefan Rupp
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "timer.h"
 | 
				
			||||||
 | 
					#include "rtc.h"
 | 
				
			||||||
 | 
					#include "lcd.h"
 | 
				
			||||||
 | 
					#include "ledcontroller.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum { LED_OFF, LED_GLOW, LED_S0, LED_S1, LED_S2, LED_S3, LED_S4, LED_S5};
 | 
				
			||||||
 | 
					uint16_t led_values[] =  {0x00, 0x00cf, 0x00, 0x04ff, 0x08ff, 0x10ff, 0x20ff};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void rgbyteclock_rounds(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  led_turn_all_on();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  while (1) {
 | 
				
			||||||
 | 
						//PORTC ^= (1<<PC5);
 | 
				
			||||||
 | 
					    for (int i=0; i<14; i++) {
 | 
				
			||||||
 | 
					      led_set(i, 0xffff, 0x00, 0x00);
 | 
				
			||||||
 | 
					      led_flush();
 | 
				
			||||||
 | 
					      timer_wait(50);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i=0; i<14; i++) {
 | 
				
			||||||
 | 
					      led_set(i, 0x00, 0xffff, 0x00);
 | 
				
			||||||
 | 
					      led_flush();
 | 
				
			||||||
 | 
					      timer_wait(50);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    //timer_wait(100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i=0; i<14; i++) {
 | 
				
			||||||
 | 
					      led_set(i, 0x00, 0x00, 0xffff);
 | 
				
			||||||
 | 
					      led_flush();
 | 
				
			||||||
 | 
					      timer_wait(50);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    //timer_wait(100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void rgbyteclock_rounds_white(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  uint16_t brightness = 0x1fff;
 | 
				
			||||||
 | 
					  uint16_t brightness_last = 0x1fff;
 | 
				
			||||||
 | 
					  uint8_t direction_b = 1, direction_d = 1;
 | 
				
			||||||
 | 
					  uint8_t dir_count=0, dir_steps=0;
 | 
				
			||||||
 | 
					  uint8_t color_start = 0;
 | 
				
			||||||
 | 
					  uint8_t color;
 | 
				
			||||||
 | 
					  uint8_t delay = 200, delay_last = 200;
 | 
				
			||||||
 | 
					  led_turn_all_on();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  while (1) {
 | 
				
			||||||
 | 
					    color_start++;
 | 
				
			||||||
 | 
					    if (color_start > 2) { color_start = 0; }
 | 
				
			||||||
 | 
					    color = color_start;
 | 
				
			||||||
 | 
					    for (int led=0; led<12; led++) {
 | 
				
			||||||
 | 
					      color++;
 | 
				
			||||||
 | 
					      switch (color) {
 | 
				
			||||||
 | 
					      case 1:
 | 
				
			||||||
 | 
							led_set(led, 0x00, brightness, 0x00);      
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					      case 2:
 | 
				
			||||||
 | 
							led_set(led, 0x00, 0x00, brightness);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					      default:
 | 
				
			||||||
 | 
							color = 0;
 | 
				
			||||||
 | 
							led_set(led, brightness, 0x00, 0x00);      
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
						led_flush();
 | 
				
			||||||
 | 
						timer_wait(delay);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						#if 0
 | 
				
			||||||
 | 
						if (direction_b) {
 | 
				
			||||||
 | 
							brightness = brightness + brightness/16;
 | 
				
			||||||
 | 
							if (brightness_last > brightness) {
 | 
				
			||||||
 | 
							  brightness = 0xffff;
 | 
				
			||||||
 | 
							  direction_b = 0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							brightness_last = brightness;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else {
 | 
				
			||||||
 | 
							brightness = brightness - brightness/8;
 | 
				
			||||||
 | 
							if (brightness < 0x00ff) {
 | 
				
			||||||
 | 
							  brightness = 0x00ff;
 | 
				
			||||||
 | 
							  direction_b = 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							brightness_last = brightness;	
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (dir_count++ > dir_steps) {
 | 
				
			||||||
 | 
							if (direction_d) {
 | 
				
			||||||
 | 
								delay *= 0.90;
 | 
				
			||||||
 | 
								if (delay == delay_last) { delay--; }
 | 
				
			||||||
 | 
								if (delay < 5) {
 | 
				
			||||||
 | 
									direction_d = 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else {
 | 
				
			||||||
 | 
								delay *= 1.10;
 | 
				
			||||||
 | 
								if (delay == delay_last) { delay++; }
 | 
				
			||||||
 | 
								if (delay >= 200) {
 | 
				
			||||||
 | 
									direction_d = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							delay_last = delay;
 | 
				
			||||||
 | 
							dir_count = 0;
 | 
				
			||||||
 | 
							dir_steps = (200/delay)+1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void rgbyteclock_rounds_colored(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  uint16_t brightness = 0x00ff;
 | 
				
			||||||
 | 
					  uint8_t color_start = 0;
 | 
				
			||||||
 | 
					  uint8_t color;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  led_turn_all_on();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  while (1) {
 | 
				
			||||||
 | 
					    color_start++;
 | 
				
			||||||
 | 
					    if (color_start > 2) { color_start = 0; }
 | 
				
			||||||
 | 
					    color = color_start;
 | 
				
			||||||
 | 
					    for (int led=0; led<12; led++) {
 | 
				
			||||||
 | 
					      color++;
 | 
				
			||||||
 | 
					      switch (color) {
 | 
				
			||||||
 | 
					      case 1:
 | 
				
			||||||
 | 
						led_set(led, 0x00, brightness, 0x00);      
 | 
				
			||||||
 | 
						break;
 | 
				
			||||||
 | 
					      case 2:
 | 
				
			||||||
 | 
						led_set(led, 0x00, 0x00, brightness);
 | 
				
			||||||
 | 
						break;
 | 
				
			||||||
 | 
					      default:
 | 
				
			||||||
 | 
						color = 0;
 | 
				
			||||||
 | 
						led_set(led, brightness, 0x00, 0x00);      
 | 
				
			||||||
 | 
						break;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      led_flush();
 | 
				
			||||||
 | 
					      timer_wait(5);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    brightness = brightness + brightness/20;
 | 
				
			||||||
 | 
					    if (brightness > 0x4fff) {
 | 
				
			||||||
 | 
					      brightness = 0xff;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void rgbyteclock_hsv_fading(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  led_turn_all_on();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  while (1) {
 | 
				
			||||||
 | 
						  for ( uint16_t color = 0; color < 360; color+= 1 ) {
 | 
				
			||||||
 | 
							  for ( uint8_t lednum = 0; lednum < 12; lednum++ ) {
 | 
				
			||||||
 | 
								  led_set_hsv( lednum, (color + lednum * 20) % 360, 100, 100);
 | 
				
			||||||
 | 
							  }
 | 
				
			||||||
 | 
							  led_flush();
 | 
				
			||||||
 | 
							  timer_wait(5);
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void rgbyteclock_secwatch(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  uint8_t hours, mins;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  uint32_t t, t_last=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  led_turn_all_on();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  while (1) {
 | 
				
			||||||
 | 
					    t = timer_get()/1000;
 | 
				
			||||||
 | 
					    if (t != t_last) {
 | 
				
			||||||
 | 
					      t_last = t;
 | 
				
			||||||
 | 
					      mins = t%60;
 | 
				
			||||||
 | 
					      hours = t/60;
 | 
				
			||||||
 | 
					      uint8_t l_mins = mins/5;
 | 
				
			||||||
 | 
					      uint8_t l_hours = hours/5;
 | 
				
			||||||
 | 
					      led_clear();
 | 
				
			||||||
 | 
					      if (l_mins != l_hours) {
 | 
				
			||||||
 | 
						led_set(l_mins, 0, 0x7ff, 0);
 | 
				
			||||||
 | 
						led_set(l_hours, 0, 0, 0x7ff);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      else {
 | 
				
			||||||
 | 
						led_set(l_mins, 0, 0x7ff, 0x7ff);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      led_flush();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void rgbyteclock_secwatch_glide(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  uint8_t hours, mins;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  uint32_t t, t_last=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  led_turn_all_on();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  while (1) {
 | 
				
			||||||
 | 
					    t = rtc_get();
 | 
				
			||||||
 | 
					    if (t != t_last) {
 | 
				
			||||||
 | 
					      t_last = t;
 | 
				
			||||||
 | 
					      mins = t%60;
 | 
				
			||||||
 | 
					      hours = t/60;
 | 
				
			||||||
 | 
					      uint8_t l_mins = mins/5;
 | 
				
			||||||
 | 
					      uint8_t l_hours = hours/5;
 | 
				
			||||||
 | 
					      uint8_t l_mins_next = l_mins+1;
 | 
				
			||||||
 | 
					      uint8_t l_hours_next = l_hours+1;
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      if (l_mins_next > 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)*d_bright)/4;
 | 
				
			||||||
 | 
					      d_h2 = ((hours%5)*d_bright)/4;
 | 
				
			||||||
 | 
					      d_m1 = ((4-(mins%5))*d_bright)/4;
 | 
				
			||||||
 | 
					      d_h1 = ((4-(hours%5))*d_bright)/4;
 | 
				
			||||||
 | 
					      */
 | 
				
			||||||
 | 
					      d_m2 = led_values[(mins%5)+2];
 | 
				
			||||||
 | 
					      d_h2 = led_values[(hours%5)+2];
 | 
				
			||||||
 | 
					      d_m1 = led_values[4-(mins%5)+2];
 | 
				
			||||||
 | 
					      d_h1 = led_values[4-(hours%5)+2];
 | 
				
			||||||
 | 
					      uint16_t d_dark = led_values[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      led_clear();
 | 
				
			||||||
 | 
					      for (int led=0;led<12;led++) {
 | 
				
			||||||
 | 
						led_set(led, d_dark, 0, 0);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      if (l_mins != l_hours) {
 | 
				
			||||||
 | 
						led_set(l_mins, d_dark, d_m1, 0);
 | 
				
			||||||
 | 
						led_set(l_hours, d_dark, 0, d_h1);
 | 
				
			||||||
 | 
						led_set(l_mins_next, d_dark, d_m2, 0);
 | 
				
			||||||
 | 
						led_set(l_hours_next, d_dark, 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();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										29
									
								
								rgbyteclock_patterns.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								rgbyteclock_patterns.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 * "THE BEER-WARE LICENSE" (Revision 42):
 | 
				
			||||||
 | 
					 * <struppi@struppi.name> wrote this file. As long as you retain this notice you
 | 
				
			||||||
 | 
					 * can do whatever you want with this stuff. If we meet some day, and you think
 | 
				
			||||||
 | 
					 * this stuff is worth it, you can buy me a beer in return.
 | 
				
			||||||
 | 
					 * (c) 2014 Stefan Rupp
 | 
				
			||||||
 | 
					 * ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef RGBYTECLOCK_PATTERNS_H_
 | 
				
			||||||
 | 
					#define RGBYTECLOCK_PATTERNS_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "rgbyteclock.h"
 | 
				
			||||||
 | 
					#include "timer.h"
 | 
				
			||||||
 | 
					#include "rtc.h"
 | 
				
			||||||
 | 
					#include "lcd.h"
 | 
				
			||||||
 | 
					#include "ledcontroller.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void rgbyteclock_rounds(void);
 | 
				
			||||||
 | 
					void rgbyteclock_rounds_colored(void);
 | 
				
			||||||
 | 
					void rgbyteclock_rounds_white(void);
 | 
				
			||||||
 | 
					void rgbyteclock_hsv_fading(void);
 | 
				
			||||||
 | 
					void rgbyteclock_secwatch(void);
 | 
				
			||||||
 | 
					void rgbyteclock_secwatch_glide(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										3
									
								
								timer.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								timer.c
									
									
									
									
									
								
							@@ -19,6 +19,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static volatile uint32_t _timer_time;
 | 
					static volatile uint32_t _timer_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ISR(TIMER0_COMPA_vect) {
 | 
					ISR(TIMER0_COMPA_vect) {
 | 
				
			||||||
  ++_timer_time;
 | 
					  ++_timer_time;
 | 
				
			||||||
  return;
 | 
					  return;
 | 
				
			||||||
@@ -46,7 +47,7 @@ void timer_init(void)
 | 
				
			|||||||
  // ==> let timer count to 77 to get (almost) 1kHz frequency
 | 
					  // ==> let timer count to 77 to get (almost) 1kHz frequency
 | 
				
			||||||
  // therefore:
 | 
					  // therefore:
 | 
				
			||||||
  // - Set Timer/Counter0 prescaler to 256 ==> (1<<CS02)
 | 
					  // - Set Timer/Counter0 prescaler to 256 ==> (1<<CS02)
 | 
				
			||||||
  // - Set OCR2 to 77
 | 
					  // - Set OCR0 to 77
 | 
				
			||||||
  // - CTC ( i.e. clear counter, when COUNTER == OCR0A) ==> (1<<WGM01)
 | 
					  // - CTC ( i.e. clear counter, when COUNTER == OCR0A) ==> (1<<WGM01)
 | 
				
			||||||
  // unfortunately, due to the 20MHz and the coarse prescaler dividers
 | 
					  // unfortunately, due to the 20MHz and the coarse prescaler dividers
 | 
				
			||||||
  // provided, we can't get any closer to the desired frequency of
 | 
					  // provided, we can't get any closer to the desired frequency of
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user