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


C++ enableInterrupts函数代码示例

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


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

示例1: main

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
  u8 l_cnt;
  disableInterrupts();
  Config();
  Errors_Init();
  enableInterrupts();
  Goto_HALT();
  
  while (1)
  {
    if((btn_pressed != BUTTON1) && (btn_pressed != BUTTON2))
    {
      DELAY_STOP;
      goto sleep;
    }
    
    while(!DELAY_EXPIRED);           // wait for power-up delay to expire (~20ms)
    DELAY_STOP;
    
    disableInterrupts();
    if(btn_pressed == BUTTON1)
    {
      RF_Send(RFCMD_HEATING_ON);
    }
    else if(btn_pressed = BUTTON2)
    {
      RF_Send(RFCMD_HEATING_OFF);
    }
    enableInterrupts();
    
    sleep:
    Goto_HALT();
  }
}
开发者ID:cristi85,项目名称:RemoteSwitch_v1,代码行数:40,代码来源:main.c

示例2: enableInterrupts

/*
 Function: Measures actual radiation value during specified time. Maximum time is 60 seconds
 Returns: 
	RadiationValueCPM: radiation value in CPM
 Parameters: 
	time: time while radiation is measured. Time must be in milliseconds
 Values: 
*/
float WaspRadiationBoard::getCPM(long time)
{

	float k=0;
	float minute = 60000;
	unsigned long previous=millis();

	enableInterrupts(RAD_INT);
	while( (millis()-previous<time) )
    {
		if( intFlag & RAD_INT)
		{
			disableInterrupts(RAD_INT);
			intFlag &= ~(RAD_INT);
			countPulse();

			while(!digitalRead(RAD_INT_PIN_MON));
    		enableInterrupts(RAD_INT);
  		}
    
    	// Condition to avoid an overflow (DO NOT REMOVE)
    	if( millis() < previous ) previous=millis();
    }
	k = (minute/time);
   	radiationValueCPM = k*count  ;
   	timePreviousMeassure = millis();
	ledBar(k*count);  
   	count = 0;

	return radiationValueCPM;
}
开发者ID:AppSaloon,项目名称:waspmoteapi,代码行数:39,代码来源:WaspSensorRadiation.cpp

示例3: main

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
   /* CLK configuration -------------------------------------------*/
  CLK_Config(); 

  /* Init TIM2 to generate 1 ms time base update interrupt */
  TimingDelay_Init();

  /* Enable Interrupts */
  enableInterrupts();

  /* Initialize LEDs mounted on STM8L152X-EVAL board */
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);

  /* Turn on LED1 and LED3 */
  STM_EVAL_LEDOn(LED1);
  STM_EVAL_LEDOn(LED3);

  /* Initialize push-buttons mounted on STM8L152X-EVAL board */
  STM_EVAL_PBInit(BUTTON_RIGHT, BUTTON_MODE_EXTI);
  STM_EVAL_PBInit(BUTTON_LEFT, BUTTON_MODE_EXTI);
  STM_EVAL_PBInit(BUTTON_UP, BUTTON_MODE_EXTI);
  STM_EVAL_PBInit(BUTTON_DOWN, BUTTON_MODE_EXTI);

  /* Init the Eval board LCD */
  STM8_EVAL_LCD_Init();

  /* Clear LCD */
  LCD_Clear();

  /* Enable general interrupts */
  enableInterrupts();

  LCD_SetCursorPos(LCD_LINE1, 0);
  LCD_Print("  System Clock  ");
  LCD_SetCursorPos(LCD_LINE2, 0);
  LCD_Print("  Source:  HSE  ");

  while (1)
  {
    /* Toggle LED2 and LED4 */
    STM_EVAL_LEDToggle(LED2);
    STM_EVAL_LEDToggle(LED4);

    /* Insert a delay */
    Delay(10);

    /* Toggle LED1 and LED3 */
    STM_EVAL_LEDToggle(LED1);
    STM_EVAL_LEDToggle(LED3);

    /* Insert a delay */
    Delay(10);
  }
}
开发者ID:glockwork,项目名称:ev-stm8l151k6-emotor,代码行数:63,代码来源:main.c

示例4: timer4_init

void timer4_init ()
{
  timer4.setPsc (Btimer::div128);
  timer4.setArr (125);
  enableInterrupts();
  timer4.interrupt (true);
  enableInterrupts();
  timer4.start ();
}
开发者ID:creator83,项目名称:stm8s003,代码行数:9,代码来源:irda.cpp

示例5: main

int main()
{
	
	// Chip errata
	CHIP_Init();
	
	// ensure core frequency has been updated
	SystemCoreClockUpdate();
	
	// start clocks
	initClocks();
		
	// init LEDs
	LED_Init();
	
	// init scheduler
	SCHEDULER_Init();
	
	// enable timers
	enableTimers();
	
	// enable interrupts
	enableInterrupts();
	
	// init tasks
	SCHEDULER_TaskInit(&radio_task, radio_task_entrypoint);
	
	// run
	SCHEDULER_Run();
	
}
开发者ID:phuonglab,项目名称:CM3-Scheduler,代码行数:31,代码来源:main.c

示例6: UART1_Config

/**
  * @brief  Configure UART1 for the communication with HyperTerminal
  * @param  None
  * @retval None
  */
static void UART1_Config(void)
{
  /* EVAL COM (UART) configuration -----------------------------------------*/
  /* USART configured as follow:
        - BaudRate = 115200 baud  
        - Word Length = 8 Bits
        - One Stop Bit
        - Odd parity
        - Receive and transmit enabled
        - UART Clock disabled
  */
  UART1_Init((uint32_t)115200, UART1_WORDLENGTH_8D,UART1_STOPBITS_1, UART1_PARITY_ODD,
                   UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE);

  /* Enable the UART Receive interrupt: this interrupt is generated when the UART
    receive data register is not empty */
  UART1_ITConfig(UART1_IT_RXNE_OR, ENABLE);
  
  /* Enable the UART Transmit complete interrupt: this interrupt is generated 
     when the UART transmit Shift Register is empty */
  UART1_ITConfig(UART1_IT_TXE, ENABLE);

  /* Enable UART */
  UART1_Cmd(ENABLE);
  
    /* Enable general interrupts */
  enableInterrupts();
}
开发者ID:edosedgar,项目名称:stm8s,代码行数:33,代码来源:main.c

示例7: TSL_Timer_Adjust

/**
  ******************************************************************************
  * @brief Modify the tick values for specific cases when the H/W timer doesn't
  * work (halt, ...).
  * @param [in] Delay Time to add to the ticks (unit is 500 us). Range is [1..65535].
  * @retval void None
  * @par Required preconditions:
  * None
  ******************************************************************************
  */
void TSL_Timer_Adjust(u16 Delay)
{

  disableInterrupts();

  do
  {
    if (Delay > TICK_FACTOR_10MS) /* delay > 10ms */
    {
      TSL_Tick_Base += TICK_FACTOR_10MS;
      Delay -= TICK_FACTOR_10MS;
      TSL_Timer_Check_10ms_Tick();
    }
    else
    {
      TSL_Tick_Base++;
      Delay--;
      TSL_Timer_Check_10ms_Tick();
    }
  }
  while ( Delay );

  enableInterrupts();
  
}
开发者ID:Apocaliptis,项目名称:Matrix,代码行数:35,代码来源:STM8_TSL_RC_TimerDriver.c

示例8: while

/*
 Function: Measures actual radiation value during specified time. Maximum measure time is 60 seconds
 Returns: 
	radiationValue: Returns value of radiation in uSv/H
 Parameters: 
	time: time while radiation is measured. Time units must be milliseconds
 Values: 
*/
float WaspSensorRadiation::getRadiation(long time){

	float k=0;      //used to obtain CPM
	float minute = 60000;
	long previous=millis();
	
	while( (millis()-previous<time) )
    {
		if( intFlag & RAD_INT){
			disableInterrupts(RAD_INT);
			intFlag &= ~(RAD_INT);
			countPulse();

			while(!digitalRead(RAD_INT_PIN_MON));
    			enableInterrupts(RAD_INT);
  		}
    
    	// Condition to avoid an overflow (DO NOT REMOVE)
    	if( millis()-previous < 0 ) previous=millis();
    }
     	
	k = (minute/time);
	radiationValueCPM = k*count;
   	radiationValue = k*count * CONV_FACTOR;
   	timePreviousMeassure = millis();
	ledBar(k*count);  
   	count = 0;

	return radiationValue;
}
开发者ID:EichenbergerFabrice,项目名称:waspmote-api-v.030,代码行数:38,代码来源:WaspSensorRadiation.cpp

示例9: main

int main() {
    SYSTEMConfigPerformance(10000000);    //Configures low-level system parameters for 10 MHz clock
    enableInterrupts();                   //This function is necessary to use interrupts.

    //TODO: Write each initialization function
    initLEDs();
    initTimer1();



    while(1) {

        switch(state) {
        case led1:
            LATDbits.LATD0 = ON;
            LATDbits.LATD1 = OFF;
            LATDbits.LATD2 = OFF;
            break;
        case led2:
            LATDbits.LATD0 = OFF;
            LATDbits.LATD1 = ON;
            LATDbits.LATD2 = OFF;
            break;
        case led3:
            LATDbits.LATD0 = OFF;
            LATDbits.LATD1 = OFF;
            LATDbits.LATD2 = ON;
            break;
        }

    }

    return 0;
}
开发者ID:lukesmeilus,项目名称:Lab0.X,代码行数:34,代码来源:main.c

示例10: TSL_Init

/**
  ******************************************************************************
  * @brief Initialize memory API and structures.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * Must be run once in the main function during initialization phase.
  ******************************************************************************
  */
void TSL_Init(void)
{

  disableInterrupts();

  DetectionIntegrator = DETECTION_INTEGRATOR_DEFAULT;
  EndDetectionIntegrator = END_DETECTION_INTEGRATOR_DEFAULT;
  ECSTimeStep = ECS_TIME_STEP_DEFAULT;
  ECSTemporization = ECS_TEMPO_DEFAULT;
  RecalibrationIntegrator = RECALIBRATION_INTEGRATOR_DEFAULT;
  DetectionTimeout = DTO_DEFAULT;

  ECS_K_Fast = ECS_IIR_KFAST_DEFAULT;
  ECS_K_Slow = ECS_IIR_KSLOW_DEFAULT;
  ECSTimeStepCounter = ECSTimeStep;
  ECSTempoCounter = 0;
  ECSTempoPrescaler = 0;

  TSL_IO_Init();

  TSL_Timer_Init();
  
  TSL_SCKey_Init();
  
#if NUMBER_OF_MULTI_CHANNEL_KEYS > 0
  TSL_MCKey_Init();
#endif

  enableInterrupts();

  TSLState = TSL_IDLE_STATE;

}
开发者ID:Ivaan,项目名称:DIY-ICDW-RCTX,代码行数:43,代码来源:STM8_TSL_RC_API.c

示例11: main

int main() {
	bool newreadings;
	bool buttonschanged;

	load_init();
	initsystem();
	watchdog_init();
	initserial();
	timer_init();
	display_init();
	initfan();
	adc_init();

	buttons_init();

	enableInterrupts();

	protocol_onbooted();

	while (1) {
		watchdog_kick();
		newreadings = adc_updatereadings();
		if (newreadings) {
			checkstate();
		}
		buttonschanged = buttons_check();
		if (newreadings || buttonschanged) {
			protocol_sendstate();
			display_update();
		}

		protocol_checkcommand();
	}
}
开发者ID:fifteenhex,项目名称:openebdmini,代码行数:34,代码来源:openebdmini.c

示例12: mcs_turn

void mcs_turn(int32_t a)
{
  /* a the angle in degrees */

  /* degrees to ticks */
  uint32_t enc = (abs(a) * 10) / 37 - 3;

  disableInterrupts();

  /* turn left or right */
  if (a < 0)
  {
    ldir = 0;
    rdir = 1;
  }
  else
  {
    ldir = 1;
    rdir = 0;
  }

  do_encoder(enc);

  enableInterrupts();
}
开发者ID:texane,项目名称:probot128,代码行数:25,代码来源:mcs.c

示例13: mcs_move

void mcs_move(int32_t d)
{
  /* d the distance in cms */

  /* convert distance to tick */
  uint32_t enc = abs(d) * CONFIG_TICK_PER_CM;

  disableInterrupts();

  /* forward or backward direction */
  if (d < 0)
  {
    ldir = 0;
    rdir = 0;
  }
  else
  {
    ldir = 1;
    rdir = 1;
  }

  do_encoder();

  enableInterrupts();
}
开发者ID:texane,项目名称:probot128,代码行数:25,代码来源:mcs.c

示例14: main

int main() 
{
    enableInterrupts();
    initTMR2();
    char key = 'x';
    
    while(1);
    {
       clearLCD();
       InitKeyPad();
       
       switch(state)
       {
           case findKey:
               ScanKeys(); //should i update the key value here?
               break;
           case debouncePress:
               delayUs(5000); //Proper Delay?
               break;
           case debounceRelease:
               delayUs(5000);
               break;
           case display:
               printCharLCD(key);
               break;
       }
    }
    
}
开发者ID:jaredguglielmo,项目名称:Lab2_1,代码行数:29,代码来源:main.c

示例15: TIM2_IRQHandler

void TIM2_IRQHandler(void)
{
  /* 10hz frequency */

  /* todo: reduce the scope by capturing variables */
  disableInterrupts();

  /* forward */
  if ((dir != 1) || (speed <= 0)) goto on_done;

  if (lenc < speed) lpwm += 2; /* I_up */
  else if (lenc > speed) lpwm -= 2;

  if (renc < speed) rpwm += 2;
  else if (renc > speed) rpwm -= 2;

  err = clamp(err + lenc - renc, -128, 128);

  /* reset encoder counters */
  lenc = 0;
  renc = 0;

  lpwm = clamp(CONFIG_START_POWER_FWD + lpwm - err, 0, 255);
  rpwm = clamp(CONFIG_START_POWER_FWD + rpwm - err, 0, 255);

  set_lpwm(lpwm);
  set_rpwm(rpwm);

 on_done:
  TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
  enableInterrupts();
}
开发者ID:texane,项目名称:probot128,代码行数:32,代码来源:mcs.c


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