115 lines
4.1 KiB
C
Raw Normal View History

/*
*********************************************************************************************************
*
* : BSP模块(For STM32F4XX)
* : bsp.c
* : V1.1
* : c文件可以 #include "bsp.h"
* bsp = Borad surport packet
* :
*
* V1.0 2013-03-01 armfly
* V1.1 2013-06-20 armfly
*
* Copyright (C), 2013-2014, www.armfly.com
*
*********************************************************************************************************
*/
#include "bsp.h"
__IO uint8_t ubCounter = 0x00;
// extern __IO uint32_t TimeOut;
/*
*********************************************************************************************************
* : bsp_Init
* : CPU寄存器和外设的寄存器并初始化一些全局变量
*
* :
*********************************************************************************************************
*/
void bsp_Init(void)
{
/*
ST固件库的启动文件已经执行了CPU系统时钟的初始化
CPU主时钟频率Flash访问速度和可选的外部SRAM FSMC初始化
168MHz system_stm32f4xx.c
*/
/* NVIC配置 分组2 */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
bsp_InitLed(); /* 初始LED指示灯端口 */
// bsp_InitUart(); /* 初始化串口 */
// bsp_InitKey(); /* 初始化按键 */
// bsp_InitTimer(); /* 初始化系统滴答定时器 */
/* 这里将SysTick的优先级设置为最高优先级 */
NVIC_SetPriority(SysTick_IRQn, 0x0);
}
/*
*********************************************************************************************************
* : bsp_RunPer10ms
* : 10ms被Systick中断调用1次 bsp_timer.c的定时中断服务程序
*
*
* :
*********************************************************************************************************
*/
void bsp_RunPer10ms(void)
{
// bsp_KeyScan();
}
/*
*********************************************************************************************************
* : bsp_RunPer1ms
* : 1ms被Systick中断调用1次 bsp_timer.c的定时中断服务程序
*
*
* :
*********************************************************************************************************
*/
void bsp_RunPer1ms(void)
{
/* 这个变量好像没有用担这个例子是来自官方 */
// if (TimeOut != 0x0)
// {
// TimeOut--;
// }
if (ubCounter < 250)
{
ubCounter++;
}
else
{
ubCounter = 0x00;
// bsp_LedToggle(LED1);
}
}
/*
*********************************************************************************************************
* : bsp_Idle
* : for和while循环程序体中需要插入 CPU_IDLE()
* CPU进入休眠模式的功能
*
* :
*********************************************************************************************************
*/
void bsp_Idle(void)
{
/* --- 喂狗 */
/* --- 让CPU进入休眠由Systick定时中断唤醒或者其他中断唤醒 */
/* 对于 emWin 图形库,可以插入图形库需要的轮询函数 */
//GUI_Exec();
/* 对于 uIP 协议实现可以插入uip轮询函数 */
}
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/