📄 led.c
字号:
/**************************************************************************************************
EDL RTOS Kernel
(c) Copyright 2005, Wu Jun
All Rights Reserved
For further information, please visit http://www.enjoydigitallife.com
* Description: None
* History:
Date Remarks
2005-01-06 Created initial version
2005-12-12 Finished the version 2.01
**************************************************************************************************/
#include "datatype.h"
#include "LPC2294.h"
#include "led.h"
/**************************************************************************************************
* Description: Initialize
**************************************************************************************************/
void led_init(void)
{
PINSEL0 = 0x00000000; /* set pin connect to GPIO */
IO0DIR = SPI_IOCON | 0x05 ; /* set SPI with output */
}
/**************************************************************************************************
* Description: show the 8-bit data in LED indicator.
* Parametters: c the 8-bit data to be displayed in led indicator. e.g. if c = 0x01, then
the LED indicator will be lit as 00000001.
**************************************************************************************************/
void led_dispChar(U8 c)
{
U8 data = ~c;
U8 i;
IO0CLR = SPI_CS; /* SPI_CS = 0 */
for(i = 0; i < 8; i++)
{
IO0CLR = SPI_CLK; /* SPI_CLK = 0 */
if(( data & 0x01 ) != 0 )
{
IO0SET = SPI_DATA;
}
else
{
IO0CLR = SPI_DATA;
}
data >>= 1;
IO0SET = SPI_CLK; /* SPI_CLK = 1 */
}
IO0SET = SPI_CS; /* SPI_CS = 1, output the data to be displayed */
}
/**************************************************************************************************
* Description: delay
* Parametters: times specifies the cycle number
**************************************************************************************************/
void led_delay(U32 times)
{
U32 i;
for(i = 0; i < times; i++)
{
/* we do nothing here, just loop */
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -