当前位置: 首页>>代码示例>>C++>>正文


C++ SysTick_Init函数代码示例

本文整理汇总了C++中SysTick_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ SysTick_Init函数的具体用法?C++ SysTick_Init怎么用?C++ SysTick_Init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SysTick_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void){
	DisableInterrupts();
  TExaS_Init(SSI0_Real_Nokia5110_Scope);  // set system clock to 80 MHz
	Random_Init(1);
  Nokia5110_Init();
	PF1Init();
  //SysTick_Init(2666666); //Initialize SysTick with 30 Hz interrupts
	SysTick_Init(2666666*4); //Increased period by 4 for actual hardware to make the game run at a playable speed
  Nokia5110_ClearBuffer();
	Nokia5110_DisplayBuffer();      // draw buffer
	ADC0_Init();
	Game_Init();
	SwitchLed_Init();
	Sound_Init();
	Timer2_Init(&Sound_Play,7256); //11.025 kHz. 80,000,000/11,025 cycles, which is about 7256
	GameOverFlag = 0;
	EnableInterrupts();
	
  while(1){
		while(Semaphore==0){};
    Semaphore = 0;
		if(GameOverFlag){
			State_GameOver();
		}
		else{
			Draw_GameFrame(); // update the LCD
		}	
		if((GameOverFlag == 0) && (Check_GameOver())){ //just detected game over
			Delay100ms(2);//Delay 200ms
			GameOverFlag = Check_GameOver();
			//SysTick_Init(2666666);//Re-initialize with 30 Hz interrupt
			SysTick_Init(2666666*4); //Increased period by 4 for actual hardware to make the game run at a playable speed
		}
	}
}
开发者ID:AbdallahNasser,项目名称:Space_Invaders_TivaC,代码行数:35,代码来源:SpaceInvaders.c

示例2: main

// *************************** Capture image dimensions out of BMP**********
int main(void){
  TExaS_Init(SSI0_Real_Nokia5110_Scope);  // set system clock to 80 MHz
  Output_Init();
	ADC0_Init();
	DAC_Init();
	SysTick_Init();
	Menu_Init();
	Sound_Init();
	UART1_Init();
	
	Button0_Init();
	Timer0_Init(Play, 80000000/11025);	// 11.025 kHz 80000000/11025
	Timer1_Init(Master_Funk,  80000000/60);
	//Timer2_Init(SomeUART function, high speed); //for UART

 /* ST7735_FillScreen(0x0000);            // set screen to black
  ST7735_SetCursor(1, 1);
  ST7735_OutString("GAME OVER");
  ST7735_SetCursor(1, 2);
  ST7735_OutString("Nice try,");
  ST7735_SetCursor(1, 3);
  ST7735_OutString("Earthling!");
  ST7735_SetCursor(2, 4);
  LCD_OutDec(1234);	 */
  while(1){							
  } 
}
开发者ID:mkogerd,项目名称:School-Projects,代码行数:28,代码来源:Tag.c

示例3: LCD_Init

// Initialize LCD
// Inputs: none
// Outputs: none
void LCD_Init(void){ 
  SYSCTL_RCGC2_R |= 0x00000003;  // 1) activate clock for Ports A and B
  while((SYSCTL_PRGPIO_R&0x03) != 0x03){};// ready?
  GPIO_PORTB_AMSEL_R &= ~0xFF;   // 3) disable analog function on PB7-0
  GPIO_PORTA_AMSEL_R &= ~0xC0;   //    disable analog function on PA7-6              
  GPIO_PORTB_PCTL_R = 0x00000000;   // 4) configure PB7-0 as GPIO   
  GPIO_PORTA_PCTL_R &= ~0xFF000000; //    configure PA7-6 as GPIO
  GPIO_PORTB_DIR_R = 0xFF;       // 5) set direction register
  GPIO_PORTA_DIR_R |= 0xC0;
  GPIO_PORTB_AFSEL_R = 0x00;     // 6) regular port function
  GPIO_PORTA_AFSEL_R &= ~0xC0;
  GPIO_PORTB_DEN_R = 0xFF;       // 7) enable digital port
  GPIO_PORTA_DEN_R |= 0xC0;
  GPIO_PORTB_DR8R_R = 0xFF;      // enable 8 mA drive
  GPIO_PORTA_DR8R_R |= 0xC0;
  SysTick_Init();       // Volume 1 Program 4.7, Volume 2 Program 2.10
  LCDCMD = 0;           // E=0, R/W=0, RS=0
  SysTick_Wait(T15ms);  // Wait >15 ms after power is applied
  OutCmd(0x30);         // command 0x30 = Wake up
  SysTick_Wait(T5ms);   // must wait 5ms, busy flag not available
  OutCmd(0x30);         // command 0x30 = Wake up #2
  SysTick_Wait(T160us); // must wait 160us, busy flag not available
  OutCmd(0x30);         // command 0x30 = Wake up #3
  SysTick_Wait(T160us); // must wait 160us, busy flag not available
  OutCmd(0x38);         // Function set: 8-bit/2-line
  OutCmd(0x10);         // Set cursor
  OutCmd(0x0C);         // Display ON; Cursor ON
  OutCmd(0x06);         // Entry mode set
}
开发者ID:liulvcong,项目名称:EE445L,代码行数:32,代码来源:lcd.c

示例4: main

/**
  * @brief  主函数
  * @param  无  
  * @retval 无
  */
int main(void)
{	
	/* LED 端口初始化 */
	LED_GPIO_Config();	
	
	/* 初始化触屏 */
	Touch_Init();
	
	/* 初始化定时器 */
	SysTick_Init();
	
	/*CRC和emWin没有关系,只是他们为了库的保护而做的,这样STemWin的库只能用在ST的芯片上面,别的芯片是无法使用的。 */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
	
	/* 初始化GUI */
	GUI_Init();
	
	/* 初始化串口*/
	USART1_Config();
	
	DEBUG("\r\n wildfire ISO board emWin test \r\n");
	
	GUI_Delay (20);
	
	/* 触摸校准demo */
	Touch_MainTask();

}
开发者ID:WildfireTeamPRJ,项目名称:wildfire_stm32_emWin,代码行数:33,代码来源:main.c

示例5: main

int main(void){
//Initialize all below:
	TExaS_Init();       // Bus clock is 80 MHz 
	ADC_Init();    			// initialize to sample ADC1
	ST7735_InitR(INITR_REDTAB);
	SysTick_Init();		
	UART_Init();
	FiFo_Init();
  PortF_Init();
	EnableInterrupts();
	
	while(1){
		while(ADCStatus == 0){};	//Poll ADCStatus flag 
		ADCStatus = 0;						//clear flag
		//Prints from a full FIFO --> BUT must know when 
		//we get to the end 			--> uses while loop to check this condition,
		//and a for loop to print 5 times
		ST7735_SetCursor(6,5);
		//Infinite loop if the fifo is empty / if returns fail
		while (FiFo_Get(&data) == 0) {};
		FiFo_Get(&data);
		for(int i = 1; i <= 5; i++){
			ST7735_OutChar(data);
			FiFo_Get(&data);
		}
		FiFo_Get(&data);
		FiFo_Get(&data);		
		ST7735_SetCursor(12,5);
		ST7735_OutString(" cm");	// print " cm"
	}

}
开发者ID:megancooper,项目名称:EE-319k,代码行数:32,代码来源:Lab9.c

示例6: main

int main(void)
{
	unsigned int nCount;
	unsigned char vEncoder[20]="--------------------";
	int i;
  RCC_Configuration();
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
	NVIC_Configuration();
		EXTI_Configuration();
  USART1_Init();
	USART2_Init();															
	USART3_Init();
	UART4_Init();
	UART5_Init();
	SPI2_Init();
	SysTick_Init();
	//init_NRF24L01();
	RX_Mode();
	//nRF24L01_ISR();
	
  while(1)
{

	//Serial_PutString("While ");


}
}	 
开发者ID:liuning587,项目名称:Thingsquare-Contiki-O.S-Porting-STM32F4-Discovery,代码行数:28,代码来源:nRF24L01.c

示例7: EXTI4_IRQHandler

void EXTI4_IRQHandler(void)
{
	//USART1_printf(USART2, "%d\r\n",TIM2->CNT);
	//启动自动完成编码器角度标定  (由于转向电机不能很好的伺服,故该操作效果不明显)
	#ifdef Startup
	if (!Start_Due)
	{
		zero = TIM2->CNT; 
		Car_Turn(0); 
		SysTick_Init(72); 
		Start_Due = 1;
		Delay(0xF);
		Car_Turn_Angle(0);   //回零点
	}
	else
	{
		TIM2 -> CNT = zero;   //自动标0,防止编码器发生偏移
	}
	#endif 

	#ifndef Startup
	//TIM2 -> CNT = zero;    //手动标定
	#endif

	EXTI_ClearITPendingBit(EXTI_Line4);
}
开发者ID:jeasinema,项目名称:SkyHERE,代码行数:26,代码来源:encoder.c

示例8: main

int main(void){ 
  volatile unsigned long delay;
	//TExaS_Init(ADC0_AIN1_PIN_PE2, SSI0_Real_Nokia5110_NoScope);
  TExaS_Init(ADC0_AIN1_PIN_PE2, SSI0_Real_Nokia5110_Scope);
	ADC0_Init();    											// initialize ADC0, channel 1, sequencer 3
  Nokia5110_Init();											// initialize Nokia5110 LCD
	SysTick_Init(1999999);								// initialize SysTick for 40 Hz interrupts
	// initialize profiling on PF1 (optional)
	//    wait for clock to stabilize
	SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOF; // activate port F
  delay = SYSCTL_RCGC2_R;
  GPIO_PORTF_DIR_R |= 0x04;             // make PF2 out (built-in LED)
  GPIO_PORTF_AFSEL_R &= ~0x04;          // disable alt funct on PF2
  GPIO_PORTF_DEN_R |= 0x04;             // enable digital I/O on PF2
                                        // configure PF2 as GPIO
  GPIO_PORTF_PCTL_R = (GPIO_PORTF_PCTL_R&0xFFFFF0FF)+0x00000000;
  GPIO_PORTF_AMSEL_R = 0;               // disable analog functionality on PF
  EnableInterrupts();
	Nokia5110_Clear();
	Nokia5110_OutString((unsigned char *)"UT.6.01x Lab 14 Start");
  while(1){ 
		if(Flag) {
			UART_ConvertDistance(Distance);
			Nokia5110_SetCursor(0, 3);			
			Nokia5110_OutString(String);
			Flag = 0;
		}			
  }
}
开发者ID:f-guerra,项目名称:UT.6.01x,代码行数:29,代码来源:MeasurementOfDistance.c

示例9: Music_Play

void Music_Play(const unsigned short *instrument, int instrumentSize, const struct Songs* song, int songSize){
		int noteIndex=0;
		int i=0;
		int pause=0;	
	
	while(1){
		if(play){
			pause=1-pause;
			resetSwitches();
		}
		if(rewind||mode){
			break;
		}
		if(lenPush&&!pause){
			Timer0A_Init(song->duration[noteIndex]);
			SysTick_Init(402000/(song->notes[noteIndex]));
			noteIndex=(noteIndex+1)%songSize;
		}
		if(notePush&&!pause){
			notePush=0;
			DAC_Out(instrument[i]);
			i=(i+1)%instrumentSize;
		}
	}

	/*
	//in class he mentioned something about having to layer two interrupts ontop of each other and how that can help, we may 
	//have to do something with that. I plan on asking the TA's about it tomorrow.
		DAC_Out(song->notes[Time&0x1F] + instrument[Time&0x1F]);
	//	DAC_Out(song->notes[Time&0x1F]);
	//	DAC_Out(instrument[Time&0x1F]);
    Time = Time + 1;
		SysTick_Wait(song->duration[Time&0x1F]);
	*/
}
开发者ID:manavm,项目名称:Classes,代码行数:35,代码来源:Music.c

示例10: main

int main(void){
  TExaS_Init();         // Bus clock is 80 MHz 
  ST7735_InitR(INITR_REDTAB); 
  PortF_Init();
  ADC_Init();         // turn on ADC, set channel to 1
  SysTick_Init();			//Initialize SysTick
  for(;;){
	  while(ADCStatus == 0){}	//Poll ADCStatus flag 
	  uint32_t x = ADCMail;		//read ADCMail (input)
	  ADCStatus = 0;			//clear flag
	  x = Convert(x);			//convert the input
	  ST7735_SetCursor(1,7);		
    ST7735_OutString("D = "); 	//print "D = "
    ST7735_SetCursor(5,7);
    LCD_OutFix(x);				// print the fixed point value 
		ST7735_SetCursor(10,7);	
		ST7735_OutString(" cm");	// print " cm"
		/////////////////////
		ST7735_SetCursor(1,2);
			ST7735_OutString("Lab 8:");	
		ST7735_SetCursor(1,3);
		ST7735_OutString("Measurment of");
		ST7735_SetCursor(1,4);
		ST7735_OutString("Distance :)");
		
			
	}
	
}
开发者ID:AriaPahlavan,项目名称:C-Projects-EE319K-Spring2015,代码行数:29,代码来源:Lab8.c

示例11: main

/**
  * @brief  主函数
  * @param  无  
  * @retval 无
  */
int main(void)
{	
	/* 系统定时器 1us 定时初始化 */
  SysTick_Init();
  
  LCD_Init();	
  /* GRAM扫描方向为左下脚->右上角 */
  Lcd_GramScan(2);
  LCD_Clear(0, 0, 320, 240, BACKGROUND);
  
/*------------------------------------------------------------------------------------------------------*/
  
  /* 触摸屏IO和中断初始化 */
  Touch_Init();
  
  /* 等待触摸屏校正完毕 */
  while(Touch_Calibrate() !=0);
  
  /* 触摸取色板初始化 */
  Palette_Init();
  
	while( 1 )
  {
    if(touch_flag == 1)			/*如果触笔按下了*/
    {
      /*获取点的坐标*/
      if(Get_touch_point(&display, Read_2046_2(), &touch_para ) !=DISABLE)      
      {					
        Palette_draw_point(display.x,display.y);	 										
      }
    }		
  }
}
开发者ID:WildfireTeamPRJ,项目名称:wildfire_stm32_iso,代码行数:38,代码来源:main.c

示例12: main

int main(void)
{
	SysTick_Init();

	RCC_Init();
  
	USART2_Init();
	
	InitRF();
	
	Tag_Init();
	
	//send_alive_cmd_to_master();
   
	IWDG_Init();
	
   while(1)
   {			 
		if(sysTime1ms % 50 == 0) 
		{
			Feed_IWDG();
		}
		
     usart_msg_handle();
		 if(tag_check_flag)
		 {
			 Tag_state_check();
			 tag_check_flag = 0;
		 }
		 SendWakeMsg();
   }
}
开发者ID:wangxubo1988,项目名称:smart_tag,代码行数:32,代码来源:main.c

示例13: main

int main(void) {volatile unsigned long delay;
SysTick_Init();
SYSCTL_RCGC2_R |= 0x32;      // 1) B E
  delay = SYSCTL_RCGC2_R;      // 2) no need to unlock
  GPIO_PORTE_AMSEL_R &= ~0x07; // 3) disable analog function on PE1-0
  GPIO_PORTE_PCTL_R &= ~0x00000FFF; // 4) enable regular GPIO
  GPIO_PORTE_DIR_R &= ~0x07;   // 5) inputs on PE1-0
  GPIO_PORTE_AFSEL_R &= ~0x07; // 6) regular function on PE1-0
  GPIO_PORTE_DEN_R |= 0x07;    // 7) enable digital on PE1-0
	
  GPIO_PORTB_AMSEL_R &= ~0x3F; // 3) disable analog function on PB5-0
  GPIO_PORTB_PCTL_R &= ~0x00FFFFFF; // 4) enable regular GPIO
  GPIO_PORTB_DIR_R |= 0x3F;    // 5) outputs on PB5-0
  GPIO_PORTB_AFSEL_R &= ~0x3F; // 6) regular function on PB5-0
  GPIO_PORTB_DEN_R |= 0x3F;    // 7) enable digital on PB5-0
	
	GPIO_PORTF_LOCK_R = 0x4C4F434B;   // 2) unlock GPIO Port F
  GPIO_PORTF_CR_R = 0x1F;           // allow changes to PF4-0
	GPIO_PORTF_AMSEL_R &= ~0x0A;
	GPIO_PORTF_PCTL_R &= ~0x000FFF0;
	GPIO_PORTF_DIR_R |= 0x0A;
	GPIO_PORTF_AFSEL_R &= ~0x0A;
	GPIO_PORTF_DEN_R |= 0x0A;
	
  S = goN;  
  while(1){
    LIGHT = FSM[S].Out;  // set lights
		PED_LIGHT = FSM[S].Out2;
    SysTick_Wait10ms(FSM[S].Time);
    Input = SENSOR;     // read sensors
    S = FSM[S].Next[Input];  
  }
}
开发者ID:dbadami,项目名称:UT.6.01x,代码行数:33,代码来源:TableTrafficLight.c

示例14: init

}

void init() {
	volatile unsigned long delay;

	SYSCTL_RCGC2_R |= 0x32;           // Port B,E,F clock
	delay = SYSCTL_RCGC2_R;           // wait 3-5 bus cycles

	SysTick_Init();

	GPIO_PORTB_DIR_R |= MASK_PORTB;
	GPIO_PORTB_AFSEL_R &= ~MASK_PORTB;      	// not alternative
	GPIO_PORTB_AMSEL_R &= ~MASK_PORTB;      	// no analog
	GPIO_PORTB_PCTL_R &= ~0x00FFFFFF;
	GPIO_PORTB_DEN_R |= MASK_PORTB;

	GPIO_PORTE_DIR_R &= ~MASK_PORTE;       //PE0-2 Inputs
	GPIO_PORTE_AFSEL_R &= ~MASK_PORTE;
	GPIO_PORTE_AMSEL_R &= ~MASK_PORTE;      // no analog
	GPIO_PORTE_PCTL_R &= ~0x00000FFF; // bits for PD3, PD0
	GPIO_PORTE_DEN_R |= MASK_PORTE;         // enable PD3, PD0

	GPIO_PORTF_DIR_R |= MASK_PORTF;         // PD3 output
	GPIO_PORTF_AFSEL_R &= ~MASK_PORTF;      // not alternative
	GPIO_PORTF_AMSEL_R &= ~MASK_PORTF;      // no analog
	GPIO_PORTF_PCTL_R &= ~0x0000F0F0; // bits for PD3, PD0
开发者ID:johnmerm,项目名称:eletronics,代码行数:26,代码来源:TableTrafficLight.c

示例15: SysTick_10ms_wait

// Time delay using busy wait.
// This assumes 50 MHz system clock.
void SysTick_10ms_wait(unsigned long delay){
  unsigned long i;
	SysTick_Init(500000);
  for(i=0; i<delay; i++){
    SysTick_Wait(500000);  // wait 10ms (assumes 50 MHz clock)
  }
}
开发者ID:VincentSteil,项目名称:lm3s1968-Alarm-Clock,代码行数:9,代码来源:personalSysTick.c


注:本文中的SysTick_Init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。