Add TestLed_Blink

This commit is contained in:
Eric Tang
2018-06-24 21:05:00 -07:00
parent c6b180b8f5
commit 64592d7032
2 changed files with 22 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -38,5 +38,6 @@
// Functions:
void TestLed_Init(void);
void TestLed_Blink(uint8_t times);
#endif