ledcontroller: rename ledcontroller_ prefix in functions to led_

This commit is contained in:
Stefan Rupp 2014-03-15 00:18:40 +01:00
parent c39347c317
commit aa2622d8c8
4 changed files with 23 additions and 25 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));
} }

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_off(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);

11
main.c
View File

@ -25,7 +25,7 @@ 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();
@ -39,13 +39,8 @@ int main(void)
lcd_locate(1,0); lcd_locate(1,0);
lcd_puts("www.bytewerk.org"); lcd_puts("www.bytewerk.org");
/* led_turn_all_on(); // turn all LED channels on.
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

@ -20,13 +20,13 @@
enum { LED_OFF, LED_GLOW, LED_S0, LED_S1, LED_S2, LED_S3, LED_S4, LED_S5}; enum { LED_OFF, LED_GLOW, LED_S0, LED_S1, LED_S2, LED_S3, LED_S4, LED_S5};
uint16_t led_values[] = {0x00, 0x00cf, 0x02ff, 0x04ff, 0x08ff, 0x10ff, 0x20ff}; uint16_t led_values[] = {0x00, 0x00cf, 0x00, 0x04ff, 0x08ff, 0x10ff, 0x20ff};
void rgbyteclock_rounds(void) void rgbyteclock_rounds(void)
{ {
ledcontroller_turn_all_on(); led_turn_all_on();
while (1) { while (1) {
//PORTC ^= (1<<PC5); //PORTC ^= (1<<PC5);
@ -60,6 +60,9 @@ void rgbyteclock_rounds_colored(void)
uint16_t brightness = 0x00ff; uint16_t brightness = 0x00ff;
uint8_t color_start = 0; uint8_t color_start = 0;
uint8_t color; uint8_t color;
led_turn_all_on();
while (1) { while (1) {
color_start++; color_start++;
if (color_start > 2) { color_start = 0; } if (color_start > 2) { color_start = 0; }
@ -95,7 +98,7 @@ void rgbyteclock_secwatch(void)
uint32_t t, t_last=0; uint32_t t, t_last=0;
ledcontroller_turn_all_on(); led_turn_all_on();
while (1) { while (1) {
t = timer_get()/1000; t = timer_get()/1000;
@ -105,7 +108,7 @@ void rgbyteclock_secwatch(void)
hours = t/60; hours = t/60;
uint8_t l_mins = mins/5; uint8_t l_mins = mins/5;
uint8_t l_hours = hours/5; uint8_t l_hours = hours/5;
ledcontroller_clear(); led_clear();
if (l_mins != l_hours) { if (l_mins != l_hours) {
led_set(l_mins, 0, 0x7ff, 0); led_set(l_mins, 0, 0x7ff, 0);
led_set(l_hours, 0, 0, 0x7ff); led_set(l_hours, 0, 0, 0x7ff);
@ -124,7 +127,7 @@ void rgbyteclock_secwatch_glide(void)
uint32_t t, t_last=0; uint32_t t, t_last=0;
ledcontroller_turn_all_on(); led_turn_all_on();
while (1) { while (1) {
t = rtc_get(); t = rtc_get();
@ -155,7 +158,7 @@ void rgbyteclock_secwatch_glide(void)
d_h1 = led_values[4-(hours%5)+2]; d_h1 = led_values[4-(hours%5)+2];
uint16_t d_dark = led_values[1]; uint16_t d_dark = led_values[1];
ledcontroller_clear(); led_clear();
for (int led=0;led<12;led++) { for (int led=0;led<12;led++) {
led_set(led, d_dark, 0, 0); led_set(led, d_dark, 0, 0);
} }