merge from master: rename "ledcontroller" to "led"

This commit is contained in:
daniel steuer 2014-03-17 01:15:28 +01:00
parent 1083def408
commit c58e2118b5
4 changed files with 23 additions and 37 deletions

View File

@ -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); 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); 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 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) { if (channel < NUM_LED_CHANNELS) {
ledbuffer[channel] = value; 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)); memset(ledbuffer, 0x00, sizeof(ledbuffer));
led_flush(); led_flush();

View File

@ -18,13 +18,13 @@
#include "timer.h" #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_set(uint8_t lednum, uint16_t red, uint16_t green, uint16_t blue);
void led_flush(void); void led_flush(void);
void ledcontroller_turn_all_on(void); void led_turn_all_on(void);
void ledcontroller_turn_all(void); void led_turn_all(void);
void ledcontroller_set_channel(uint8_t channel, uint16_t value); void led_set_channel(uint8_t channel, uint16_t value);
void ledcontroller_clear(void); void led_clear(void);

16
main.c
View File

@ -19,27 +19,17 @@
#include "rtc.h" #include "rtc.h"
#include <util/delay.h> #include <util/delay.h>
int main(void) int main(void) {
{
timer_init(); timer_init();
//rtc_init(0); //rtc_init(0);
//spi_slave_init(); //spi_slave_init();
ledcontroller_init(); led_init();
sei(); sei();
//lcd_init(); //lcd_init();
DDRC |= (1<<PC5); DDRC |= (1<<PC5);
/*
while (1) {
PORTC ^= (1<<PC5);
timer_wait(5000);
//_delay_ms(100);
}
*/
rgbyteclock(); rgbyteclock();
// rgbyteclock() should never end, but who knows... // rgbyteclock() should never end, but who knows...
while (1) { ; } while(1);
} }

View File

@ -48,10 +48,9 @@ void rgbyteclock(void) {
uint8_t gameState = SEED_RNG; uint8_t gameState = SEED_RNG;
ledcontroller_turn_all_on(); led_turn_all_on();
DDRC &= ~(1<<PC5); // use pullup
t1 = 0;
while ( 1 ) { while ( 1 ) {
now = timer_get( ); now = timer_get( );
@ -70,8 +69,6 @@ void rgbyteclock(void) {
break; break;
case INIT: case INIT:
PORTC &= ~(1<<PC5);
sequence_index = 0; sequence_index = 0;
input_sequence_index = 0; input_sequence_index = 0;
gameState = INTRO; gameState = INTRO;
@ -345,7 +342,6 @@ int8_t show_intro( uint32_t now, uint32_t animation_start ) {
// print a chain of random colors // print a chain of random colors
if( !(t_diff % 100) && (step == 1) ) { if( !(t_diff % 100) && (step == 1) ) {
PORTC ^=(1<<PC5);
// every 100ms // every 100ms
get_color( &r, &g, &b, tmp_sequence[index] ); get_color( &r, &g, &b, tmp_sequence[index] );
led_set( index, r, g, b ); led_set( index, r, g, b );