diff --git a/right/src/peripherals/test_led.c b/right/src/peripherals/test_led.c index 03807e9..1d46a3e 100644 --- a/right/src/peripherals/test_led.c +++ b/right/src/peripherals/test_led.c @@ -1,5 +1,6 @@ #include "test_led.h" #include "fsl_port.h" +#include "timer.h" void TestLed_Init(void) { @@ -8,3 +9,23 @@ void TestLed_Init(void) GPIO_PinInit(TEST_LED_GPIO, TEST_LED_GPIO_PIN, &(gpio_pin_config_t){kGPIO_DigitalOutput, 1}); TestLed_On(); } + +void TestLed_Blink(uint8_t times) +{ + TestLed_Off(); + Timer_Delay(500); + if (!times) { + TestLed_On(); + Timer_Delay(500); + TestLed_Off(); + Timer_Delay(500); + return; + } + while (times--) { + TestLed_On(); + Timer_Delay(100); + TestLed_Off(); + Timer_Delay(100); + } + Timer_Delay(400); +} diff --git a/right/src/peripherals/test_led.h b/right/src/peripherals/test_led.h index a54e7a0..6e4efc1 100644 --- a/right/src/peripherals/test_led.h +++ b/right/src/peripherals/test_led.h @@ -38,5 +38,6 @@ // Functions: void TestLed_Init(void); + void TestLed_Blink(uint8_t times); #endif