diff --git a/tests/atmega2560/ledControl/ledControl.c b/tests/atmega2560/ledControl/ledControl.c index a93b709..08a8ff9 100644 --- a/tests/atmega2560/ledControl/ledControl.c +++ b/tests/atmega2560/ledControl/ledControl.c @@ -2,8 +2,10 @@ #include #include +#include "tlc5947.h" + #define NB_DRIVERS 3 -#define MAX_VALUE 85 //TODO tbd ! +#define MAX_VALUE 80 //TODO tbd ! #define DELAY 100 int main(void){ @@ -16,15 +18,15 @@ int main(void){ while(1){ // Build animation for(int i=0; i= 10000) animTick = 0; - set_LED_Drivers(groupes, NB_DRIVERS); + set_LED_Drivers(ledValues, NB_DRIVERS); _delay_ms(100); } return 0; diff --git a/tests/atmega2560/ledControl/makefile b/tests/atmega2560/ledControl/makefile index 96923b6..2f813af 100644 --- a/tests/atmega2560/ledControl/makefile +++ b/tests/atmega2560/ledControl/makefile @@ -21,7 +21,7 @@ clean: rm -f *.o *.hex *.elf %.o:%.c - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ -lm $(TARGET).elf: $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) diff --git a/tests/atmega2560/ledControl/tlc5947.c b/tests/atmega2560/ledControl/tlc5947.c index 7f097a8..6017137 100644 --- a/tests/atmega2560/ledControl/tlc5947.c +++ b/tests/atmega2560/ledControl/tlc5947.c @@ -1,26 +1,33 @@ #include + #include "tlc5947.h" -#define DLED_CHANNELS 24 +#define DDR_DLED_CLOCK DDRE +#define PORT_DLED_CLOCK PORTE + +#define DDR_DLED_DATA DDRG +#define PORT_DLED_DATA PORTG -#define DDR_DLED DDRD -#define PORT_DLED PORTD +#define DDR_DLED_LATCH DDRB +#define PORT_DLED_LATCH PORTB -#define PIN_DLED_CLOCK 5 -#define PIN_DLED_DATA 4 -#define PIN_DLED_LATCH 6 +#define PIN_DLED_CLOCK 0x08 +#define PIN_DLED_DATA 0x20 +#define PIN_DLED_LATCH 0x10 void init_LED_Drivers(int nb){ // LED drivers I/O as outputs - DDR_DLED |= (1<=0; i--){ @@ -29,24 +36,24 @@ void set_LED_Drivers(unsigned int pwm[], int nb){ int j; for(j=0; j<12; j++){ // Set CLOCK output low - PORT_DLED &= ~(1<