/****************** (C) COPYRIGHT 风驰iCreate嵌入式开发工作室 *****************
* 文件名 :main.c
* 描述 :按键扫描
* 实验平台:iCreate STM8开发板
* 库版本 :V2.1.0
* 作者 :风驰 QQ:779814207
* 博客 :
* 修改时间 :2011-12-20
*******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "stm8s.h"
#include "led.h"
#include "key_scan.h"
#include "sysclock.h"
/* Private defines -----------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
int main(void)
{
/* 设置外部24M晶振为系统主时钟 */
SystemClock_Init(HSE_Clock);
Key_Init();
LED_Init();
//LED_Operation(LED_1, ON);
while (1)
{
/* 添加你的代码 */
if (!Key_State_Check(KEY_1)) {
LED_Reverse(LED_2);
}
if (!Key_State_Check(KEY_2)) {
LED_Reverse(LED_3);
}
}
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval : None
*/
void assert_failed(u8* file, u32 line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
/******************* (C) COPYRIGHT 风驰iCreate嵌入式开发工作室 *****END OF FILE****/
|