LM3S2965 CAN EVAL 테스트
주요 프리페럴 핀맵
기본 LED제어를 위해 config.h 파일 수정
//-----------------------------------------------------------------------------
//LED Driver
#define LED1_BIT BIT2
#define LED1_PORT GPIO_PORTG_DATA_R
#define Led1Init()
#define Led1Off() Sbi(LED1_PORT, LED1_BIT)
#define Led1On() Cbi(LED1_PORT, LED1_BIT)
#define Led1Toggle() Tbi(LED1_PORT, LED1_BIT)
//LED Driver
#define LED1_BIT BIT2
#define LED1_PORT GPIO_PORTG_DATA_R
#define Led1Init()
#define Led1Off() Sbi(LED1_PORT, LED1_BIT)
#define Led1On() Cbi(LED1_PORT, LED1_BIT)
#define Led1Toggle() Tbi(LED1_PORT, LED1_BIT)
#define LED2_BIT
#define LED2_PORT
#define Led2Init()
#define Led2Off()
#define Led2On()
#define Led2Toggle()
#define LED2_PORT
#define Led2Init()
#define Led2Off()
#define Led2On()
#define Led2Toggle()
#define Led1Init() (SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOG);\
Sbi(GPIO_PORTG_DIR_R, LED1_BIT);Sbi(GPIO_PORTG_DEN_R, LED1_BIT)
//-----------------------------------------------------------------------------
//Switch Driver
#define SW1_BIT BIT4
#define SW1_PORT GPIO_PORTG_DATA_R
#define Sw1Init() (SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOG);\
Cbi(GPIO_PORTG_DIR_R, SW1_BIT);Sbi(GPIO_PORTG_DEN_R, SW1_BIT)
Sbi(GPIO_PORTG_DIR_R, LED1_BIT);Sbi(GPIO_PORTG_DEN_R, LED1_BIT)
//-----------------------------------------------------------------------------
//Switch Driver
#define SW1_BIT BIT4
#define SW1_PORT GPIO_PORTG_DATA_R
#define Sw1Init() (SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOG);\
Cbi(GPIO_PORTG_DIR_R, SW1_BIT);Sbi(GPIO_PORTG_DEN_R, SW1_BIT)
#define GetSw1() (GPIO_PORTG_DATA_R&SW1_BIT)
#define WaitForSw1() while(GetSw1())
#define WaitForSw1() while(GetSw1())
CAN Tinterface
반응형