?? sysled.c
字號:
/* sysLed.c - Wind River SBC ARM7 User LED driver *//* Copyright 1984-2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01c,26apr01,m_h convert tabs to spaces for readability01b,19apr01,m_h add carriage routine at EOF to avoid compile warning01a,10apr01,g_h created*//* includes */#include "sysLed.h"LOCAL UINT8 sysLed;LOCAL char sysLedNumToMask(char led);/**************************************************************************** sysLedInit - Initialize LEDs.** This routine initializes the LED variable to zero and clears* all LEDs.** SEE ALSO: sysLedOn(), sysLedOff(), sysLedControl().** RETURNS: N/A.*/void sysLedInit(void) { sysLed = 0; /* * Write to LED. */ WRITE_LED(sysLed); }/**************************************************************************** sysLedOff - Turn selected LED off.** This routine set the selected LED to off.** SEE ALSO: sysLedInit(), sysLedOff(), sysLedControl().** RETURNS: N/A.*/void sysLedOff(UINT8 led) { sysLed &= ~sysLedNumToMask(led); /* * Write to LED. */ WRITE_LED(sysLed); }/**************************************************************************** sysLedOn - Turn selected LED on.** This routine set the selected LED to on.** SEE ALSO: sysLedInit(), sysLedOn(), sysLedControl().** RETURNS: N/A.*/void sysLedOn(UINT8 led) { sysLed |= sysLedNumToMask(led); /* * Write to LED. */ WRITE_LED(sysLed); }/**************************************************************************** sysLedControl - Turn selected LED(s) on or off.** This routine sets the selected LED on or off.** SEE ALSO: sysLedInit(), sysLedOff(), sysLedOn().** RETURNS: N/A.*/void sysLedControl(int led_on, UINT8 led) { /* * Check led state. */ if (led_on) sysLed |= sysLedNumToMask(led); /* Set LED on. */ else sysLed &= ~sysLedNumToMask(led); /* Set LED off. */ /* * Write to LED. */ WRITE_LED(sysLed); }/**************************************************************************** sysLedNumToMask - return the LED mask for given LED number** This routine is returning the LED mask for given LED number.** SEE ALSO: sysLedInit(), sysLedOff(), sysLedOn().** RETURNS: char ledMask*/LOCAL char sysLedNumToMask(char led){ char ledMask; if(led < MIN_LED_NUMBER || led > MAX_LED_NUMBER) return('\0'); switch(led) { case LED1: ledMask = 0x01; break; case LED2: ledMask = 0x02; break; case LED3: ledMask = 0x04; break; case LED4: ledMask = 0x08; break; case LED5: ledMask = 0x10; break; case LED6: ledMask = 0x20; break; case LED7: ledMask = 0x40; break; case LED8: ledMask = 0x80; break; default: ledMask = 0x0; break; } return(ledMask);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -