📄 leds_ctrl.c
字号:
/*************************************************************************
*
* Used with ICCARM and AARM.
*
* (c) Copyright IAR Systems 2007
*
* File name : leds_ctrl.c
* Description : LEDs control functions
*
* History :
* 1. Date : January 18, 2007
* Author : Stanimir Bonev
* Description : Create
*
*
* $Revision: 1.0 $
**************************************************************************/
#define __LEDS_CTRL_GLOBALS
#include "leds_ctrl.h"
static pLedsCtrl_t pLEDsCtrl = NULL;
/*************************************************************************
* Function Name: LEDsScan
* Parameters: none
* Return: none
*
* Description: Scan all on LEDs
*
*************************************************************************/
void LEDsScan (void)
{
static unsigned int Mask;
OS_RetriggerTimer(&ScanLEDsTimer);
if(pLEDsCtrl == NULL)
{
// turn all LEDs off
BSP_ClrLED(~(0));
return;
}
if(pLEDsCtrl->LedsOnMask)
{
// Find next ON LED
for(int i = 0; i < _LEDS_NUMB; ++i)
{
Mask <<= 1;
if(!Mask)
{
Mask = 1;
}
if(pLEDsCtrl->LedsOnMask & Mask)
{
BSP_ClrLED(~(pLEDsCtrl->LedsOnMask & Mask));
BSP_SetLED( pLEDsCtrl->LedsOnMask & Mask);
break;
}
}
}
else
{
// All LEDs are off
BSP_ClrLED(~pLEDsCtrl->LedsOnMask);
}
}
/*************************************************************************
* Function Name: LEDsUpdatePattern
* Parameters: none
* Return: none
*
* Description: Update LEDs pattern
*
*************************************************************************/
void LEDsUpdatePattern (void)
{
OS_RetriggerTimer(&UpdateLEDsPatternTimer);
if(pNewLEDsCtrl != NULL)
{
// Get new LEDS pattern massive
pLEDsCtrl = pNewLEDsCtrl;
pNewLEDsCtrl = NULL;
}
else if(pLEDsCtrl != NULL)
{
// Update LEDs patten
if(pLEDsCtrl->pNext != NULL)
{
pLEDsCtrl= pLEDsCtrl->pNext;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -