Add candy eye.
authorasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 12 Dec 2008 16:38:28 +0000 (16:38 +0000)
committerasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 12 Dec 2008 16:38:28 +0000 (16:38 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2027 38d2e660-2303-0410-9eaa-f027e97ec537

examples/at91sam7s/at91sam7s.c

index 89aedcb52324f120a87c11e83b54d2acc33c1672..f0c14a29fdcf17ba23dbec2c5d59a9fb98481198 100644 (file)
 
 Timer leds_timer;
 Serial ser_fd;
+int roll = 0;
 
 static void leds_toggle(void)
 {
        uint8_t a = (~PIOA_ODSR & 0x0f);
 
-       if (a)
+       if (roll == 1)
        {
+               if(a == 4)
+                       roll = 2;
+
                PIOA_SODR = a;
                PIOA_CODR = a << 1;
+
+       }
+       else if (roll == 2)
+       {
+               if(a == 2)
+                       roll = 1;
+
+               PIOA_SODR = a;
+               PIOA_CODR = a >> 1;     
        }
        else
        {
                PIOA_SODR  =  0x0f;
                /* turn first led on */
                PIOA_CODR  = 0x00000001;
+               roll = 1;
        }
 
        /* Wait for interval time */