/****************************************************************************
|
* Copyright: (C)2018 Î人ÁèÔÆÎïÍøÖÇ¿ÆÊµÑéÊÒ www.iot-yun.com
|
* Author: GuoWenxue<guowenxue@gmail.com> QQ: 281143292
|
* Description: STM32L151C8T6 CubeMX ¿ª·¢°å LED¡¢´®¿Ú¡¢Systick µÈ²âÊÔ³ÌÐò
|
¿ª·¢°åÌÔ±¦¹ºÂòµØÖ·£º https://item.taobao.com/item.htm?spm=a1z09.2.0.0.6ff42e8dPmfuKR&id=551780894246&_u=41ifnbo379e
|
*
|
* ChangeLog:
|
* °æ±¾ºÅ ÈÕÆÚ ×÷Õß ËµÃ÷
|
* V1.0.0 2018.11.04 GuoWenxue ·¢²¼¸Ã°æ±¾
|
****************************************************************************/
|
|
#include <stdio.h>
|
#include "stm32_led.h"
|
#include "stm32_key.h"
|
#include "stm32_usart.h"
|
#include "stm32_systick.h"
|
|
|
void blink_led(uint8_t which, uint32_t ms)
|
{
|
uint32_t start_time;
|
|
start_time = jiffies;
|
while( time_before(jiffies, start_time+ms) )
|
{
|
turn_led(which, ON);
|
msleep(100);
|
|
turn_led(which, OFF);
|
msleep(100);
|
}
|
}
|
|
int main(void)
|
{
|
init_led_gpio();
|
init_systick();
|
init_keys_interrupt();
|
|
stm32_init_printf(USART_PORT1, 115200);
|
|
printf("STM32L151C8T6A CubeMX Board Setup USART1 As Standard Output OK.\n");
|
|
printf("Blink test LED in 3000ms\n");
|
blink_led(LED1, 3000);
|
|
printf("Wakeup Key Interrupt Detected start...\n");
|
|
while(1)
|
{
|
msleep(3000);
|
|
turn_led(LED1, ON);
|
msleep(150);
|
turn_led(LED1, OFF);
|
}
|
}
|