merge from master: rename "ledcontroller" to "led"
This commit is contained in:
		@@ -159,7 +159,7 @@ static void write_no_command(uint16_t data)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ledcontroller_turn_all_on(void)
 | 
			
		||||
void led_turn_all_on(void)
 | 
			
		||||
{
 | 
			
		||||
  
 | 
			
		||||
  write_data(0xffff, 2);
 | 
			
		||||
@@ -171,7 +171,7 @@ void ledcontroller_turn_all_on(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ledcontroller_turn_all_off(void)
 | 
			
		||||
void led_turn_all_off(void)
 | 
			
		||||
{
 | 
			
		||||
  
 | 
			
		||||
  write_data(0x0000, 2);
 | 
			
		||||
@@ -183,7 +183,7 @@ void ledcontroller_turn_all_off(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ledcontroller_init(void)
 | 
			
		||||
void led_init(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  PORTC &= ~(1<<PC3); // SCK
 | 
			
		||||
@@ -224,7 +224,7 @@ void led_flush(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ledcontroller_set_channel(uint8_t channel, uint16_t value)
 | 
			
		||||
void led_set_channel(uint8_t channel, uint16_t value)
 | 
			
		||||
{
 | 
			
		||||
  if (channel < NUM_LED_CHANNELS) {
 | 
			
		||||
    ledbuffer[channel] = value;
 | 
			
		||||
@@ -233,7 +233,7 @@ void ledcontroller_set_channel(uint8_t channel, uint16_t value)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ledcontroller_clear(void)
 | 
			
		||||
void led_clear(void)
 | 
			
		||||
{
 | 
			
		||||
  memset(ledbuffer, 0x00, sizeof(ledbuffer));
 | 
			
		||||
  led_flush();
 | 
			
		||||
 
 | 
			
		||||
@@ -18,13 +18,13 @@
 | 
			
		||||
#include "timer.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ledcontroller_init(void);
 | 
			
		||||
void led_init(void);
 | 
			
		||||
void led_set(uint8_t lednum, uint16_t red, uint16_t green, uint16_t blue);
 | 
			
		||||
void led_flush(void);
 | 
			
		||||
void ledcontroller_turn_all_on(void);
 | 
			
		||||
void ledcontroller_turn_all(void);
 | 
			
		||||
void ledcontroller_set_channel(uint8_t channel, uint16_t value);
 | 
			
		||||
void ledcontroller_clear(void);
 | 
			
		||||
void led_turn_all_on(void);
 | 
			
		||||
void led_turn_all(void);
 | 
			
		||||
void led_set_channel(uint8_t channel, uint16_t value);
 | 
			
		||||
void led_clear(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								main.c
									
									
									
									
									
								
							@@ -19,27 +19,17 @@
 | 
			
		||||
#include "rtc.h"
 | 
			
		||||
#include <util/delay.h>
 | 
			
		||||
 | 
			
		||||
int main(void)
 | 
			
		||||
{
 | 
			
		||||
  
 | 
			
		||||
int main(void) {
 | 
			
		||||
	timer_init();
 | 
			
		||||
	//rtc_init(0);
 | 
			
		||||
	//spi_slave_init();
 | 
			
		||||
  ledcontroller_init();
 | 
			
		||||
	led_init();
 | 
			
		||||
	sei();
 | 
			
		||||
	//lcd_init();
 | 
			
		||||
 | 
			
		||||
	DDRC |= (1<<PC5);
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
  while (1) {
 | 
			
		||||
    PORTC ^= (1<<PC5);
 | 
			
		||||
    timer_wait(5000);
 | 
			
		||||
    //_delay_ms(100);
 | 
			
		||||
  }
 | 
			
		||||
  */
 | 
			
		||||
	rgbyteclock();
 | 
			
		||||
	// rgbyteclock() should never end, but who knows...
 | 
			
		||||
  while (1) { ; }
 | 
			
		||||
 | 
			
		||||
	while(1);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -48,10 +48,9 @@ void rgbyteclock(void) {
 | 
			
		||||
 | 
			
		||||
	uint8_t gameState = SEED_RNG;
 | 
			
		||||
 | 
			
		||||
	ledcontroller_turn_all_on();
 | 
			
		||||
 | 
			
		||||
	DDRC &= ~(1<<PC5); // use pullup
 | 
			
		||||
	led_turn_all_on();
 | 
			
		||||
 | 
			
		||||
	t1 = 0;
 | 
			
		||||
	while ( 1 ) {
 | 
			
		||||
		now = timer_get( );
 | 
			
		||||
 | 
			
		||||
@@ -70,8 +69,6 @@ void rgbyteclock(void) {
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
			case INIT:
 | 
			
		||||
				PORTC &= ~(1<<PC5);
 | 
			
		||||
 | 
			
		||||
				sequence_index = 0;
 | 
			
		||||
				input_sequence_index = 0;
 | 
			
		||||
				gameState = INTRO;
 | 
			
		||||
@@ -345,7 +342,6 @@ int8_t show_intro( uint32_t now, uint32_t animation_start ) {
 | 
			
		||||
 | 
			
		||||
	// print a chain of random colors
 | 
			
		||||
	if( !(t_diff % 100) && (step == 1) ) {
 | 
			
		||||
		PORTC ^=(1<<PC5);
 | 
			
		||||
		// every 100ms
 | 
			
		||||
		get_color( &r, &g, &b, tmp_sequence[index] );
 | 
			
		||||
		led_set( index, r, g, b );
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user