📄 led.c
字号:
/**************************************************************************
* *
* PROJECT : TMON (Transparent monitor) *
* *
* MODULE : LED.c *
* *
* AUTHOR : Michael Anburaj *
* URL : http://geocities.com/michaelanburaj/ *
* EMAIL: michaelanburaj@hotmail.com *
* *
* PROCESSOR : MIPS 4Kc (32 bit RISC) - ATLAS board *
* *
* Tool-chain : SDE & Cygnus *
* *
* DESCRIPTION : *
* This is the LED module. Contains the following routines to: *
* 1. Display strings on 8xASCII LED display. *
* 2. Display bar graph on the BAR LED display. *
* 3. Turn On & OFF the GREEN LED. *
* *
**************************************************************************/
#include "atlas.h"
/* ********************************************************************* */
/* Global definitions */
/* ********************************************************************* */
/* File local definitions */
/* ********************************************************************* */
/* Local functions */
/* ********************************************************************* */
/* Global functions */
/*
*********************************************************************************************
* LED_vPutsNoClr
*
* Description: This routine displays the string on the 8*ASCII LED display without clearing
* it.
*
* Arguments : pbStr - String to be displayed.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void LED_vPutsNoClr(U8 *pbStr)
{
if(*pbStr == 0)return;
rASCIIPOS0 = *pbStr++;
if(*pbStr == 0)return;
rASCIIPOS1 = *pbStr++;
if(*pbStr == 0)return;
rASCIIPOS2 = *pbStr++;
if(*pbStr == 0)return;
rASCIIPOS3 = *pbStr++;
if(*pbStr == 0)return;
rASCIIPOS4 = *pbStr++;
if(*pbStr == 0)return;
rASCIIPOS5 = *pbStr++;
if(*pbStr == 0)return;
rASCIIPOS6 = *pbStr++;
if(*pbStr == 0)return;
rASCIIPOS7 = *pbStr;
}
/*
*********************************************************************************************
* LED_vPuts
*
* Description: This routine displays the string on the 8*ASCII LED display after clearing it.
*
* Arguments : pbStr - String to be displayed.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void LED_vPuts(U8 *pbStr)
{
LED_vPutsNoClr(" ");
LED_vPutsNoClr(pbStr);
}
/*
*********************************************************************************************
* LED_vPuti
*
* Description: This routine displays the Hex value on the 8*ASCII LED display.
*
* Arguments : wInt - U32 to be displayed.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void LED_vPuti(U32 wInt)
{
rASCIIWORD = wInt;
}
/*
*********************************************************************************************
* LED_vPutBar
*
* Description: This routine displays the 8 bit bar graph on the BAR LED display.
*
* Arguments : bBar - 8 bit bar graph value to be displayed.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void LED_vPutBar(U8 bBar)
{
rLEDBAR = bBar;
}
/*
*********************************************************************************************
* LED_bGetBar
*
* Description: This routine gets the 8 bit bar graph value last displayed on the BAR LED
* display.
*
* Arguments : none.
*
* Return : 8 bit bar graph value last displayed.
*
* Note(s) :
*********************************************************************************************
*/
U8 LED_bGetBar(void)
{
return (U8)rLEDBAR;
}
/*
*********************************************************************************************
* LED_vGreen
*
* Description: This routine turns ON or OFF the GREEN LED.
*
* Arguments : bCmnd - Command.
* Flase - Turn OFF.
* True - Turn ON.
*.
*
* Return : 8 bit bar graph value last displayed.
*
* Note(s) :
*********************************************************************************************
*/
U8 LED_vGreen(U8 bCmnd)
{
rLEDGREEN = bCmnd? 0x01: 0x00;
}
/* ********************************************************************* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -