找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1589|回复: 0
收起左侧

stm8分享源码

[复制链接]
ID:54014 发表于 2018-4-28 18:43 | 显示全部楼层 |阅读模式
/****************** (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****/


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表