dm643_led.c
来自「基于ccs2(6000)开发环境,通过这个程序可以修改板上EEPROM 的MAC」· C语言 代码 · 共 72 行
C
72 行
/*
* Copyright 2003 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/
/*
* ======== dm643_led.c ========
* LED module for the DM643
*/
#include <csl.h>
//#include <csl_mcasp.h>
//#include <csl_gpio.h>
#include "dm643.h"
#include "dm643_led.h"
void DM643_LED_init()
{
*(Uint32 *)MAPEN |= 0x4a000080;
*(Uint32 *)MAPDIR |= 0x4a000080;
/* Turn all LEDs off */
*(Uint32 *)MAPDOUT |= 0x4a000000;
}
void DM643_LED_off(Uint32 ledNum)
{
switch(ledNum)
{
case 0: *(Uint32 *)MAPDOUT |= 0x4a000000; break;
case 1: *(Uint32 *)MAPDOUT |= 0x40000000; break;
case 2: *(Uint32 *)MAPDOUT |= 0x2000000; break;
case 3: *(Uint32 *)MAPDOUT |= 0x8000000; break;
default: return;
}
}
void DM643_LED_on(Uint32 ledNum)
{
switch(ledNum)
{
case 0: *(Uint32 *)MAPDOUT &= 0xb5ffffff; break;
case 1: *(Uint32 *)MAPDOUT &= 0xbfffffff; break;
case 2: *(Uint32 *)MAPDOUT &= 0xfdffffff; break;
case 3: *(Uint32 *)MAPDOUT &= 0xf7ffffff; break;
default: return;
}
}
void DM643_LED_toggle(Uint32 ledNum)
{
Int32 ledstate;
switch(ledNum)
{
case 0: ledstate=*(Uint32 *)MAPDIN & 0x4a000000; break;
case 1: ledstate=*(Uint32 *)MAPDIN & 0x40000000; break;
case 2: ledstate=*(Uint32 *)MAPDIN & 0x2000000; break;
case 3: ledstate=*(Uint32 *)MAPDIN & 0x8000000; break;
default: return;
}
if (ledstate > 0)
DM643_LED_on(ledNum);
else
DM643_LED_off(ledNum);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?