/*
///////////////////////////////////////////////////////////////////////////////
ATMEGA 128, 2561 LED 8 Library V.1.0
1st v.1.0 : 2011년 9월 23일
제작자 : (주)이지플로우
///////////////////////////////////////////////////////////////////////////////
*/
#ifdef EF_LED8
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// 점멸용 LED 포트를 정의합니다.
// LED data Output:Bit 0,1,2,3,4,5,6,7
#define LED8_DATA (PORTD)
#define LED8_DATA_DIR (DDRD)
#define LED8_BIT_DATA ( (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7) )
#define LED8_ON0 SETBIT (LED8_DATA, 0)
#define LED8_ON1 SETBIT (LED8_DATA, 1)
#define LED8_ON2 SETBIT (LED8_DATA, 2)
#define LED8_ON3 SETBIT (LED8_DATA, 3)
#define LED8_ON4 SETBIT (LED8_DATA, 4)
#define LED8_ON5 SETBIT (LED8_DATA, 5)
#define LED8_ON6 SETBIT (LED8_DATA, 6)
#define LED8_ON7 SETBIT (LED8_DATA, 7)
#define LED8_OFF0 CLEARBIT (LED8_DATA, 0)
#define LED8_OFF1 CLEARBIT (LED8_DATA, 1)
#define LED8_OFF2 CLEARBIT (LED8_DATA, 2)
#define LED8_OFF3 CLEARBIT (LED8_DATA, 3)
#define LED8_OFF4 CLEARBIT (LED8_DATA, 4)
#define LED8_OFF5 CLEARBIT (LED8_DATA, 5)
#define LED8_OFF6 CLEARBIT (LED8_DATA, 6)
#define LED8_OFF7 CLEARBIT (LED8_DATA, 7)
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// clear LED Module
// LED Module 화면을 지웁니다.
void LED8_clear(void)
{
LED8_DATA = 0xFF - LED8_BIT_DATA;
}
// clear LED Module
// LED Module 을 모두 오프합니다.
void LED8_Init(void)
{
LED8_DATA = 0xFF - LED8_BIT_DATA;
LED8_DATA_DIR |= LED8_BIT_DATA;
}
// clear LED Module
// LED Module 을 모두 ON 합니다.
void LED8_OnBitOne(unsigned char i)
{
switch (i)
{
case 1: LED8_ON0; break;
case 2: LED8_ON1; break;
case 3: LED8_ON2; break;
case 4: LED8_ON3; break;
case 5: LED8_ON4; break;
case 6: LED8_ON5; break;
case 7: LED8_ON6; break;
case 8: LED8_ON7; break;
default: LED8_clear();
}
}
// clear LED Module
// LED Module 을 모두 OFF 합니다.
void LED8_OffBitOne(unsigned char i)
{
switch (i)
{
case 1: LED8_OFF0; break;
case 2: LED8_OFF1; break;
case 3: LED8_OFF2; break;
case 4: LED8_OFF3; break;
case 5: LED8_OFF4; break;
case 6: LED8_OFF5; break;
case 7: LED8_OFF6; break;
case 8: LED8_OFF7; break;
default: LED8_clear();
}
}
///////////////////////////////////////////////////////////////////////////////
#endif
|