mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/leds: adapt test to use led.h provided macros and functions
This commit is contained in:
parent
b0b3b071d3
commit
751a430f89
@ -22,8 +22,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "clk.h"
|
#include "clk.h"
|
||||||
#include "board.h"
|
#include "led.h"
|
||||||
#include "periph_conf.h"
|
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
#define DELAY_SHORT (coreclk() / 50)
|
#define DELAY_SHORT (coreclk() / 50)
|
||||||
@ -38,41 +37,11 @@ void dumb_delay(uint32_t delay)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int numof = 0;
|
|
||||||
|
|
||||||
/* get the number of available LED's and turn them all off*/
|
/* get the number of available LED's and turn them all off*/
|
||||||
#ifdef LED0_ON
|
unsigned numof = LED_NUMOF;
|
||||||
++numof;
|
for (unsigned i = 0; i < numof; i++) {
|
||||||
LED0_OFF;
|
led_off(i);
|
||||||
#endif
|
}
|
||||||
#ifdef LED1_ON
|
|
||||||
++numof;
|
|
||||||
LED1_OFF;
|
|
||||||
#endif
|
|
||||||
#ifdef LED2_ON
|
|
||||||
++numof;
|
|
||||||
LED2_OFF;
|
|
||||||
#endif
|
|
||||||
#ifdef LED3_ON
|
|
||||||
++numof;
|
|
||||||
LED3_OFF;
|
|
||||||
#endif
|
|
||||||
#ifdef LED4_ON
|
|
||||||
++numof;
|
|
||||||
LED4_OFF;
|
|
||||||
#endif
|
|
||||||
#ifdef LED5_ON
|
|
||||||
++numof;
|
|
||||||
LED5_OFF;
|
|
||||||
#endif
|
|
||||||
#ifdef LED6_ON
|
|
||||||
++numof;
|
|
||||||
LED6_OFF;
|
|
||||||
#endif
|
|
||||||
#ifdef LED7_ON
|
|
||||||
++numof;
|
|
||||||
LED7_OFF;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
puts("On-board LED test\n");
|
puts("On-board LED test\n");
|
||||||
/* cppcheck-suppress knownConditionTrueFalse
|
/* cppcheck-suppress knownConditionTrueFalse
|
||||||
@ -86,7 +55,7 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < 4; ++i) {
|
for (unsigned i = 0; i < 4; ++i) {
|
||||||
#ifdef LED0_ON
|
#ifdef LED0_IS_PRESENT
|
||||||
LED0_ON;
|
LED0_ON;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
LED0_OFF;
|
LED0_OFF;
|
||||||
@ -100,7 +69,7 @@ int main(void)
|
|||||||
LED0_TOGGLE;
|
LED0_TOGGLE;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LED1_ON
|
#ifdef LED1_IS_PRESENT
|
||||||
LED1_ON;
|
LED1_ON;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
LED1_OFF;
|
LED1_OFF;
|
||||||
@ -114,7 +83,7 @@ int main(void)
|
|||||||
LED1_TOGGLE;
|
LED1_TOGGLE;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LED2_ON
|
#ifdef LED2_IS_PRESENT
|
||||||
LED2_ON;
|
LED2_ON;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
LED2_OFF;
|
LED2_OFF;
|
||||||
@ -128,7 +97,7 @@ int main(void)
|
|||||||
LED2_TOGGLE;
|
LED2_TOGGLE;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LED3_ON
|
#ifdef LED3_IS_PRESENT
|
||||||
LED3_ON;
|
LED3_ON;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
LED3_OFF;
|
LED3_OFF;
|
||||||
@ -142,7 +111,7 @@ int main(void)
|
|||||||
LED3_TOGGLE;
|
LED3_TOGGLE;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LED4_ON
|
#ifdef LED4_IS_PRESENT
|
||||||
LED4_ON;
|
LED4_ON;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
LED4_OFF;
|
LED4_OFF;
|
||||||
@ -156,7 +125,7 @@ int main(void)
|
|||||||
LED4_TOGGLE;
|
LED4_TOGGLE;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LED5_ON
|
#ifdef LED5_IS_PRESENT
|
||||||
LED5_ON;
|
LED5_ON;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
LED5_OFF;
|
LED5_OFF;
|
||||||
@ -170,7 +139,7 @@ int main(void)
|
|||||||
LED5_TOGGLE;
|
LED5_TOGGLE;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LED6_ON
|
#ifdef LED6_IS_PRESENT
|
||||||
LED6_ON;
|
LED6_ON;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
LED6_OFF;
|
LED6_OFF;
|
||||||
@ -184,7 +153,7 @@ int main(void)
|
|||||||
LED6_TOGGLE;
|
LED6_TOGGLE;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LED7_ON
|
#ifdef LED7_IS_PRESENT
|
||||||
LED7_ON;
|
LED7_ON;
|
||||||
dumb_delay(DELAY_LONG);
|
dumb_delay(DELAY_LONG);
|
||||||
LED7_OFF;
|
LED7_OFF;
|
||||||
|
Loading…
Reference in New Issue
Block a user