?? target.c.bak
字號(hào):
/****************************************Copyright (c)****************************************************
** Guangzhou ZHIYUAN electronics Co.,LTD.
**
** http://www.embedtools.com
**
**--------------File Info---------------------------------------------------------------------------------
** File Name: Target.c
** Last modified Date: 2007.01.18
** Last Version: 1.0
** Description: Initialization of the target board 目標(biāo)板初始化
**
**--------------------------------------------------------------------------------------------------------
** Created By: Steven Zhou 周紹剛
** Created date: 2007.01.18
** Version: 1.0
** Descriptions: The original version 初始版本
**
**--------------------------------------------------------------------------------------------------------
** Modified by: Ni Likao 倪力考
** Modified date: 2007.11.02
** Version: 1.1
** Descriptions: 增加了LED,BUZZ,KEY端口類(lèi)型配置以適用于LUMINARY新型號(hào)的芯片
**
*********************************************************************************************************/
#include <includes.h>
/*********************************************************************************************************
** Function name: ledInit
** Descriptions: Initialize the target board's leds,support up to 4 leds
** 初始化目標(biāo)板的LED,最多支持4個(gè)
** Input parameters: None 無(wú)
** Output parameters: None 無(wú)
** Returned value: None 無(wú)
** Created by: Steven Zhou 周紹剛
** Created Date: 2007.01.18
**--------------------------------------------------------------------------------------------------------
** Modified by: Ni Likao 倪力考
** Modified date: 2007.11.02
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
#if (TARGET_LED1_EN > 0) || (TARGET_LED2_EN > 0) || (TARGET_LED3_EN > 0) || (TARGET_LED4_EN > 0)
void ledInit (void)
{
#if TARGET_LED1_EN > 0
SysCtlPeripheralEnable(LED1_SYSCTL);
GPIODirModeSet(LED1_GPIO_PORT, LED1_PIN, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(LED1_GPIO_PORT, LED1_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
#endif
#if TARGET_LED2_EN > 0
SysCtlPeripheralEnable(LED2_SYSCTL);
GPIODirModeSet(LED2_GPIO_PORT, LED2_PIN, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(LED2_GPIO_PORT, LED2_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
#endif
#if TARGET_LED3_EN > 0
SysCtlPeripheralEnable(LED3_SYSCTL);
GPIODirModeSet(LED3_GPIO_PORT, LED3_PIN, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(LED3_GPIO_PORT, LED3_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
#endif
#if TARGET_LED4_EN > 0
SysCtlPeripheralEnable(LED4_SYSCTL);
GPIODirModeSet(LED4_GPIO_PORT, LED4_PIN, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(LED4_GPIO_PORT, LED4_PIN, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
#endif
}
#endif
/*********************************************************************************************************
** Function name: ledOn
** Descriptions: Switch on one or all of the LEDs 點(diǎn)亮其中一個(gè)或全部的LED
** Input parameters: led: The num.of led to be switched on, 1-4 for LED1-LED4,
** 0xFF for all leds, others no action
** led: 要點(diǎn)亮的LED的號(hào)碼,1-4代表LED1-LED4,0xFF代表全部LED,其他值無(wú)意義。
** Output parameters: None 無(wú)
** Returned value: None 無(wú)
** Created by: Steven Zhou 周紹剛
** Created Date: 2007.01.18
**--------------------------------------------------------------------------------------------------------
** Modified by: Ni Likao 倪力考
** Modified date: 2007.11.02
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
#if (TARGET_LED1_EN > 0) || (TARGET_LED2_EN > 0) || (TARGET_LED3_EN > 0) || (TARGET_LED4_EN > 0)
void ledOn (INT8U ucLed)
{
switch (ucLed) {
case 1:
#if TARGET_LED1_EN > 0
GPIOPinWrite(LED1_GPIO_PORT, LED1_PIN, ~LED1_PIN);
#endif
break;
case 2:
#if TARGET_LED2_EN > 0
GPIOPinWrite(LED2_GPIO_PORT, LED2_PIN, ~LED2_PIN);
#endif
break;
case 3:
#if TARGET_LED3_EN > 0
GPIOPinWrite(LED3_GPIO_PORT, LED3_PIN, ~LED3_PIN);
#endif
break;
case 4:
#if TARGET_LED4_EN > 0
GPIOPinWrite(LED4_GPIO_PORT, LED4_PIN, ~LED4_PIN);
#endif
break;
case 0xFF:
#if TARGET_LED1_EN > 0
GPIOPinWrite(LED1_GPIO_PORT, LED1_PIN, ~LED1_PIN);
#endif
#if TARGET_LED2_EN > 0
GPIOPinWrite(LED2_GPIO_PORT, LED2_PIN, ~LED2_PIN);
#endif
#if TARGET_LED3_EN > 0
GPIOPinWrite(LED3_GPIO_PORT, LED3_PIN, ~LED3_PIN);
#endif
#if TARGET_LED4_EN > 0
GPIOPinWrite(LED4_GPIO_PORT, LED4_PIN, ~LED4_PIN);
#endif
break;
default:
break;
}
}
#endif
/*********************************************************************************************************
** Function name: ledOff
** Descriptions: Switch off one or all of the LEDs 關(guān)閉其中一個(gè)或全部的LED
** Input parameters: led: The num.of led to be switched off, 1-4 for LED1-LED4,
** 0xFF for all leds, others no action
** led: 要關(guān)閉的LED的號(hào)碼,1-4代表LED1-LED4,0xFF代表全部LED,其他值無(wú)意義。
** Output parameters: None 無(wú)
** Returned value: None 無(wú)
** Created by: Steven Zhou 周紹剛
** Created Date: 2007.01.18
**--------------------------------------------------------------------------------------------------------
** Modified by: Ni Likao 倪力考
** Modified date: 2007.11.02
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
#if (TARGET_LED1_EN > 0) || (TARGET_LED2_EN > 0) || (TARGET_LED3_EN > 0) || (TARGET_LED4_EN > 0)
void ledOff (INT8U ucLed)
{
switch (ucLed) {
case 1:
#if TARGET_LED1_EN > 0
GPIOPinWrite(LED1_GPIO_PORT, LED1_PIN, LED1_PIN);
#endif
break;
case 2:
#if TARGET_LED2_EN > 0
GPIOPinWrite(LED2_GPIO_PORT, LED2_PIN, LED2_PIN);
#endif
break;
case 3:
#if TARGET_LED3_EN > 0
GPIOPinWrite(LED3_GPIO_PORT, LED3_PIN, LED3_PIN);
#endif
break;
case 4:
#if TARGET_LED4_EN > 0
GPIOPinWrite(LED4_GPIO_PORT, LED4_PIN, LED4_PIN);
#endif
break;
case 0xFF:
#if TARGET_LED1_EN > 0
GPIOPinWrite(LED1_GPIO_PORT, LED1_PIN, LED1_PIN);
#endif
#if TARGET_LED2_EN > 0
GPIOPinWrite(LED2_GPIO_PORT, LED2_PIN, LED2_PIN);
#endif
#if TARGET_LED3_EN > 0
GPIOPinWrite(LED3_GPIO_PORT, LED3_PIN, LED3_PIN);
#endif
#if TARGET_LED4_EN > 0
GPIOPinWrite(LED4_GPIO_PORT, LED4_PIN, LED4_PIN);
#endif
break;
default:
break;
}
}
#endif
/*********************************************************************************************************
** Function name: ledToggle
** Descriptions: Toggle one or all of the LEDs 取反其中一個(gè)或全部的LED
** Input parameters: led: The num.of led to be toggled, 1-4 for LED1-LED4,
** 0xFF for all leds, others no action
** led: 要取反的LED的號(hào)碼,1-4代表LED1-LED4,0xFF代表全部LED,其他值無(wú)意義。
** Output parameters: None 無(wú)
** Returned value: None 無(wú)
** Created by: Steven Zhou 周紹剛
** Created Date: 2007.01.18
**--------------------------------------------------------------------------------------------------------
** Modified by: Ni Likao 倪力考
** Modified date: 2007.11.02
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
#if (TARGET_LED1_EN > 0) || (TARGET_LED2_EN > 0) || (TARGET_LED3_EN > 0) || (TARGET_LED4_EN > 0)
void ledToggle (INT8U ucLed)
{
switch (ucLed) {
case 1:
#if TARGET_LED1_EN > 0
GPIOPinWrite(LED1_GPIO_PORT, LED1_PIN, ~GPIOPinRead(LED1_GPIO_PORT, LED1_PIN));
#endif
break;
case 2:
#if TARGET_LED2_EN > 0
GPIOPinWrite(LED2_GPIO_PORT, LED2_PIN, ~GPIOPinRead(LED2_GPIO_PORT, LED2_PIN));
#endif
break;
case 3:
#if TARGET_LED3_EN > 0
GPIOPinWrite(LED3_GPIO_PORT, LED3_PIN, ~GPIOPinRead(LED3_GPIO_PORT, LED3_PIN));
#endif
break;
case 4:
#if TARGET_LED4_EN > 0
GPIOPinWrite(LED4_GPIO_PORT, LED4_PIN, ~GPIOPinRead(LED4_GPIO_PORT, LED4_PIN));
#endif
break;
case 0xFF:
#if TARGET_LED1_EN > 0
GPIOPinWrite(LED1_GPIO_PORT, LED1_PIN, ~GPIOPinRead(LED1_GPIO_PORT, LED1_PIN));
#endif
#if TARGET_LED2_EN > 0
GPIOPinWrite(LED2_GPIO_PORT, LED2_PIN, ~GPIOPinRead(LED2_GPIO_PORT, LED2_PIN));
#endif
#if TARGET_LED3_EN > 0
GPIOPinWrite(LED3_GPIO_PORT, LED3_PIN, ~GPIOPinRead(LED3_GPIO_PORT, LED3_PIN));
#endif
#if TARGET_LED4_EN > 0
GPIOPinWrite(LED4_GPIO_PORT, LED4_PIN, ~GPIOPinRead(LED4_GPIO_PORT, LED4_PIN));
#endif
break;
default:
break;
}
}
#endif
/*********************************************************************************************************
** Function name: buzInit
** Descriptions: Initialize the target board's buzzer 初始化目標(biāo)板的蜂鳴器
** Input parameters: None 無(wú)
** Output parameters: None 無(wú)
** Returned value: None 無(wú)
** Created by: Steven Zhou 周紹剛
** Created Date: 2007.01.18
**--------------------------------------------------------------------------------------------------------
** Modified by: Ni Likao 倪力考
** Modified date: 2007.11.02
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
#if TARGET_BUZ_EN > 0
void buzInit (void)
{
SysCtlPeripheralEnable(BUZ_SYSCTL);
GPIODirModeSet(BUZ_GPIO_PORT, BUZ_PIN, GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(BUZ_GPIO_PORT, BUZ_PIN,GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
buzOff();
}
#endif
/*********************************************************************************************************
** Function name: buzOn
** Descriptions: Switch on the buzzer 打開(kāi)蜂鳴器
** Input parameters: None 無(wú)
** Output parameters: None 無(wú)
** Returned value: None 無(wú)
** Created by: Steven Zhou 周紹剛
** Created Date: 2007.01.18
**--------------------------------------------------------------------------------------------------------
** Modified by: Ni Likao 倪力考
** Modified date: 2007.11.02
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
#if TARGET_BUZ_EN > 0
void buzOn (void)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -