📄 sysled.c
字号:
/* sysLed.c - V100R001BMC board LED driver */
/* Copyright 2002-2004 Founder Communications, Inc. */
/*
modification history
--------------------
01a,17mar05,fhchen written
*/
/*
DESCRIPTION
This module contains the LED driver. LEDs in V100R001CPE are connected to
GPIO210 ~ GPIO215
NOTE
- For LED4, on is yellow color, and off is white color.
- sysLedColorSet is valid ONLY for LED4.
*/
/* includes */
#include "sysLed.h"
#include "sysGpio.h"
#ifdef INCLUDE_SYSLED
/***********************************************************************
*
* sysLedInit - Initialize LEDs.
*
* This routine initializes the GPIOs used by LEDs.
*
* RETURNS: N/A.
*
*/
void sysLedInit
(
void
)
{
/*
* do nothing right now, because GPIO will be initialized in sysHwInit
* later after sysLedInit.
*/
/* TODO: initialize GPIO210 ~ GPIO215 here */
}
/***********************************************************************
*
* sysLedOff - Turn selected LED off.
*
* This routine set the selected LED to off.
*
*/
void sysLedOff
(
int led
)
{
/* LED4 on CPE is strange, if HW led changes, change this too */
if(led & LED4)
{
sysLedColorSet(LED4, white);
led &= ~LED4;
}
/* Write to GPIO */
sysGpioWrite(LED_PORT, led, LED_OFF);
}
/***********************************************************************
*
* sysLedOn - Turn selected LED on.
*
* This routine set the selected LED to on.
*
*/
void sysLedOn
(
int led
)
{
/* LED4 on CPE is strange, if HW led changes, change this too */
if(led & LED4)
{
sysLedColorSet(LED4, yellow);
led &= ~LED4;
}
/* Write to GPIO */
sysGpioWrite(LED_PORT, led, LED_ON);
}
/***********************************************************************
*
* sysLedColorSet - Set color of the specified LED
*
* This routine set the color of the specified LED. Only LED4 support
* color setting.
*
*/
void sysLedColorSet
(
int led,
LED_COLOR color
)
{
/* check parameter */
if(led != LED4)
return;
switch(color)
{
case white: /* GPIO214 | GPIO215 */
sysGpioWrite(LED_PORT, LED4, LED_ON);
break;
case red: /* GPIO215, ~GPIO214. */
sysGpioWrite(LED_PORT, GPIO215, LED_ON);
sysGpioWrite(LED_PORT, GPIO214, LED_OFF);
break;
case green: /* GPIO214 , ~GPIO215. */
sysGpioWrite(LED_PORT, GPIO214, LED_ON);
sysGpioWrite(LED_PORT, GPIO215, LED_OFF);
break;
case yellow: /* ~GPIO215, ~GPIO214 */
default:
sysGpioWrite(LED_PORT, LED4, LED_OFF);
break;
}
}
#endif /* INCLUDE_SYSLED */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -