From 95f2e86f7fc6a3f8845102baad12e7686f5204fd Mon Sep 17 00:00:00 2001 From: asterix Date: Fri, 12 Dec 2008 16:38:28 +0000 Subject: [PATCH] Add candy eye. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2027 38d2e660-2303-0410-9eaa-f027e97ec537 --- examples/at91sam7s/at91sam7s.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/at91sam7s/at91sam7s.c b/examples/at91sam7s/at91sam7s.c index 89aedcb5..f0c14a29 100644 --- a/examples/at91sam7s/at91sam7s.c +++ b/examples/at91sam7s/at91sam7s.c @@ -50,21 +50,35 @@ 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 */ -- 2.25.1