📄 bf5xx.h
字号:
#ifndef __BF533_H__
#define __BF533_H__
#include <ccblkfn.h>
#include <cdefbf53x.h>
#include <sys/exception.h>
#define IRQ_PF PF5
static inline void udelay(void)
{
volatile int i = 1000;
while(i--);
}
static inline void delay(void)
{
volatile int i = 1000000;
while(i--);
}
// addresses for Port A in Flash A
#define pFlashA_PortA_Dir (volatile unsigned char *)0x20270006
#define pFlashA_PortA_Data (volatile unsigned char *)0x20270004
// addresses for Port B in Flash A
#define pFlashA_PortB_Dir (volatile unsigned char *)0x20270007
#define pFlashA_PortB_Data (volatile unsigned char *)0x20270005
//--------------------------------------------------------------------------//
// LED Support //
//--------------------------------------------------------------------------//
#define LED4 (0x1)
#define LED5 (0x2)
#define LED6 (0x4)
#define LED7 (0x8)
#define LED8 (0x10)
#define LED9 (0x20)
// Set Port B of FLASH to outputs (LEDs)
inline void Setup_LEDs() { *pFlashA_PortB_Dir = 0x3f; }
inline void Leda_Off() { *pFlashA_PortB_Data = 0; }
inline void Led4_On() { *pFlashA_PortB_Data |= LED4; }
inline void Led4_Off() { *pFlashA_PortB_Data &= ~LED4; }
inline void Led5_On() { *pFlashA_PortB_Data |= LED5; }
inline void Led5_Off() { *pFlashA_PortB_Data &= ~LED5; }
inline void Led6_On() { *pFlashA_PortB_Data |= LED6; }
inline void Led6_Off() { *pFlashA_PortB_Data &= ~LED6; }
inline void Led7_On() { *pFlashA_PortB_Data |= LED7; }
inline void Led7_Off() { *pFlashA_PortB_Data &= ~LED7; }
inline void Led8_On() { *pFlashA_PortB_Data |= LED8; }
inline void Led8_Off() { *pFlashA_PortB_Data &= ~LED8; }
inline void Led9_On() { *pFlashA_PortB_Data |= LED9; }
inline void Led9_Off() { *pFlashA_PortB_Data &= ~LED9; }
inline void Led_On(short LED) { *pFlashA_PortB_Data |= 0x1<<(LED-4); }
inline void Led_Off(short LED){ *pFlashA_PortB_Data &= ~(0x1<<(LED-4)); }
#define printf(fmt ,args...) UART_printf(fmt ,##args)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -