• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ INT_Enable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

//--------------------------------------------------------------------------------
int main(void) {	
	
	/* Init System Timer to fire interrupts at 1ms - timer tick */
	OCR0		= 125;	  		 			// set output compare match register, timer tick 1ms
	TCCR0		= (1 << WGM01) + (1 << CS02) + (1 << CS00);	//clear on compare match mode, Fclk/128 
	TIMSK		|= (1 << OCIE0); // enable output compare 2 interrupt
	TCNT0		= 0x00;	 		 // clear timer2 register
						
	uSMARTX_Init(uSmartXTaskTable);
	
	/*	Append timeout trigger function. The trigger function will be executed after
	 *	there is no write/read access if the buffer contains some unread data.
	 */
	BUF_AppendToutFxn(&BUF, 10 /*10 ms*/, &TimeoutFxn);
	
	/*	Append level trigger function. The trigger function will be executed after
	 *	the buffer fills to a level of 4. The function will be re-triggered after the
	 *	buffer is completely emptied out.
	 */
	BUF_AppendTrgFxn(&BUF, 4, &TriggerFxn);
	
	/* Enable interrupts. */
	INT_Enable();
	
	while(1) {	
		if(uSMARTX_Scheduler() == SYS_ERROR)
			break;
	}

	/* Handle error here. */

	return 0;
}
开发者ID:morsvolia,项目名称:usmartx,代码行数:34,代码来源:buffer.c


示例2: service_net

void
service_net ()
{
	while (interrupts > 0)
	{
		NRF_CE_lo;
		uint8_t status = NRF_ReadRegister(NRF_STATUS);
		RXEN_lo;
	        // received a packet
	        if (status & 0x40)
     	   	{                
			printf("Radio received a packet\n");
		 	readPacket();
        	} else if (status & 0x20)
        	{ // packet was sent
                	printf("Radio successfully sent the packet\n");
         		NRF_WriteRegister(NRF_STATUS, 0x10);
		} else if (status & 0x10)
         	{ // packet failed to send              
			printf("Radio failed to send the packet\n");
			NRF_WriteRegister(NRF_STATUS, 0x20);
         	}
		RXEN_hi;
		NRF_CE_hi;
		INT_Disable();
		interrupts--;
		INT_Enable();
	}
}	
开发者ID:wiktor-b,项目名称:slip-b,代码行数:29,代码来源:net.c


示例3: sleepUntilDmaDone

/**************************************************************************//**
 * @brief  Sleep in EM1 until DMA transfer is done
 *****************************************************************************/
void sleepUntilDmaDone(void)
{
  /* Enter EM1 while DMA transfer is active to save power. Note that
   * interrupts are disabled to prevent the ISR from being triggered
   * after checking the transferActive flag, but before entering
   * sleep. If this were to happen, there would be no interrupt to wake
   * the core again and the MCU would be stuck in EM1. While the 
   * core is in sleep, pending interrupts will still wake up the 
   * core and the ISR will be triggered after interrupts are enabled
   * again. 
   */ 

    
    bool isActive = false;

    while(1)
    {
        INT_Disable();
        isActive = spiDmaIsActive();
        if ( isActive )
        {
            EMU_EnterEM1();
        }
        INT_Enable();

        // Exit the loop if transfer has completed
        if ( !isActive )
        {
            DPRINT("SPI DONE");
            break;
        }
    }
}
开发者ID:jarryd,项目名称:dash7-ap-open-source-stack,代码行数:36,代码来源:efm32hg_spi.c


示例4: RTCDRV_TimeRemaining

/***************************************************************************//**
 * @brief
 *    Get time left before a given timer expires.
 *
 * @param[in] id The id of the timer to query.
 *
 * @param[out] timeRemaining Time left expressed in milliseconds.
 *                        Only valid if return status is ECODE_EMDRV_RTCDRV_OK.
 * @return
 *    @ref ECODE_EMDRV_RTCDRV_OK on [email protected]
 *    @ref ECODE_EMDRV_RTCDRV_ILLEGAL_TIMER_ID if id has an illegal value. @n
 *    @ref ECODE_EMDRV_RTCDRV_TIMER_NOT_ALLOCATED if the timer is not [email protected]
 *    @ref ECODE_EMDRV_RTCDRV_TIMER_NOT_RUNNING if the timer is not [email protected]
 *    @ref ECODE_EMDRV_RTCDRV_PARAM_ERROR if an invalid timeRemaining pointer
 *         was supplied.
 ******************************************************************************/
Ecode_t RTCDRV_TimeRemaining( RTCDRV_TimerID_t id, uint32_t *timeRemaining )
{
  uint64_t tmp;
  uint32_t timeLeft, currentCnt, lastRtcStart;

  // Check if valid timer ID.
  if ( id >= EMDRV_RTCDRV_NUM_TIMERS ) {
    return ECODE_EMDRV_RTCDRV_ILLEGAL_TIMER_ID;
  }

  // Check pointer validity.
  if ( timeRemaining == NULL ) {
    return ECODE_EMDRV_RTCDRV_PARAM_ERROR;
  }

  INT_Disable();
  // Check if timer is reserved.
  if ( ! timer[ id ].allocated ) {
    INT_Enable();
    return ECODE_EMDRV_RTCDRV_TIMER_NOT_ALLOCATED;
  }

  // Check if timer is running.
  if ( ! timer[ id ].running ) {
    INT_Enable();
    return ECODE_EMDRV_RTCDRV_TIMER_NOT_RUNNING;
  }

  timeLeft     = timer[ id ].remaining;
  currentCnt   = RTC_COUNTERGET();
  lastRtcStart = lastStart;
  INT_Enable();

  // Get number of RTC clock ticks elapsed since last RTC reschedule.
  currentCnt = TIMEDIFF( currentCnt, lastRtcStart );

  if ( currentCnt > timeLeft ) {
    timeLeft = 0;
  } else {
    timeLeft -= currentCnt;
  }

  tmp = TICKS_TO_MSEC( timeLeft );
  *timeRemaining = tmp;

  return ECODE_EMDRV_RTCDRV_OK;
}
开发者ID:jacquestkirk,项目名称:WeatherBalloon,代码行数:63,代码来源:rtcdriver.c


示例5: unblockSleepMode

/** Unblock the microcontroller from sleeping below a certain mode
 *
 * This will unblock sleep() from entering an energy mode below the one given.
 * -- To be called by peripheral HAL's --
 *
 * This should be called after all transactions on a peripheral are done.
 */
void unblockSleepMode(sleepstate_enum minimumMode)
{
    INT_Disable();
    if(sleep_block_counter[minimumMode] > 0) {
        sleep_block_counter[minimumMode]--;
    }
    INT_Enable();
}
开发者ID:ARMmbed,项目名称:mbed-hal-silabs,代码行数:15,代码来源:sleep.c


示例6: RTCDRV_SetWallClock

/***************************************************************************//**
 * @brief
 *    Set wallclock time.
 *
 * @param[in] secs Value to set (seconds).
 *
 * @return
 *    @ref ECODE_EMDRV_RTCDRV_OK
 ******************************************************************************/
Ecode_t RTCDRV_SetWallClock( uint32_t secs )
{
  INT_Disable();
  wallClockTime     = secs;
  wallClockInitTime = RTC_COUNTERGET();
  INT_Enable();

  return ECODE_EMDRV_RTCDRV_OK;
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:18,代码来源:rtcdriver.c


示例7: memoryTakeReference

void memoryTakeReference(void *handle)
{
  INT_Disable();
  if(memoryPtrFromHandle(handle) != NULL)
  {
    memoryObjs[(uint32_t)handle].refCount++;
  }
  INT_Enable();
}
开发者ID:javier-moreno-tridonic-com,项目名称:mbed-os,代码行数:9,代码来源:buffer_pool_allocator.c


示例8: memoryFree

void memoryFree(void *handle)
{
  INT_Disable();
  if(memoryPtrFromHandle(handle) != NULL)
  {
    memoryObjs[(uint32_t)handle].refCount--;
  }
  INT_Enable();
}
开发者ID:javier-moreno-tridonic-com,项目名称:mbed-os,代码行数:9,代码来源:buffer_pool_allocator.c


示例9: GPIOINT_CallbackRegister

/***************************************************************************//**
 * @brief
 *   Registers user callback for given pin number.
 *
 * @details
 *   Use this function to register a callback which shall be called upon
 *   interrupt generated from given pin number (port is irrelevant). Interrupt
 *   itself must be configured externally. Function overwrites previously
 *   registered callback.
 *
 * @param[in] pin
 *   Pin number for the callback.
 * @param[in] callbackPtr
 *   A pointer to callback function.
 ******************************************************************************/
void GPIOINT_CallbackRegister(uint8_t pin, GPIOINT_IrqCallbackPtr_t callbackPtr)
{
  INT_Disable();

  /* Dispatcher is used */
  gpioCallbacks[pin] = callbackPtr;

  INT_Enable();
}
开发者ID:8bitgeek,项目名称:Espruino,代码行数:24,代码来源:gpiointerrupt.c


示例10: RTCDRV_StopTimer

/***************************************************************************//**
 * @brief
 *    Stop a given timer.
 *
 * @param[in] id The id of the timer to stop.
 *
 * @return
 *    @ref ECODE_EMDRV_RTCDRV_OK on [email protected]
 *    @ref ECODE_EMDRV_RTCDRV_ILLEGAL_TIMER_ID if id has an illegal value. @n
 *    @ref ECODE_EMDRV_RTCDRV_TIMER_NOT_ALLOCATED if the timer is not reserved.
 ******************************************************************************/
Ecode_t RTCDRV_StopTimer( RTCDRV_TimerID_t id )
{
  // Check if valid timer ID.
  if ( id >= EMDRV_RTCDRV_NUM_TIMERS ) {
    return ECODE_EMDRV_RTCDRV_ILLEGAL_TIMER_ID;
  }

  INT_Disable();
  if ( ! timer[ id ].allocated ) {
    INT_Enable();
    return ECODE_EMDRV_RTCDRV_TIMER_NOT_ALLOCATED;
  }

  timer[ id ].running = false;
  INT_Enable();

  return ECODE_EMDRV_RTCDRV_OK;
}
开发者ID:jacquestkirk,项目名称:WeatherBalloon,代码行数:29,代码来源:rtcdriver.c


示例11: DMADRV_Init

/***************************************************************************//**
 * @brief
 *  Initialize DMADRV.
 *
 * @details
 *  The DMA hw is initialized.
 *
 * @return
 *  @ref ECODE_EMDRV_DMADRV_OK on success. On failure an appropriate
 *  DMADRV @ref Ecode_t is returned.
 ******************************************************************************/
Ecode_t DMADRV_Init( void )
{
  int i;
#if defined( EMDRV_DMADRV_UDMA )
  DMA_Init_TypeDef dmaInit;
#elif defined( EMDRV_DMADRV_LDMA )
  LDMA_Init_t dmaInit = LDMA_INIT_DEFAULT;
  dmaInit.ldmaInitCtrlNumFixed = EMDRV_DMADRV_DMA_CH_PRIORITY;
#endif


  INT_Disable();
  if ( initialized )
  {
    INT_Enable();
    return ECODE_EMDRV_DMADRV_ALREADY_INITIALIZED;
  }
  initialized = true;
  INT_Enable();

  if ( EMDRV_DMADRV_DMA_IRQ_PRIORITY > 7 )
  {
    return ECODE_EMDRV_DMADRV_PARAM_ERROR;
  }

  for ( i=0; i < EMDRV_DMADRV_DMA_CH_COUNT; i++ )
  {
    chTable[ i ].allocated = false;
  }

#if defined( EMDRV_DMADRV_UDMA )
  NVIC_SetPriority( DMA_IRQn, EMDRV_DMADRV_DMA_IRQ_PRIORITY );
  dmaInit.hprot        = 0;
  dmaInit.controlBlock = dmaControlBlock;
  DMA_Init( &dmaInit );
#elif defined( EMDRV_DMADRV_LDMA )
  dmaInit.ldmaInitIrqPriority = EMDRV_DMADRV_DMA_IRQ_PRIORITY;
  LDMA_Init( &dmaInit );
#endif

  return ECODE_EMDRV_DMADRV_OK;
}
开发者ID:PW-Sat2,项目名称:PWSat2OBC,代码行数:53,代码来源:dmadrv.c


示例12: COM_WriteString

Ecode_t COM_WriteString(COM_Port_t port, PGM_P string)
{
  if (checkValidPort(port)==false)
  {
    return EMBER_ERR_FATAL;
  }
  uint8_t *fifohead= &comhandle[port]->txQueue->fifo[comhandle[port]->txQueue->head];
  uint8_t length = 0;
  uint8_t wraplength = 0;
  while(*string != '\0') {
    while (! getOutputFifoSpace(port, 0)) {};
    INT_Disable();
    FIFO_ENQUEUE(comhandle[port]->txQueue,*string,comhandle[port]->txsize);
    INT_Enable();
    string++;
    length++;
    // queue just wrapped
    if (comhandle[port]->txQueue->head == 0)
    {
      // store first transmit length
      wraplength = length;
      // transmit chunk      
      if ( (port == COM_USART0) || (port == COM_USART1) || (port == COM_USART2) )
      {
        while(UARTDRV_Transmit(comhandle[port]->uarthandle, fifohead, wraplength, unloadTxBuffer) != EMBER_SUCCESS);
      }
#ifdef COM_VCP_ENABLE
      if (port == COM_VCP)
      {
          emDebugSendVuartMessage(comhandle[port]->txQueue->fifo, comhandle[port]->txsize);
          dequeueFifoBuffer(port, comhandle[port]->txsize);
      }
#endif //COM_VCP_ENABLE
      // move fifohead back to start
      fifohead = comhandle[port]->txQueue->fifo;
    }
  }  

  if ( length > wraplength)
  {
    if ( (port == COM_USART0) || (port == COM_USART1) || (port == COM_USART2) )
    {
      while(UARTDRV_Transmit(comhandle[port]->uarthandle, fifohead, length - wraplength, unloadTxBuffer) != EMBER_SUCCESS);
    }
  #ifdef COM_VCP_ENABLE
    if (port == COM_VCP)
    {
          emDebugSendVuartMessage(comhandle[port]->txQueue->fifo, comhandle[port]->txsize);
          dequeueFifoBuffer(port, comhandle[port]->txsize);
    }
  #endif //COM_VCP_ENABLE
  }
  return EMBER_SUCCESS;
}
开发者ID:taidalab,项目名称:ZigBeeember570,代码行数:54,代码来源:com.c


示例13: TIMER1_IRQHandler

/**
 *    \brief    Timer1 interrupt handler.
 */
void TIMER1_IRQHandler()
{
    uint32_t flags;
    INT_Disable();

    flags = TIMER_IntGet( TIMER1 );
    _hal_tcCb();
    TIMER_IntClear( TIMER1, flags );

    INT_Enable();
}
开发者ID:lucasmarwagner,项目名称:emb-6_dtls,代码行数:14,代码来源:efm32lg990.c


示例14: buf_read_byte

bool buf_read_byte(buf_t *buf, uint8_t *data)
{
	if (buf->count == 0)
		return false;  // no data
	*data = buf->data[buf->read_idx++];
	if (buf->read_idx >= buf->size)
		buf->read_idx = 0;
	INT_Disable();
	buf->count--;
	INT_Enable();
	return true;
}
开发者ID:brouhaha,项目名称:eyeopener,代码行数:12,代码来源:main.c


示例15: buf_write_byte

bool buf_write_byte(buf_t *buf, const uint8_t data)
{
	if (buf->count >= buf->size)
		return false;  // no room
	buf->data[buf->write_idx++] = data;
	if (buf->write_idx >= buf->size)
		buf->write_idx = 0;
	INT_Disable();
	buf->count++;
	INT_Enable();
	return true;
}
开发者ID:brouhaha,项目名称:eyeopener,代码行数:12,代码来源:main.c


示例16: updateBuffer

/* reload buffer callbacks */
void updateBuffer(COM_FifoQueue_t *q, uint16_t xferred, uint16_t size)
{
  // Update tail with additional xferred. Data should already be there
  INT_Disable();
    if (xferred > q->pumped)
    {
    q->head = ((q->head - q->pumped + xferred) % size);
    q->used += xferred - q->pumped;
    q->pumped = xferred;
    }
  INT_Enable();
}
开发者ID:taidalab,项目名称:ZigBeeember570,代码行数:13,代码来源:com.c


示例17: USBTIMER_Start

/***************************************************************************//**
 * @brief
 *   Start a timer.
 *
 * @details
 *   If the timer is already running, it will be restarted with new timeout.
 *
 * @param[in] id
 *   Timer id (0..).
 *
 * @param[in] timeout
 *   Number of milliseconds before timer will elapse.
 *
 * @param[in] callback
 *   Function to be called on timer elapse, ref. @ref USBTIMER_Callback_TypeDef.
 ******************************************************************************/
void USBTIMER_Start( uint32_t id, uint32_t timeout,
                     USBTIMER_Callback_TypeDef callback )
{
  uint32_t accumulated;
  USBTIMER_Timer_TypeDef *this, **last;

  INT_Disable();
  if ( timers[ id ].running )
  {
    USBTIMER_Stop( id );
  }

  timers[ id ].running  = true;
  timers[ id ].callback = callback;
  timers[ id ].next     = NULL;

  if ( !head )                                        /* Queue empty ? */
  {
    timers[ id ].timeout  = timeout;
    head = &timers[ id ];
  }
  else
  {
    this = head;
    last = &head;
    accumulated = 0;

    /* Do a sorted insert */
    while ( this  )
    {
      if ( timeout < accumulated + this->timeout )  /* Insert before "this" ? */
      {
        timers[ id ].timeout  = timeout - accumulated;
        timers[ id ].next     = this;
        *last = &timers[ id ];
        this->timeout -= timers[ id ].timeout;        /* Adjust timeout     */
        break;
      }
      else if ( this->next == NULL )                  /* At end of queue ?  */
      {
        timers[ id ].timeout  = timeout - accumulated - this->timeout;
        this->next = &timers[ id ];
        break;
      }
      accumulated += this->timeout;
      last = &this->next;
      this = this->next;
    }
  }

  INT_Enable();
}
开发者ID:EnergyMicro,项目名称:usb,代码行数:68,代码来源:em_usbtimer.c


示例18: LDMA_StopTransfer

/***************************************************************************//**
 * @brief
 *   Stop a DMA transfer.
 *
 * @note
 *   The DMA will complete the current AHB burst transfer before stopping.
 *
 * @param[in] ch
 *   DMA channel to stop.
 ******************************************************************************/
void LDMA_StopTransfer( int ch )
{
  uint32_t chMask = 1 << ch;

  EFM_ASSERT( ch < DMA_CHAN_COUNT );

  INT_Disable();

  LDMA->IEN &= ~chMask;
  BUS_RegMaskedClear(&LDMA->CHEN, chMask);

  INT_Enable();
}
开发者ID:Engimusing,项目名称:engimusing-firmware,代码行数:23,代码来源:em_ldma.c


示例19: main

/**************************************************************************//**
 * @brief Main function
 *****************************************************************************/
int main(void)
{
  
  /* Chip revision alignment and errata fixes */
  CHIP_Init();
    
  /* Set the clock frequency to 11MHz so the ADC can run on the undivided HFCLK */
  CMU_HFRCOBandSet(cmuHFRCOBand_11MHz);
  
  /* Configure RTC to use LFRCO as clock source */
  RTC_Setup(cmuSelect_LFRCO);
    
  /* Configure ADC */
  ADC_Config();
 
  /* Start ADC sampling, adcFinished is set when sampling is finished. */
  /* It is safe to do other stuff or go to EM2 while adc sampling is active. */
  /* ADC sampling uses the RTC to trigger new samples. */
  startAdcSampling();
    
  /* Wait in EM2 until adc sampling is finished. */
  /* Disable interrupts until flag is checked in case loop finishes after flag 
  * check but before sleep command. Device will still wake up on any set IRQ 
  * and any pending interrupts will be handled after interrupts are enabled 
  * again. */
  INT_Disable();
  while(!adcFinished)
  {
   EMU_EnterEM2(false); 
   INT_Enable();
   INT_Disable();
  }
  INT_Enable();    
  
  /* Finished */
  while(1);
  
}  
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:41,代码来源:main_adc_em2_interrupt.c


示例20: RTCDRV_IsRunning

/***************************************************************************//**
 * @brief
 *    Check if a given timer is running.
 *
 * @param[in] id The id of the timer to query.
 *
 * @param[out] isRunning True if timer is running. False if not running.
 *                       Only valid if return status is ECODE_EMDRV_RTCDRV_OK.
 *
 * @return
 *    @ref ECODE_EMDRV_RTCDRV_OK on [email protected]
 *    @ref ECODE_EMDRV_RTCDRV_ILLEGAL_TIMER_ID if id has an illegal value. @n
 *    @ref ECODE_EMDRV_RTCDRV_TIMER_NOT_ALLOCATED if the timer is not [email protected]
 *    @ref ECODE_EMDRV_RTCDRV_PARAM_ERROR if an invalid isRunning pointer was
 *         supplied.
 ******************************************************************************/
Ecode_t RTCDRV_IsRunning( RTCDRV_TimerID_t id, bool *isRunning )
{
  // Check if valid timer ID.
  if ( id >= EMDRV_RTCDRV_NUM_TIMERS ) {
    return ECODE_EMDRV_RTCDRV_ILLEGAL_TIMER_ID;
  }

  // Check pointer validity.
  if ( isRunning == NULL ) {
    return ECODE_EMDRV_RTCDRV_PARAM_ERROR;
  }

  INT_Disable();
  // Check if timer is reserved.
  if ( ! timer[ id ].allocated ) {
    INT_Enable();
    return ECODE_EMDRV_RTCDRV_TIMER_NOT_ALLOCATED;
  }
  *isRunning = timer[ id ].running;
  INT_Enable();

  return ECODE_EMDRV_RTCDRV_OK;
}
开发者ID:jacquestkirk,项目名称:WeatherBalloon,代码行数:39,代码来源:rtcdriver.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ INT_FATAL函数代码示例发布时间:2022-05-30
下一篇:
C++ INT_BUFSIZE_BOUND函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap