本文整理汇总了C++中Delay函数的典型用法代码示例。如果您正苦于以下问题:C++ Delay函数的具体用法?C++ Delay怎么用?C++ Delay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Delay函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/*************************************************************************
* Function Name: main
* Parameters: none
* Return: Int32U
*
* Description: The main subroutine
*
*************************************************************************/
int main(void)
{
unsigned short deviceid=0x0000;
// システムを初期化します(外部水晶をONにし72MHz動作に切り替えます)
SystemInit();
/* FSMC Configuration */
p.FSMC_AddressSetupTime = 30;
p.FSMC_AddressHoldTime = 0;
p.FSMC_DataSetupTime = 30;
p.FSMC_BusTurnAroundDuration = 0x00;
p.FSMC_CLKDivision = 0x00;
p.FSMC_DataLatency = FSMC_AccessMode_A;
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
/* Enable FSMC Bank1_NOR Bank */
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM2, ENABLE);
LCD->LCD_REG = 0x0000;
deviceid = LCD->LCD_RAM;
if (deviceid != 0x8989) {
goto error;
}
/*
* LCD Initialize
*/
/* power on */
LCD->LCD_REG = 0x0007;
LCD->LCD_RAM = 0x0021;
LCD->LCD_REG = 0x0000;
LCD->LCD_RAM = 0x0001;
LCD->LCD_REG = 0x0007;
LCD->LCD_RAM = 0x0023;
LCD->LCD_REG = 0x0010;
LCD->LCD_RAM = 0x0000;
Delay(3000000);
LCD->LCD_REG = 0x0007;
LCD->LCD_RAM = 0x0033;
LCD->LCD_REG = 0x0011;
LCD->LCD_RAM = 0x6070;
LCD->LCD_REG = 0x0002;
LCD->LCD_RAM = 0x0500;
LCD->LCD_REG = 0x0003;
LCD->LCD_RAM = 0x0804;
LCD->LCD_REG = 0x000C;
LCD->LCD_RAM = 0x0000;
LCD->LCD_REG = 0x000D;
LCD->LCD_RAM = 0x0808;
write_reg(0x000E,0x2900);
write_reg(0x001E,0x00B8);
write_reg(0x0001,0x2B3F);//Çý¶¯Êä³ö¿ØÖÆ320*240 0x6B3F
write_reg(0x0010,0x0000);
write_reg(0x0005,0x0000);
write_reg(0x0006,0x0000);
write_reg(0x0016,0xEF1C);
write_reg(0x0017,0x0003);
//.........这里部分代码省略.........
示例2: main
void main (void)
{
int a=1;//само число
int direction=1;//1-влево 0-вправо
int move=1;//Если 1 движение, если 0 остановка
int i = 2;
// Настроить порт
SCS |= 0x01; //Разрешить быстрый ввод/вывод
FIO0DIR = 0x00000000; // Все разряды порта 0 на ввод для чтения состояния кнопок и энкодера
FIO0MASK = 0; //Все разряды порта 0 работают в быстром режиме
FIO2DIR = 0x00FF; // Биты 0-7 порта 2 на вывод для управления светодиодами
FIO2MASK = 0; //Все разряды порта 2 работают в быстром режиме
ENCA_cur = ENCA_prev = (FIO0PIN & 0x00000800) >> 11; //Чтение начального состояния контакта А энкодера (P0.11)
ENCB_cur = ENCB_prev = (FIO0PIN & 0x00200000) >> 21; //Чтение начального состояния контакта B энкодера (P0.21)
BTN1_cur = BTN1_prev = FIO0PIN & 0x0020; //Чтение начального состояния кнопки 1
BTN2_cur = BTN2_prev = FIO0PIN & 0x0040; //Чтение начального состояния кнопки 2
BTN2_cur = BTN2_prev = FIO0PIN & 0x0080; //Чтение начального состояния кнопки 3
BTN2_cur = BTN2_prev = FIO0PIN & 0x0200; //Чтение начального состояния кнопки 4
while (1)//Loop forever
{
if( GetBtn1State() ) {
move = 0;
}
if( GetBtn2State() ) {
move = 1;
}
if(GetBtn3State()) {
direction=!direction; //Меняем направление
}
if(GetBtn4State()) {
direction=!direction; //Меняем направление
}
switch(GetEncState())
{
case 1://УСКОРЕНИЕ
i=i++;
break;
case -1://ЗАМЕДЛЕНИЕ
i=i--;
break;
}
if(move)
{ if(direction) {
a<<=1;
}
else {
a>>=1;
}
}
if((a & 0x0100) && direction) {
a=1; //ловим крайнее левое состояние и смещаем "каретку"
}
if((!a) && !direction) {
a=0x0080; //ловим крайнее правое состояние и смещаем "каретку"
}
FIO2PIN = a;//Вывод на светодиоды
Delay(i*10000);
}
}
示例3: switch
void ScriptNR04::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
if (actorId == 18) {
switch (newGoal) {
case 214:
Actor_Change_Animation_Mode(18, 29);
Delay(2500);
Actor_Says(18, 290, 3);
sub_401DB0();
//return true;
break;
case 213:
Actor_Clue_Acquire(0, 88, 0, 18);
Item_Pickup_Spin_Effect(984, 200, 160);
Actor_Says(18, 200, 30);
Actor_Says(18, 210, 30);
Actor_Says(18, 220, 30);
Actor_Says_With_Pause(0, 3425, 1.5f, 23);
Actor_Says(0, 3430, 3);
Actor_Says(18, 240, 30);
Actor_Says(0, 3435, 3);
Actor_Says(18, 250, 30);
Actor_Says(0, 3440, 3);
Actor_Says(18, 280, 30);
Actor_Says(0, 3445, 3);
Actor_Set_Goal_Number(18, 214);
//return true;
break;
case 209:
Actor_Face_Actor(0, 18, true);
Delay(3000);
Actor_Says(18, 170, 30);
Actor_Says(0, 3415, 3);
Actor_Says(18, 180, 30);
Actor_Says_With_Pause(0, 3420, 1.5f, 3);
Actor_Says(18, 190, 30);
Actor_Set_Goal_Number(18, 211);
//return true;
break;
case 207:
Loop_Actor_Walk_To_Waypoint(18, 445, 0, 1, false);
Actor_Face_Heading(18, 49, false);
Actor_Change_Animation_Mode(18, 85);
Actor_Face_Actor(0, 18, true);
Actor_Set_Goal_Number(18, 208);
Actor_Clue_Acquire(0, 92, 0, 18);
//return true;
break;
case 204:
Actor_Face_Actor(0, 18, true);
Actor_Says(18, 90, 73);
Actor_Says(0, 3390, 3);
Actor_Face_Actor(18, 0, true);
Actor_Says(18, 110, 74);
Actor_Says(0, 3385, 3);
Actor_Says(18, 120, 74);
Actor_Face_Actor(18, 0, true);
Actor_Set_Goal_Number(18, 205);
//return true;
break;
case 202:
Actor_Face_Actor(18, 0, true);
Actor_Face_Actor(0, 18, true);
Actor_Says(18, 30, 3);
Actor_Says(0, 3375, 3);
Actor_Says_With_Pause(18, 50, 1.5f, 3);
Actor_Says(18, 60, 3);
Actor_Says_With_Pause(0, 3380, 1.0f, 3);
Actor_Says(18, 70, 3);
Actor_Says(0, 3415, 3);
Actor_Says(18, 80, 3);
Player_Gains_Control();
Actor_Set_Goal_Number(18, 203);
//return true;
break;
}
}
//return false;
}
示例4: Work3
void Work3(){printf("Start 3\n");Delay();printf("End 3\n");}
示例5: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f30x.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f30x.c file
*/
/* Configure the ADC clock */
RCC_ADCCLKConfig(RCC_ADC12PLLCLK_Div2);
/* Enable ADC1 clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_ADC12, ENABLE);
/* Setup SysTick Timer for 1 µsec interrupts */
if (SysTick_Config(SystemCoreClock / 1000000))
{
/* Capture error */
while (1)
{}
}
/* ADC Channel configuration */
/* GPIOC Periph clock enable */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
/* Configure ADC Channel7 as analog input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
GPIO_Init(GPIOC, &GPIO_InitStructure);
ADC_StructInit(&ADC_InitStructure);
/* Calibration procedure */
ADC_VoltageRegulatorCmd(ADC1, ENABLE);
/* Insert delay equal to 10 µs */
Delay(10);
ADC_SelectCalibrationMode(ADC1, ADC_CalibrationMode_Single);
ADC_StartCalibration(ADC1);
while(ADC_GetCalibrationStatus(ADC1) != RESET );
calibration_value = ADC_GetCalibrationValue(ADC1);
ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStructure.ADC_Clock = ADC_Clock_AsynClkMode;
ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStructure.ADC_DMAMode = ADC_DMAMode_OneShot;
ADC_CommonInitStructure.ADC_TwoSamplingDelay = 0;
ADC_CommonInit(ADC1, &ADC_CommonInitStructure);
ADC_InitStructure.ADC_ContinuousConvMode = ADC_ContinuousConvMode_Enable;
ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ExternalTrigConvEvent = ADC_ExternalTrigConvEvent_0;
ADC_InitStructure.ADC_ExternalTrigEventEdge = ADC_ExternalTrigEventEdge_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_OverrunMode = ADC_OverrunMode_Disable;
ADC_InitStructure.ADC_AutoInjMode = ADC_AutoInjec_Disable;
ADC_InitStructure.ADC_NbrOfRegChannel = 1;
ADC_Init(ADC1, &ADC_InitStructure);
/* ADC1 regular channel7 configuration */
ADC_RegularChannelConfig(ADC1, ADC_Channel_7, 1, ADC_SampleTime_7Cycles5);
/* Enable ADC1 */
ADC_Cmd(ADC1, ENABLE);
/* wait for ADRDY */
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_RDY));
/* Start ADC1 Software Conversion */
ADC_StartConversion(ADC1);
/* Infinite loop */
while (1)
{
/* Test EOC flag */
while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET);
/* Get ADC1 converted data */
ADC1ConvertedValue =ADC_GetConversionValue(ADC1);
/* Compute the voltage */
ADC1ConvertedVoltage = (ADC1ConvertedValue *3300)/0xFFF;
/* Display converted data on the LCD */
Display();
}
}
示例6: I2CIntHandle
/*
* I2C中断服务程序
* 根据剩余的数据长度选择继续传输或者结束
*/
void I2CIntHandle(void)
{
unsigned int iicSt,i;
// 清中断
SRCPND = BIT_IIC;
INTPND = BIT_IIC;
iicSt = IICSTAT;
if(iicSt & 0x8){ printf("Bus arbitration failed\n\r"); }
switch (g_tS3C24xx_I2C.Mode)
{
case WRDATA:
{
if((g_tS3C24xx_I2C.DataCount--) == 0)
{
// 下面两行用来恢复I2C操作,发出P信号
IICSTAT = 0xd0;
IICCON = 0xaf;
Delay(10000); // 等待一段时间以便P信号已经发出
break;
}
printf("[*] %s WRDATA 0x%x \r\n", __FUNCTION__, g_tS3C24xx_I2C.pData[g_tS3C24xx_I2C.Pt]);
IICDS = g_tS3C24xx_I2C.pData[g_tS3C24xx_I2C.Pt++];
// 将数据写入IICDS后,需要一段时间才能出现在SDA线上
for (i = 0; i < 10; i++);
IICCON = 0xaf; // 恢复I2C传输
break;
}
case RDDATA:
{
if (g_tS3C24xx_I2C.Pt == -1)
{
// 这次中断是发送I2C设备地址后发生的,没有数据
// 只接收一个数据时,不要发出ACK信号
g_tS3C24xx_I2C.Pt = 0;
if(g_tS3C24xx_I2C.DataCount == 1)
IICCON = 0x2f; // 恢复I2C传输,开始接收数据,接收到数据时不发出ACK
else
IICCON = 0xaf; // 恢复I2C传输,开始接收数据
break;
}
printf("[*] %s RDDATA 0x%x \r\n", __FUNCTION__, IICDS);
if ((g_tS3C24xx_I2C.DataCount--) == 0)
{
g_tS3C24xx_I2C.pData[g_tS3C24xx_I2C.Pt++] = IICDS;
// 下面两行恢复I2C操作,发出P信号
IICSTAT = 0x90;
IICCON = 0xaf;
Delay(10000); // 等待一段时间以便P信号已经发出
break;
}
g_tS3C24xx_I2C.pData[g_tS3C24xx_I2C.Pt++] = IICDS;
// 接收最后一个数据时,不要发出ACK信号
if(g_tS3C24xx_I2C.DataCount == 0)
IICCON = 0x2f; // 恢复I2C传输,接收到下一数据时无ACK
else
IICCON = 0xaf; // 恢复I2C传输,接收到下一数据时发出ACK
break;
}
default:
break;
}
}
示例7: Work1
void Work1(){printf("Start 1\n");Delay();printf("End 1\n");}
示例8: ProSLIC_testInRinging
/* *********************************** */
int ProSLIC_testInRinging(proslicChanType *pProslic, proslicTestInObjType *pTstin)
{
uInt8 ringcon_save,enhance_save;
int32 vtr[MAX_RINGING_SAMPLES];
int i;
uInt8 lf;
uInt32 rtper_save, ringfr_save,ringamp_save,ringof_save,rtacth_save,rtdcth_save;
ProSLIC_DCfeed_Cfg dcfeedCfg;
/* Valid device check */
if(TSTIN_INVALID_PART_NUM)
{
return RC_UNSUPPORTED_FEATURE;
}
/* Check if enabled */
if(!pTstin->ringingTest.testEnable)
{
return RC_TEST_DISABLED;
}
/* Verify line not in use */
if(ProSLIC_ReadReg(pProslic,34) & 0x02) /* LCR */
{
#ifdef ENABLE_DEBUG
if(pProslic->debugMode)
{
LOGPRINT("\nProSLIC : TestIn : Ringing : Line in Use\n");
}
#endif
if(pTstin->ringingTest.abortIfLineInUse)
{
return RC_LINE_IN_USE;
}
}
/* Invalidate last test results */
pTstin->ringingTest.testDataValid = TSTIN_RESULTS_INVALID;
/* Check sample size/rate */
if(pTstin->ringingTest.numSamples > MAX_RINGING_SAMPLES)
pTstin->ringingTest.numSamples = MAX_RINGING_SAMPLES;
if(pTstin->ringingTest.sampleInterval > MAX_RINGING_SAMPLE_INTERVAL)
pTstin->ringingTest.sampleInterval = MAX_RINGING_SAMPLE_INTERVAL;
if(pTstin->ringingTest.sampleInterval < MIN_RINGING_SAMPLE_INTERVAL)
pTstin->ringingTest.sampleInterval = MIN_RINGING_SAMPLE_INTERVAL;
/* Disable Powersave */
enhance_save = ProSLIC_ReadReg(pProslic,47);
ProSLIC_WriteReg(pProslic,47,0x20);
Delay(pProTimer,10);
/* Disable ring cadencing */
ringcon_save = ProSLIC_ReadReg(pProslic,38); /* RINGCON */
ProSLIC_WriteReg(pProslic,38,ringcon_save&0xE7); /* RINGCON */
/* Must enter ringing through active state */
lf = ProSLIC_ReadReg(pProslic,30); /* LINEFEED */
ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
Delay(pProTimer,20); /* settle */
/* Start ringing */
ProSLIC_SetLinefeedStatus(pProslic,LF_RINGING);
Delay(pProTimer,500);
/* Verify Ring Started */
if(ProSLIC_ReadReg(pProslic,30) != 0x44)
{
ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
ProSLIC_SetLinefeedStatus(pProslic,LF_OPEN);
ProSLIC_WriteReg(pProslic,38,ringcon_save);
ProSLIC_WriteReg(pProslic,47,enhance_save);
ProSLIC_SetLinefeedStatus(pProslic,lf);
#ifdef ENABLE_DEBUG
if(pProslic->debugMode)
{
LOGPRINT("ProSLIC : TestIn : Ringing : Ring Start Fail\n");
}
#endif
pTstin->ringingTest.testResult = RC_TEST_FAILED;
return RC_RING_START_FAIL;
}
/* Capture samples */
pTstin->ringingTest.ringingVdc.value = 0;
for(i=0;i<pTstin->ringingTest.numSamples;i++)
{
vtr[i] = ProSLIC_ReadMADCScaled(pProslic,69,0); /* VDIFF_FILT */
pTstin->ringingTest.ringingVdc.value += vtr[i];
#ifdef ENABLE_DEBUG
if(pProslic->debugMode)
{
LOGPRINT("ProSLIC : TestIn : Ringing : Vtr[%d] = %d\n",i,vtr[i]);
}
#endif
Delay(pProTimer,pTstin->ringingTest.sampleInterval);
}
//.........这里部分代码省略.........
示例9: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
before to branch to application main.
*/
/* SysTick end of count event each 10ms */
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_Config(RCC_Clocks.HCLK_Frequency / 100);
/* Initialize LEDs mounted on EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
STM_EVAL_LEDOn(LED1);
/* Initialize the LCD */
LCD_Init();
LCD_Clear(Black);
LCD_SetTextColor(White);
LCD_LOG_SetHeader((uint8_t*)"STM32 Camera Demo");
LCD_LOG_SetFooter ((uint8_t*)" Copyright (c) STMicroelectronics" );
/* ADC configuration */
ADC_Config();
/* Initializes the DCMI interface (I2C and GPIO) used to configure the camera */
OV2640_HW_Init();
/* Read the OV9655/OV2640 Manufacturer identifier */
OV9655_ReadID(&OV9655_Camera_ID);
OV2640_ReadID(&OV2640_Camera_ID);
if(OV9655_Camera_ID.PID == 0x96)
{
Camera = OV9655_CAMERA;
sprintf((char*)abuffer, "OV9655 Camera ID 0x%x", OV9655_Camera_ID.PID);
ValueMax = 2;
}
else if(OV2640_Camera_ID.PIDH == 0x26)
{
Camera = OV2640_CAMERA;
sprintf((char*)abuffer, "OV2640 Camera ID 0x%x", OV2640_Camera_ID.PIDH);
ValueMax = 2;
}
else
{
LCD_SetTextColor(LCD_COLOR_RED);
LCD_DisplayStringLine(LINE(4), (uint8_t*)"Check the Camera HW and try again");
while(1);
}
LCD_SetTextColor(LCD_COLOR_YELLOW);
LCD_DisplayStringLine(LINE(4), (uint8_t*)abuffer);
LCD_SetTextColor(LCD_COLOR_WHITE);
Delay(200);
/* Initialize demo */
ImageFormat = (ImageFormat_TypeDef)Demo_Init();
/* Configure the Camera module mounted on STM324xG-EVAL/STM324x7I-EVAL boards */
Demo_LCD_Clear();
LCD_DisplayStringLine(LINE(4), (uint8_t*)"Camera Init.. ");
Camera_Config();
sprintf((char*)abuffer, " Image selected: %s", ImageForematArray[ImageFormat]);
LCD_DisplayStringLine(LINE(4),(uint8_t*)abuffer);
/* Enable DMA2 stream 1 and DCMI interface then start image capture */
DMA_Cmd(DMA2_Stream1, ENABLE);
DCMI_Cmd(ENABLE);
/* Insert 100ms delay: wait 100ms */
Delay(200);
DCMI_CaptureCmd(ENABLE);
LCD_ClearLine(LINE(4));
Demo_LCD_Clear();
if(ImageFormat == BMP_QQVGA)
{
/* LCD Display window */
LCD_SetDisplayWindow(179, 239, 120, 160);
LCD_WriteReg(LCD_REG_3, 0x1038);
LCD_WriteRAM_Prepare();
}
else if(ImageFormat == BMP_QVGA)
{
/* LCD Display window */
//.........这里部分代码省略.........
示例10: ProSLIC_testInAudio
/* *********************************** */
int ProSLIC_testInAudio(proslicChanType *pProslic, proslicTestInObjType *pTstin)
{
uInt8 enhanceRegSave;
uInt8 lf;
int32 data;
int32 gainMeas1,gainMeas2;
int32 gainMeas3 = 0;
ProSLIC_audioGain_Cfg gainCfg;
int32 Pin = -3980; /* -10dBm + 6.02dB (since OHT w/ no AC load) */
/* Valid device check */
if(TSTIN_INVALID_PART_NUM)
{
return RC_UNSUPPORTED_FEATURE;
}
/* Check if enabled */
if(!pTstin->audioTest.testEnable)
{
return RC_TEST_DISABLED;
}
/* Invalidate last test results */
pTstin->audioTest.testDataValid = TSTIN_RESULTS_INVALID;
/* Verify line not in use */
if(ProSLIC_ReadReg(pProslic,34) & 0x02) /* LCR */
{
#ifdef ENABLE_DEBUG
if(pProslic->debugMode)
{
LOGPRINT("\nProSLIC : TestIn : Audio : Line in Use\n");
}
#endif
if(pTstin->audioTest.abortIfLineInUse == ABORT_LIU_ENABLED)
{
return RC_LINE_IN_USE;
}
}
/* Disable Powersave */
enhanceRegSave = ProSLIC_ReadReg(pProslic,47);
ProSLIC_WriteReg(pProslic,47,0x20);
Delay(pProTimer,10);
/* Setup Audio Filter, enable audio in OHT */
lf = ProSLIC_ReadReg(pProslic,30); /* LINEFEED */
ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_ACTIVE);
Delay(pProTimer,20); /* settle */
setup1kHzBandpass(pProslic);
ProSLIC_SetLinefeedStatus(pProslic,LF_FWD_OHT);
/* Setup osc1 for 1kHz -10dBm tone, disable hybrid, enable filters */
ProSLIC_WriteRAM(pProslic,26,0x5A80000L); /* OSC1FREQ */
ProSLIC_WriteRAM(pProslic,27,0x5D8000L); /* OSC1AMP */
ProSLIC_WriteReg(pProslic,48,0x02); /* OMODE */
ProSLIC_WriteReg(pProslic,49,0x01); /* OCON */
ProSLIC_WriteReg(pProslic,44,0x10); /* DIGCON */
ProSLIC_WriteReg(pProslic,71,0x10); /* DIAG1 */
/* Settle */
Delay(pProTimer,800);
/* Read first gain measurement (Gtx + Grx + Gzadj) */
gainMeas1 = readAudioDiagLevel(pProslic,pTstin->audioTest.zerodBm_mVpk);
/* Bypass TXACHPF and set TXACEQ to unity */
gainCfg.acgain = ProSLIC_ReadRAM(pProslic,544); /* TXACGAIN */
gainCfg.aceq_c0 = ProSLIC_ReadRAM(pProslic,540); /* TXACEQ_C0 */
gainCfg.aceq_c1 = ProSLIC_ReadRAM(pProslic,541); /* TXACEQ_C1 */
gainCfg.aceq_c2 = ProSLIC_ReadRAM(pProslic,542); /* TXACEQ_C2 */
gainCfg.aceq_c3 = ProSLIC_ReadRAM(pProslic,543); /* TXACEQ_C3 */
ProSLIC_WriteRAM(pProslic,544,0x8000000L);
ProSLIC_WriteRAM(pProslic,543,0x0L);
ProSLIC_WriteRAM(pProslic,542,0x0L);
ProSLIC_WriteRAM(pProslic,541,0x0L);
ProSLIC_WriteRAM(pProslic,540,0x8000000L);
ProSLIC_WriteReg(pProslic,44,0x18);
/* Settle */
Delay(pProTimer,800);
/* Read second level measurement (RX level only) */
gainMeas2 = readAudioDiagLevel(pProslic,pTstin->audioTest.zerodBm_mVpk);
/* Adjust txgain if TXACGAIN wasn't unity during gainMeas1 */
if(gainCfg.acgain != 0x8000000L)
{
data = (gainCfg.acgain*10)/134217;
gainMeas3 = dBLookup(data);
}
/* Computations */
pTstin->audioTest.rxGain.value = gainMeas2 - Pin;
pTstin->audioTest.txGain.value = gainMeas1 - gainMeas2 + gainMeas3;
#ifdef ENABLE_DEBUG
if(pProslic->debugMode)
//.........这里部分代码省略.........
示例11: ProSLIC_testInDCFeed
int ProSLIC_testInDCFeed(proslicChanType *pProslic, proslicTestInObjType *pTstin)
{
uInt8 enhanceRegSave;
proslicMonitorType monitor;
ramData lcroffhk_save;
ramData lcronhk_save;
/* Valid device check */
if(TSTIN_INVALID_PART_NUM)
{
return RC_UNSUPPORTED_FEATURE;
}
/* Check if enabled */
if(!pTstin->dcFeedTest.testEnable)
{
return RC_TEST_DISABLED;
}
/* Invalidate last test results */
pTstin->dcFeedTest.testDataValid = TSTIN_RESULTS_INVALID;
/* Verify line not in use */
if(ProSLIC_ReadReg(pProslic,34) & 0x02) /* LCR */
{
#ifdef ENABLE_DEBUG
if(pProslic->debugMode)
{
LOGPRINT("\nProSLIC : TestIn : DC Feed : Line in Use\n");
}
#endif
if(pTstin->dcFeedTest.abortIfLineInUse==ABORT_LIU_ENABLED)
{
return RC_LINE_IN_USE;
}
}
/* Disable Powersave */
enhanceRegSave = ProSLIC_ReadReg(pProslic,47);
ProSLIC_WriteReg(pProslic,47,0x20);
Delay(pProTimer,10);
/* Onhook measurement */
ProSLIC_LineMonitor(pProslic,&monitor);
pTstin->dcFeedTest.dcfeedVtipOnhook.value = monitor.vtip;
pTstin->dcFeedTest.dcfeedVringOnhook.value = monitor.vring;
pTstin->dcFeedTest.dcfeedVloopOnhook.value = monitor.vtr;
pTstin->dcFeedTest.dcfeedVbatOnhook.value = monitor.vbat;
pTstin->dcFeedTest.dcfeedItipOnhook.value = monitor.itip;
pTstin->dcFeedTest.dcfeedIringOnhook.value = monitor.iring;
pTstin->dcFeedTest.dcfeedIloopOnhook.value = monitor.itr;
pTstin->dcFeedTest.dcfeedIlongOnhook.value = monitor.ilong;
/* Modify LCR threshold (optional) before connecting test load */
if(pTstin->dcFeedTest.applyLcrThresh == LCR_CHECK_ENABLED)
{
lcroffhk_save = ProSLIC_ReadRAM(pProslic,852);
lcronhk_save = ProSLIC_ReadRAM(pProslic,853);
ProSLIC_WriteRAM(pProslic,852,pTstin->dcFeedTest.altLcrOffThresh);
ProSLIC_WriteRAM(pProslic,853,pTstin->dcFeedTest.altLcrOnThresh);
}
/* Connect internal test load for 2nd dc feed i/v point */
setInternalTestLoad(pProslic,1);
Delay(pProTimer,50);
/* Offhook measurement */
ProSLIC_LineMonitor(pProslic,&monitor);
pTstin->dcFeedTest.dcfeedVtipOffhook.value = monitor.vtip;
pTstin->dcFeedTest.dcfeedVringOffhook.value = monitor.vring;
pTstin->dcFeedTest.dcfeedVloopOffhook.value = monitor.vtr;
pTstin->dcFeedTest.dcfeedVbatOffhook.value = monitor.vbat;
pTstin->dcFeedTest.dcfeedItipOffhook.value = monitor.itip;
pTstin->dcFeedTest.dcfeedIringOffhook.value = monitor.iring;
pTstin->dcFeedTest.dcfeedIloopOffhook.value = monitor.itr;
pTstin->dcFeedTest.dcfeedIlongOffhook.value = monitor.ilong;
pTstin->dcFeedTest.testResult = RC_TEST_PASSED; /* initialize */
/* Read LCR */
if(ProSLIC_ReadReg(pProslic,34) & 0x07) /* LCRRTP */
{
pTstin->dcFeedTest.lcrStatus = 1;
}
else
{
pTstin->dcFeedTest.lcrStatus = 0;
}
/* Only fail check if enabled */
if(pTstin->dcFeedTest.applyLcrThresh == LCR_CHECK_ENABLED)
{
pTstin->dcFeedTest.testResult |= !pTstin->dcFeedTest.lcrStatus;
}
/* Disconnect Test Load */
setInternalTestLoad(pProslic,0);
/* Restore LCR thresholds */
if(pTstin->dcFeedTest.applyLcrThresh == LCR_CHECK_ENABLED)
//.........这里部分代码省略.........
示例12: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f10x_xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f10x.c file
*/
/* Configure the system clocks */
RCC_Configuration();
/* Initialize LEDs and Key Button mounted on STM3210X-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO);
/* Test if Key Button GPIO Pin level is low (Key push-button on Eval Board pressed) */
if (STM_EVAL_PBGetState(BUTTON_KEY) == 0x00)
{ /* Key is pressed */
/* Turn on LED1 */
STM_EVAL_LEDOn(LED1);
/* Disable the Serial Wire Jtag Debug Port SWJ-DP */
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
/* Configure PA.13 (JTMS/SWDAT), PA.14 (JTCK/SWCLK) and PA.15 (JTDI) as
output push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure PB.03 (JTDO) and PB.04 (JTRST) as output push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4;
GPIO_Init(GPIOB, &GPIO_InitStructure);
while (1)
{
/* Toggle JTMS/SWDAT pin */
GPIO_WriteBit(GPIOA, GPIO_Pin_13, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOA, GPIO_Pin_13)));
/* Insert delay */
Delay(0x5FFFF);
/* Toggle JTCK/SWCLK pin */
GPIO_WriteBit(GPIOA, GPIO_Pin_14, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOA, GPIO_Pin_14)));
/* Insert delay */
Delay(0x5FFFF);
/* Toggle JTDI pin */
GPIO_WriteBit(GPIOA, GPIO_Pin_15, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOA, GPIO_Pin_15)));
/* Insert delay */
Delay(0x5FFFF);
/* Toggle JTDO pin */
GPIO_WriteBit(GPIOB, GPIO_Pin_3, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_3)));
/* Insert delay */
Delay(0x5FFFF);
/* Toggle JTRST pin */
GPIO_WriteBit(GPIOB, GPIO_Pin_4, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_4)));
/* Insert delay */
Delay(0x5FFFF);
}
}
else
{
/* Turn on LED2 */
STM_EVAL_LEDOn(LED2);
while (1)
{
}
}
}
示例13: sendbinfile
int sendbinfile(void) {
struct TransferFiles *tf;
int xprreturkod,cnt=0;
if(!(XProtocolBase=(struct Library *)OpenLibrary("xprzmodem.library",0L)))
{
puttekn("\r\n\nKunde inte öppna xprzmodem.library!\r\n",-1);
return(2);
}
if(!(xio=(struct XPR_IO *)AllocMem(sizeof(struct XPR_IO),MEMF_PUBLIC | MEMF_CLEAR))) {
puttekn("\r\n\nKunde inte allokera en io-struktur\r\n",-1);
CloseLibrary(XProtocolBase);
return(2);
}
puttekn("\r\nDu kan börja ta emot med Zmodem.\r\n",-1);
puttekn("Tryck Ctrl-X några gånger för att avbryta.\r\n",-1);
AbortIO((struct IORequest *)serreadreq);
WaitIO((struct IORequest *)serreadreq);
if(!CheckIO((struct IORequest *)inactivereq)) {
AbortIO((struct IORequest *)inactivereq);
WaitIO((struct IORequest *)inactivereq);
}
xpr_setup(xio);
xio->xpr_filename=zinitstring;
XProtocolSetup(xio);
xio->xpr_filename="Hejhopp";
xprreturkod=XProtocolSend(xio);
Delay(30);
XProtocolCleanup(xio);
CloseLibrary(XProtocolBase);
if(!CheckIO((struct IORequest *)serreadreq)) {
AbortIO((struct IORequest *)serreadreq);
WaitIO((struct IORequest *)serreadreq);
printf("Serreadreq avbruten!!\n");
}
if(!CheckIO((struct IORequest *)timerreq)) {
AbortIO((struct IORequest *)timerreq);
WaitIO((struct IORequest *)timerreq);
printf("Timerreq avbruten!!\n");
}
FreeMem(xio,sizeof(struct XPR_IO));
Delay(100);
serchangereq->IOSer.io_Command=CMD_CLEAR;
DoIO((struct IORequest *)serchangereq);
serchangereq->IOSer.io_Command=CMD_FLUSH;
DoIO((struct IORequest *)serchangereq);
serreqtkn();
updateinactive();
if(Servermem->cfg.logmask & LOG_SENDFILE) {
for(tf=(struct TransferFiles *)tf_list.mlh_Head; tf->node.mln_Succ; tf=(struct TransferFiles *)tf->node.mln_Succ)
if(tf->sucess) {
LogEvent(USAGE_LOG, INFO, "Skickar filen %s till %s",
tf->path, getusername(inloggad));
}
}
for(tf=(struct TransferFiles *)tf_list.mlh_Head; tf->node.mln_Succ; tf=(struct TransferFiles *)tf->node.mln_Succ)
if(tf->sucess) cnt++;
if(cnt==1) strcpy(outbuffer,"\n\n\rFörde över 1 fil.\n\n\r");
else sprintf(outbuffer,"\n\n\rFörde över %d filer.\n\n\r",cnt);
puttekn(outbuffer,-1);
return(0);
}
示例14: recbinfile
int recbinfile(char *dir) {
int xprreturkod;
char zmodeminit[100];
ulfiles = 0;
if(access(dir,0)) {
puttekn("\r\nDirectoryt finns inte!\r\n",-1);
return 2;
}
if(Servermem->cfg.diskfree != 0
&& !HasPartitionEnoughFreeSpace(dir, Servermem->cfg.diskfree)) {
puttekn("\r\nTyvärr, gränsen för hur full disken får bli har överskridits!\r\n",-1);
return 2;
}
if(Servermem->cfg.ar.preup2) {
sendautorexx(Servermem->cfg.ar.preup2);
}
sprintf(zmodeminit,"%s%s",zinitstring,dir);
if(!(XProtocolBase = (struct Library *) OpenLibrary("xprzmodem.library", 0L))) {
puttekn("\r\n\nKunde inte öppna xprzmodem.library!\r\n",-1);
return 2;
}
if(!(xio = (struct XPR_IO *)
AllocMem(sizeof(struct XPR_IO), MEMF_PUBLIC | MEMF_CLEAR))) {
puttekn("\r\n\nKunde inte allokera en io-struktur\r\n",-1);
CloseLibrary(XProtocolBase);
return 2;
}
NewList((struct List *)&tf_list);
puttekn("\r\nDu kan börja sända med Zmodem. Du kan nu skicka fler filer!",-1);
puttekn("\r\nTryck Ctrl-X några gånger för att avbryta.\r\n",-1);
AbortIO((struct IORequest *)serreadreq);
WaitIO((struct IORequest *)serreadreq);
if(!CheckIO((struct IORequest *)inactivereq)) {
AbortIO((struct IORequest *)inactivereq);
WaitIO((struct IORequest *)inactivereq);
}
xpr_setup(xio);
xio->xpr_filename = zmodeminit;
XProtocolSetup(xio);
xprreturkod = XProtocolReceive(xio);
Delay(30);
XProtocolCleanup(xio);
CloseLibrary(XProtocolBase);
if(!CheckIO((struct IORequest *)serreadreq)) {
AbortIO((struct IORequest *)serreadreq);
WaitIO((struct IORequest *)serreadreq);
printf("Serreadreq avbruten!!\n");
}
if(!CheckIO((struct IORequest *)timerreq)) {
AbortIO((struct IORequest *)timerreq);
WaitIO((struct IORequest *)timerreq);
printf("Timerreq avbruten!!\n");
}
FreeMem(xio,sizeof(struct XPR_IO));
Delay(100);
serchangereq->IOSer.io_Command=CMD_CLEAR;
DoIO((struct IORequest *)serchangereq);
serchangereq->IOSer.io_Command=CMD_FLUSH;
DoIO((struct IORequest *)serchangereq);
serreqtkn();
updateinactive();
if(Servermem->cfg.ar.postup2) {
sendautorexx(Servermem->cfg.ar.postup2);
}
if(ulfiles > 0) {
puttekn("\r\n\nÖverföringen lyckades.\r\n",-1);
return 0;
}
else {
puttekn("\r\n\nÖverföringen misslyckades.\r\n",-1);
return 2;
}
}
示例15: main
//.........这里部分代码省略.........
IntPrioritySet(INT_GPIOA, 0x00);
IntPrioritySet(INT_GPIOB, 0x00);
IntPrioritySet(INT_GPIOC, 0x00);
//
// Reset the interrupt flags.
//
g_ulGPIOa = 0;
g_ulGPIOb = 0;
g_ulGPIOc = 0;
g_ulIndex = 1;
//
// Trigger the interrupt for GPIO C.
//
HWREG(NVIC_SW_TRIG) = INT_GPIOC - 16;
//
// Put the current interrupt state on the LCD.
//
DisplayIntStatus();
//
// Verify that the interrupts were processed in the correct order.
//
if((g_ulGPIOa != 3) || (g_ulGPIOb != 2) || (g_ulGPIOc != 1))
{
ulError |= 1;
}
//
// Wait two seconds.
//
Delay(2);
//
// Indicate that the decreasing interrupt priority test is beginning.
//
RIT128x96x4StringDraw("Dec. Priority ", 18, 24, 15);
//
// Set the interrupt priorities so that they are decreasing (i.e. C > B >
// A).
//
IntPrioritySet(INT_GPIOA, 0x80);
IntPrioritySet(INT_GPIOB, 0x40);
IntPrioritySet(INT_GPIOC, 0x00);
//
// Reset the interrupt flags.
//
g_ulGPIOa = 0;
g_ulGPIOb = 0;
g_ulGPIOc = 0;
g_ulIndex = 1;
//
// Trigger the interrupt for GPIO C.
//
HWREG(NVIC_SW_TRIG) = INT_GPIOC - 16;
//
// Put the current interrupt state on the OLED.
//
DisplayIntStatus();