STM8L_3_KEY:
1.USER: engineering and main file
2.Hardware: KEY, CLK, LED, Delay
3.STM8L15x_StdPeriph_Driver: the STM8 own library
4.Debug: hex EXE files stored in a folder
5.Function: Press KEY, LED Light
/**
******************************************************************************
* @file main.c
* @author Alex——小白
* @version V1.0
* @date 2019.5.1
* @brief KEY is used for lighting LED
* @store 有家Proteus仿真店子
* @Link https://shop484534014.taobao.com/
* @Email [email protected]
******************************************************************************
* @attention All Rights Reserved
**/
#include <stdint.h>
#include <string.h>
#include "stm8l15x.h"
#include "LED.h"
#include "Delay.h"
#include "CLK.h"
#include "KEY.h"
void main(void)
{
CLK_HSI_Config(CLK_SYSCLKDiv_8); //HSI 8分频 2MHz
LED_Init();
KEY_Init();
while(1)
{
if(KEY_Read() == FALSE)
{
Delay(0x7FFF);
if(KEY_Read() == FALSE)
{
LED0(0);
}
}
else LED0(1);
}
}