|
|
@ -22,7 +22,8 @@ |
|
|
|
#include <libopenstm32/timer.h> |
|
|
|
|
|
|
|
//#define COMPARE
|
|
|
|
#define MOVING_FADE |
|
|
|
//#define MOVING_FADE
|
|
|
|
#define KITT |
|
|
|
|
|
|
|
#ifdef COMPARE |
|
|
|
#define GAMMA_LINEAR |
|
|
@ -32,8 +33,13 @@ |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef MOVING_FADE |
|
|
|
#define GAMMA_3_0 |
|
|
|
#define GAMMA_TABLE gamma_table_3_0 |
|
|
|
#define GAMMA_2_5 |
|
|
|
#define GAMMA_TABLE gamma_table_2_5 |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef KITT |
|
|
|
#define GAMMA_2_5 |
|
|
|
#define GAMMA_TABLE gamma_table_2_5 |
|
|
|
#endif |
|
|
|
|
|
|
|
/*
|
|
|
@ -307,7 +313,7 @@ void tim_setup(void) |
|
|
|
|
|
|
|
int main(void) |
|
|
|
{ |
|
|
|
int i, j0, j1, j2, j3, d0, d1, d2, d3; |
|
|
|
int i, j0, j1, j2, j3, d0, d1, d2, d3, j, k, kd; |
|
|
|
|
|
|
|
clock_setup(); |
|
|
|
gpio_setup(); |
|
|
@ -347,12 +353,12 @@ int main(void) |
|
|
|
#ifdef MOVING_FADE |
|
|
|
j0=0; |
|
|
|
d0=1; |
|
|
|
j1=64; |
|
|
|
j1=128; |
|
|
|
d1=1; |
|
|
|
j2=128; |
|
|
|
d2=1; |
|
|
|
j3=192; |
|
|
|
d3=1; |
|
|
|
j2=255; |
|
|
|
d2=-1; |
|
|
|
j3=128; |
|
|
|
d3=-1; |
|
|
|
while (1) |
|
|
|
{ |
|
|
|
TIM3_CCR1= GAMMA_TABLE[j0]; |
|
|
@ -371,7 +377,61 @@ int main(void) |
|
|
|
j3+=d3; |
|
|
|
if(j3==255) d3=-1; |
|
|
|
if(j3==0) d3=1; |
|
|
|
for(i=0; i< 50000; i++){} |
|
|
|
for(i=0; i< 10000; i++){} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef KITT |
|
|
|
j0=255; |
|
|
|
d0=-1; |
|
|
|
j1=20; |
|
|
|
d1=-1; |
|
|
|
j2=20; |
|
|
|
d2=-1; |
|
|
|
j3=20; |
|
|
|
d3=-1; |
|
|
|
j=0; |
|
|
|
k=0; |
|
|
|
kd=1; |
|
|
|
while (1) |
|
|
|
{ |
|
|
|
TIM3_CCR1= GAMMA_TABLE[j0]; |
|
|
|
j0+=d0; |
|
|
|
if(j0==255) d0=-1; |
|
|
|
if(j0==19) j0=20; |
|
|
|
TIM3_CCR2= GAMMA_TABLE[j1]; |
|
|
|
j1+=d1; |
|
|
|
if(j1==255) d1=-1; |
|
|
|
if(j1==19) j1=20; |
|
|
|
TIM3_CCR3= GAMMA_TABLE[j2]; |
|
|
|
j2+=d2; |
|
|
|
if(j2==255) d2=-1; |
|
|
|
if(j2==19) j2=20; |
|
|
|
TIM3_CCR4= GAMMA_TABLE[j3]; |
|
|
|
j3+=d3; |
|
|
|
if(j3==255) d3=-1; |
|
|
|
if(j3==19) j3=20; |
|
|
|
for(i=0; i< 5000; i++){} |
|
|
|
j++; |
|
|
|
if(j==100){ |
|
|
|
j=0; |
|
|
|
switch(k+=kd){ |
|
|
|
case 0: |
|
|
|
j0 = 255; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
j1 = 255; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
j2 = 255; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
j3 = 255; |
|
|
|
break; |
|
|
|
} |
|
|
|
if(k==3) kd=-1; |
|
|
|
if(k==0) kd=1; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|