📄 bsp.c
字号:
value = (data & 0x0F) << 10;
FIO0SET = value;
value = (~data & 0x0F) << 10;
FIO0CLR = value;
DispDly_uS(100);
DispE_Low();
}
#if DISP_BUS_WIDTH == 4
void DispDataWrOneNibble(CPU_INT08U data)
{
INT32U value;
DispRW_Low(); /* Set R/W write LOW to write to the LCD module */
DispE_High(); /* Write the UPPER nibble to the LCD module */
value = ((data >> 4) & 0x0F) << 10;
FIO0SET = value;
value = (~(data >> 4) & 0x0F) << 10;
FIO0CLR = value;
DispDly_uS(100);
DispE_Low();
}
#endif
#endif
/*
*********************************************************************************************************
* DELAY
*
* Description : This function is called to delay for the specified number of microseconds.
*
* Arguments : us Number of microseconds
*
* Returns : none
*********************************************************************************************************
*/
#ifdef DISP_MODULE_PRESENT
void DispDly_uS (CPU_INT32U us)
{
Tmr1_Dly(us);
}
#endif
/*
*********************************************************************************************************
* INITIALIZE DISPLAY DRIVER I/O PORTS
*
* Description : This initializes the I/O ports used by the display driver.
*
* Arguments : none
*
* Returns : none
*
* Note(s) : 1) The I/Os for the LCD module are initialized in BSP_IO_Init().
*********************************************************************************************************
*/
#ifdef DISP_MODULE_PRESENT
void DispInitPort (void)
{
}
#endif
/*
*********************************************************************************************************
* SELECT COMMAND OR DATA REGISTER
*
* Description : This changes the Register Select control line to the LCD controller.
* Arguments : none
*********************************************************************************************************
*/
#ifdef DISP_MODULE_PRESENT
void DispSel (CPU_INT08U sel)
{
if (sel == DISP_SEL_CMD_REG) {
FIO0CLR = LCD_BIT_RS; /* Select the command register (RS low) */
} else {
FIO0SET = LCD_BIT_RS; /* Select the data register (RS high) */
}
}
#endif
/*
*********************************************************************************************************
* DISPLAY CONTROL LINE FUNCTIONS
*********************************************************************************************************
*/
#ifdef DISP_MODULE_PRESENT
static void DispE_High (void)
{
FIO0SET = LCD_BIT_E;
}
static void DispE_Low (void)
{
FIO0CLR = LCD_BIT_E;
}
static void DispRW_High (void)
{
FIO0SET = LCD_BIT_RW;
}
static void DispRW_Low (void)
{
FIO0CLR = LCD_BIT_RW;
}
#endif
/*
*********************************************************************************************************
* GET 'PUSH BUTTON' STATUS
*
* Description : This function is used to get the status of any push button on the board.
*
* Arguments : push_button is the number of the push button to probe
* 1 probe the push button B1
* 2 probe the push button B2
*********************************************************************************************************
*/
CPU_BOOLEAN PB_GetStatus (CPU_INT08U push_button_id)
{
CPU_BOOLEAN status;
status = DEF_FALSE;
switch (push_button_id) {
case 1:
if ((FIO0PIN & (1 << 15)) == 0) {
return (DEF_TRUE);
}
break;
case 2:
if ((FIO0PIN & (1 << 16)) == 0) {
return (DEF_TRUE);
}
break;
default:
break;
}
return (status);
}
/*
*********************************************************************************************************
* LED INITIALIZATION
*
* Description : This function initializes the board's LEDs
*
* Arguments : none
*********************************************************************************************************
*/
void LED_Init (void)
{
LED_Off(0); /* Turn OFF all the LEDs */
}
/*
*********************************************************************************************************
* LED ON
*
* Description : This function is used to control any or all the LEDs on the board.
*
* Arguments : led is the number of the LED to control
* 0 indicates that you want ALL the LEDs to be ON
* 1 turns ON LED1 on the board
* .
* .
* 16 turns ON LED16 on the board
*********************************************************************************************************
*/
void LED_On (CPU_INT08U led)
{
switch (led) {
case 0:
case 1:
FIO0SET = LED_1_BIT;
break;
default:
break;
}
}
/*
*********************************************************************************************************
* LED OFF
*
* Description : This function is used to control any or all the LEDs on the board.
*
* Arguments : led is the number of the LED to turn OFF
* 0 indicates that you want ALL the LEDs to be OFF
* 1 turns OFF LED1 on the board
* .
* .
* 16 turns OFF LED16 on the board
*********************************************************************************************************
*/
void LED_Off (CPU_INT08U led)
{
switch (led) {
case 0:
case 1:
FIO0CLR = LED_1_BIT;
break;
default:
break;
}
}
/*
*********************************************************************************************************
* LED TOGGLE
*
* Description : This function is used to toggle any or all the LEDs on the board.
*
* Arguments : led is the number of the LED to control
* 0 indicates that you want to toggle ALL the LEDs
* 1 toggles LED1 on the board
* .
* .
* 16 toggles LED16 on the board
*********************************************************************************************************
*/
void LED_Toggle (CPU_INT08U led)
{
CPU_INT32U are_off;
CPU_INT32U are_on;
switch (led) {
case 0:
case 1:
are_off = FIO0PIN ^ LED_1_BIT;
are_on = ~FIO0PIN ^ LED_1_BIT;
FIO0CLR = are_on;
FIO0SET = are_off;
break;
}
}
/*
*********************************************************************************************************
* MAM_Init()
*
* Description: This function initializes the memory acceleration module.
*
* Arguments : None
*
* Returns : None
*********************************************************************************************************
*/
static void BSP_MAM_Init (void)
{
MAMCR = 0x00; /* Disable the Memory Accelerator Module */
MAMTIM = 0x03; /* MAM fetch cycles are 3 CCLKs in duration */
MAMCR = 0x02; /* Enable the Memory Accelerator Module */
}
/*
*********************************************************************************************************
* EXCEPTION HANDLER
*
* Description : This function should be used to handle any exceptions. It is called by
* OS_CPU_ARM_EXCEPT_HANDLER(), which is declared in os_cpu_a.s
*
* Arguments : none
*********************************************************************************************************
*/
void OS_CPU_ExceptHndlr (CPU_INT32U except_id)
{
PFNCT pfnct;
pfnct = (PFNCT)VICVectAddr; /* Read the interrupt vector from the VIC */
while (pfnct != (PFNCT)0) { /* Make sure we don't have a NULL pointer */
(*pfnct)(); /* Execute the ISR for the interrupting device */
pfnct = (PFNCT)VICVectAddr; /* Read the interrupt vector from the VIC */
}
}
/*
*********************************************************************************************************
* INITIALIZE TIMER FOR uC/OS-View
*
* Description : This function is called to by uC/OS-View to initialize the free running timer that is
* used to make time measurements.
*
* Arguments : none
*
* Returns ; none
*
* Note(s) : This function is EMPTY because the timer is initialized elsewhere.
*********************************************************************************************************
*/
#if OS_VIEW_MODULE > 0
void OSView_TmrInit (void)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -