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

C++ BIT_SET函数代码示例

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

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



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

示例1: f2_parse_cof

/* Parse the COF head into the top-level f2, then parse tails into
   the f2->parts array, and NULL-terminate the array */
void
f2_parse_cof(const Uchar *file, size_t line, Uchar *lp, struct f2 *f2p, 
	     Uchar **psu_sense, Uchar *ampamp, struct sig_context *scp)
{
  List *cofs = list_create(LIST_SINGLE);
  Uchar *form = NULL;
  int i = 0;

  while (1)
    {
      list_add(cofs, lp);
      if (!ampamp)
	break;
      *ampamp = '\0';
      ampamp += 2;
      lp = ampamp;
      ampamp = (unsigned char *)strstr((char*)lp,"&&");
    }
  f2p->parts = mb_new_array(scp->mb_f2ps, list_len(cofs));

  /* Parse the head in the top-level f2 structure */
  form = list_first(cofs);
  f2_parse(file,line,form,f2p,NULL,NULL);
  f2p->cof_id = (uintptr_t)f2p;
  BIT_SET(f2p->flags, F2_FLAGS_COF_HEAD);

  /* Now parse the tails into the parts array */
  for (i = 0, form = list_next(cofs); 
       form; 
       form = list_next(cofs), ++i)
    {
      f2p->parts[i] = mb_new(scp->mb_f2s);
      f2_parse(file,line,form,f2p->parts[i],NULL,NULL);
      f2p->parts[i]->cof_id = (uintptr_t)f2p;
      BIT_SET(f2p->parts[i]->flags, F2_FLAGS_COF_TAIL);
    }
  f2p->parts[i] = NULL;
}
开发者ID:EleanorRobson,项目名称:oracc,代码行数:40,代码来源:f2_parse.c


示例2: main

int main(void)
{
    UINT8 data;

    BIT_SET(L_OUT_DDR,L_OUT_PIN); //L_OUT pin is output
    BIT_SET(K_OUT_DDR,K_OUT_PIN); //K_OUT pin is output

    K_OUT(1);
    L_OUT(1);


    uart1_init(10400);
    uart_init(115200); //Set up UART
    TimeInit();	 //set up time

    //set up printf
    fdevopen(uart_putchar, NULL);

    printf("Hello world\n");

    while (1)
    {
        if (uart1_kbhit())
        {
            data=uart1_getchar();
            printf("0x%02X ",data);
            //uart_putchar(data);
        }
        if (uart_kbhit())
        {
            data=uart_getchar();
            uart1_putchar(data);
        }
    }



}
开发者ID:DraakUSA,项目名称:avrobdii,代码行数:38,代码来源:main.c


示例3: OnItemchangedListFields

void CBibitemView::OnItemchangedListFields(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	if (!m_Updating) {
		if (pNMListView->uChanged == LVIF_STATE) {
			if (BIT_SET(pNMListView->uNewState, LVIS_FOCUSED))
				m_SelField = pNMListView->iItem;
			else
				m_SelField = -1;
		}
	}	
	
	*pResult = 0;
}
开发者ID:stievie,项目名称:bibedt,代码行数:14,代码来源:BibitemView.cpp


示例4: shift_write_word

void shift_write_word ( uint8_t *output, uint8_t size )
{
    uint8_t i;

    for ( i=1; i<=size; i++)
    {
        shift_write_bit(output[(size-i)/8] & (1<<(size-i)%8));
    }

    BIT_SET( LATCH_PORT, LATCH_BIT );
    _delay_us(DELAY);
    BIT_CLEAR( LATCH_PORT, LATCH_BIT );
    _delay_us(DELAY);
}
开发者ID:jim17,项目名称:componentmeter,代码行数:14,代码来源:shiftregister.c


示例5: AllocTrigId

static int8_t AllocTrigId(uint8_t pinNum)
{
    int8_t id = 0;
    while (BIT_IS_SET(trigUse, id)) {
        ++id;
    }
    if (id == MAX_TRIGGERS) {
        return AJS_IO_PIN_NO_TRIGGER;
    } else {
        BIT_SET(trigUse, id);
        pinIdToSource[id] = pinNum;
        return id;
    }
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:14,代码来源:io_gpio.c


示例6: timer_milliseconds

/*************************************************************************
* Description: returns the current millisecond count
* Returns: none
* Notes: This method only disables the timer overflow interrupt.
*************************************************************************/
uint32_t timer_milliseconds(
    void)
{
    uint32_t timer_value;       /* return value */

    /* Disable the overflow interrupt.
       Prevents value corruption that would happen if interrupted */
    BIT_CLEAR(TIMSK2, TOIE2);
    timer_value = Millisecond_Counter;
    /* Enable the overflow interrupt */
    BIT_SET(TIMSK2, TOIE2);

    return timer_value;
}
开发者ID:8bitgeek,项目名称:bacnet-stack,代码行数:19,代码来源:timer2.c


示例7: timer_init

void timer_init(void)
{
	// commented out due to bug!?
	/* make sure the timer is stopped */
	//BIT_CLR(TIMER32(TMRCONTROL), RUN);
	
	/* set up the clock */
	//TIMER32(TMRCONTROL) &= ~(3<<SETCLK);
	//TIMER32(TMRCONTROL) |= (TIMER_CLK<<SETCLK);
	
	
	TIMER32(TMRCLKGEN) = (TIMER_PRES<<TCLKDIV)|(TIMER_CLK_SRC<<TCLKSRCSEL);
	BIT_SET(TIMER32(TMRCLKENB), TCLKGENENB);
}
开发者ID:BackupTheBerlios,项目名称:opendidj,代码行数:14,代码来源:timer.c


示例8: do_sethook

static int do_sethook(xpd_t *xpd, int pos, bool to_offhook)
{
	unsigned long		flags;
	xbus_t			*xbus;
	struct FXO_priv_data	*priv;
	int			ret = 0;
	byte			value;

	BUG_ON(!xpd);
	BUG_ON(xpd->direction == TO_PHONE);		// We can SETHOOK state only on PSTN
	xbus = xpd->xbus;
	priv = xpd->priv;
	BUG_ON(!priv);
	if(priv->battery[pos] != BATTERY_ON && to_offhook) {
		LINE_NOTICE(xpd, pos, "Cannot take offhook while battery is off!\n");
		return -EINVAL;
	}
	spin_lock_irqsave(&xpd->lock, flags);
	mark_ring(xpd, pos, 0, 0);				// No more rings
	value = REG_DAA_CONTROL1_ONHM;				/* Bit 3 is for CID */
	if(to_offhook)
		value |= REG_DAA_CONTROL1_OH;
	LINE_DBG(SIGNAL, xpd, pos, "SETHOOK: value=0x%02X %s\n", value, (to_offhook)?"OFFHOOK":"ONHOOK");
	if(to_offhook)
		MARK_ON(priv, pos, LED_GREEN);
	else
		MARK_OFF(priv, pos, LED_GREEN);
	ret = DAA_DIRECT_REQUEST(xbus, xpd, pos, DAA_WRITE, REG_DAA_CONTROL1, value);
	if(to_offhook) {
		BIT_SET(xpd->offhook, pos);
	} else {
		BIT_CLR(xpd->offhook, pos);
	}
	if(caller_id_style != CID_STYLE_PASS_ALWAYS) {
		LINE_DBG(SIGNAL, xpd, pos, "Caller-ID PCM: off\n");
		BIT_CLR(xpd->cid_on, pos);
	}
#ifdef	WITH_METERING
	priv->metering_count[pos] = 0;
	priv->metering_tone_state = 0L;
	DAA_DIRECT_REQUEST(xbus, xpd, pos, DAA_WRITE, DAA_REG_METERING, 0x2D);
#endif
	reset_battery_readings(xpd, pos);	/* unstable during hook changes */
	priv->power_denial_safezone[pos] = (to_offhook) ? POWER_DENIAL_SAFEZONE : 0;
	if(!to_offhook)
		priv->power[pos] = POWER_UNKNOWN;
	spin_unlock_irqrestore(&xpd->lock, flags);
	return ret;
}
开发者ID:xrg,项目名称:dahdi-linux-xrg,代码行数:49,代码来源:card_fxo.c


示例9: LedsSet

/******************************************************************
 ** LedsSet
 *
 *  DESCRIPTION:
 *		Sets the state of the leds
 *
 *  Create: 5/9/2006	9:37:35 PM - Trampas Stern
 *******************************************************************/
INT LedsSet(UINT8 Led, UINT8 State)
{
	if (Led<=7)
	{
		if (State)
	   	{
	   		BIT_CLEAR(LEDS_U18,Led);
		}else
		{
			BIT_SET(LEDS_U18,Led);
		}
	}else if (Led<=14)
	{
		Led=Led-8;
		if (State)
	   	{
	   		BIT_CLEAR(LEDS_U40,Led);
		}else
		{
			BIT_SET(LEDS_U40,Led);
		}
	}
	return LedsUpdate(); //update the LEDs
}
开发者ID:DraakUSA,项目名称:avrobdii,代码行数:32,代码来源:led.c


示例10: putBuffer

void putBuffer() 
{ 
    int8_t i; 
    BIT_SET(RF_24G_CE_PORT, RF_24G_CE_BIT); 
    CSDELAY(); 

    putByte(ADDR1_1); 
    putByte(ADDR1_0); 

    for( i=0; i<BUF_MAX ; i++) { 
        putByte(RF_24G_Buffer[i]); 
    } 
    BIT_CLEAR(RF_24G_CE_PORT, RF_24G_CE_BIT); 
    BIT_CLEAR(RF_24G_CLK1_PORT, RF_24G_CLK1_BIT); 
} 
开发者ID:vishl,项目名称:SMS-Buzzer-Embedded,代码行数:15,代码来源:rf24g_2.c


示例11: flash_init

/******************************************************************
 ** flash_init
 *
 *  DESCRIPTION:
 *
 *  Create: 7/23/2006	10:09:14 AM - Trampas Stern
 *******************************************************************/
void flash_init()
{
	//Set the Chip Select pin as output
	BIT_SET(FLASH_CS_DDR,FLASH_CS_BIT); 
	//SET Chip select high
	FLASH_CS(1); 
	FLASH_CLK(0);

	BIT_SET(FLASH_RESET_DDR,FLASH_RESET_PIN);
	FLASH_RESET(0);
	delay_ms(20);
	FLASH_RESET(1);

	//Set up the SPI port
	// AT45DBxxx can handle mode 0 or mode 1 transmissions
	// we will use mode zero (SCK low when idle & sample leading edge)
	//	SPI Interupt disabled - 0
	//	SPI Disabled - 0
	// 	DORD MSB first -0
	//  Master - 1
	//  Clk Polarity - 0 SCK low when idel
	//	CPHA =0 sample leading edge
	//  ClkRate= 000 (AT90 is 16Mhz and Flash can operate at 20Mhz, no clk divide)
	SPCR=0x10; //only master bit set

	//configure the direction of the SPI pins
	BIT_SET(DDRB,1); //SCK output
	BIT_SET(DDRB,2); //MOSI output

	//SET MISO to have internal pullup
	BIT_SET(PORTB,3); 

	//Enable the SPI port
	SPCR=SPCR | 0x40; 

}
开发者ID:DraakUSA,项目名称:avrobdii,代码行数:43,代码来源:flash.c


示例12: cmdNoReply

static void cmdNoReply(void *base)
{
	node_t *node = (node_t *) base;
 	
 	assert(node);
 	assert(node->handle >= 0);

 	// set our specific flag.
	BIT_SET(node->data.flags, DATA_FLAG_NOREPLY);
	
	assert(node->sysdata);
	logger(node->sysdata->logging, 3,
		"node:%d NOREPLY (flags:%x, mask:%x)",
		node->handle, node->data.flags, node->data.mask);
}
开发者ID:hyper,项目名称:rqd,代码行数:15,代码来源:commands.c


示例13: die

/*
 * Die in case of unrecoverable error.  On LF1000, we pull the power off. 
 * Otherwise just lock up. 
 */
static void die(void)
{
	db_puts("die()\n");
#ifdef CPU_LF1000
	/* enable access to Alive GPIO */
	REG32(LF1000_ALIVE_BASE+ALIVEPWRGATEREG) = 1;
	/* pull VDDPWRON low by resetting the flip-flop */
	BIT_CLR(REG32(LF1000_ALIVE_BASE+ALIVEGPIOSETREG), VDDPWRONSET);
	BIT_SET(REG32(LF1000_ALIVE_BASE+ALIVEGPIORSTREG), VDDPWRONSET);
	/* reset flip-flop to latch in */
	REG32(LF1000_ALIVE_BASE+ALIVEGPIOSETREG) = 0;
	REG32(LF1000_ALIVE_BASE+ALIVEGPIORSTREG) = 0;
	/* power should be off now... */
#endif
	while(1);
}
开发者ID:BackupTheBerlios,项目名称:opendidj,代码行数:20,代码来源:main.c


示例14: cmdId

static void cmdId(void *base, risp_int_t value)
{
	node_t *node= (node_t *) base;

 	assert(node);
 	assert(value >= 0);
 	assert(node->handle >= 0);

	BIT_SET(node->data.mask, DATA_MASK_ID);
	node->data.id = value;
	
	assert(node->sysdata);
	logger(node->sysdata->logging, 3,
		"node:%d ID (%d) (flags:%x, mask:%x)",
		node->handle, value, node->data.flags, node->data.mask);
}
开发者ID:hyper,项目名称:rqd,代码行数:16,代码来源:commands.c


示例15: refresh_display

static void refresh_display(void)
{
  static u8 i;

  // First shift enables only one column.
  shift_byte(~(0b00000001 << i));
  // Second shift for column data.
  shift_byte(matrix[i]);

  // Pulse to move everything to output.
  BIT_CLR(SHIFT_PORT, SHIFT_RCK);
  BIT_SET(SHIFT_PORT, SHIFT_RCK);

  // Increase i with each cycle, but don't let it get bigger than 7.
  i = (i + 1) % 7;
}
开发者ID:somemetricprefix,项目名称:cube,代码行数:16,代码来源:kernel.c


示例16: setBusFrequency

uint32_t
setBusFrequency( uint32_t freq_in, uint32_t freq_out, bool bypass )
{
    volatile unsigned int clkd = 0;
	volatile unsigned int regVal = 0;

    /* First enable the internal clocks */
    if ( setInternalClock( TRUE ) )
    {
    	return 1;
    }

    if ( FALSE == bypass )
    {
        /* Calculate and program the divisor */
        clkd = freq_in / freq_out;
        clkd = (clkd < 2) ? 2 : clkd;
        clkd = (clkd > 1023) ? 1023 : clkd;

		/* Do not cross the required freq */
		while((freq_in/clkd) > freq_out)
		{
			if ( 1023 == clkd )
			{
				/* Return we we cannot set the clock freq */
			   return 1;
			}

			clkd++;
		}

		// NOTE: OMAP35x.pdf on page 3179 has a clock-divider of 240 which is the same as here
        regVal = MMCHS_SYSCTL & ~0x0000FFC0u;
        MMCHS_SYSCTL = regVal | ( clkd << 6 );

        /* Wait for the interface clock stabilization */
        if ( awaitInternalClockStable( 0xFF ) )
        {
        	return 1;
        }

        /* Enable clock to the card */
        BIT_SET( MMCHS_SYSCTL, MMCHS_SYSCTL_CEN_BIT );
    }

    return 0;
}
开发者ID:FHV-S1-FFPST,项目名称:BOSS,代码行数:47,代码来源:sd_hal.c


示例17: genAb

void genAb(void *boardIn, const int n1, const int n2, void *MIn){
  
    int *board = (int *) boardIn;
    unsigned long long *M = (unsigned long long *) MIn;
    
    int i,j,k;
    int Mcols = (n1*n2 + 1) / 64; if( (n1*n2 + 1) % 64 != 0 ) Mcols++;
    int bPos = n1*n2;
    int currentElem;
    for(i=0; i<n1;i++){
      for(j=0;j<n2;j++){

          currentElem = i*n2+j;  

          if( board[i*n2+j] < 2 ){
              BIT_SET( M[ currentElem*Mcols + currentElem / 64 ] , currentElem % 64 );
              if( board[currentElem] == 1)
                  BIT_SET( M[ currentElem*Mcols + bPos / 64 ] , bPos % 64 );
          }
          else
              continue;
          
          for(k=j-1;k>=0;k--){
              if(board[i*n2+k] < 2)
                  BIT_SET( M[currentElem*Mcols + (i*n2+k) / 64] , (i*n2+k) % 64 );
              else
                  break;
          }
              
          for(k=j+1;k<n2;k++){
              if(board[i*n2+k] < 2)
                  BIT_SET( M[currentElem*Mcols + (i*n2+k) / 64] , (i*n2+k) % 64 );
              else
                  break;
          }
          
          for(k=i-1;k>=0;k--){
              if(board[k*n2+j] < 2)
                  BIT_SET( M[currentElem*Mcols + (k*n2+j) / 64] , (k*n2+j) % 64 );
              else
                  break;
          }
                  
          for(k=i+1;k<n1;k++){
              if(board[k*n2+j] < 2)
                  BIT_SET( M[currentElem*Mcols + (k*n2+j) / 64] , (k*n2+j) % 64 );
              else
                  break;
          }
          
      }
    }
    
}
开发者ID:skattelmann,项目名称:myrep,代码行数:54,代码来源:crossflip_helper.c


示例18: getByte

uint8_t getByte() 
{  
    //MSB first 
    int8_t i, b = 0; 
    for(i=0 ; i < 8 ; i++) { 
        BIT_CLEAR(RF_24G_CLK1_PORT, RF_24G_CLK1_BIT); 
        CLKDELAY(); 
        BIT_SET(RF_24G_CLK1_PORT, RF_24G_CLK1_BIT); 
        CLKDELAY();           // Read before falling edge 
        if( BIT_TEST(RF_24G_DATA_IN_PORT, RF_24G_DATA_BIT) ) { 
            b|=1;
        } 
        if(i!=7)
            b<<=1;
    } 
    return b; 
} 
开发者ID:vishl,项目名称:SMS-Buzzer-Embedded,代码行数:17,代码来源:rf24g_2.c


示例19: resetMMCICmdLine

uint32_t
resetMMCICmdLine( uint32_t retries )
{
	uint32_t i = 0;

	BIT_SET( MMCHS_SYSCTL, MMCHS_SYSCTL_SRC_BIT );

	for ( i = retries; i > 0; --i )
	{
		if ( ! BIT_CHECK( MMCHS_SYSCTL, MMCHS_SYSCTL_SRC_BIT ) )
		{
			return 0;
		}
	}

	return 1;
}
开发者ID:FHV-S1-FFPST,项目名称:BOSS,代码行数:17,代码来源:sd_hal.c


示例20: lem_save_form

/* This routine should not set anything but FORM at the f2 level;
   that is the job of ilem_parse */
void
lem_save_form(const char *ref, const char *lang, 
	      const char *formstr, struct lang_context *langcon)
{
  struct ilem_form *form = mb_new(lemline_xcp->sigs->mb_ilem_forms);
  extern int curr_cell;
  form->ref = (char*)ref;
  if (lang)
    {
      form->f2.lang = (unsigned char*)lang;
      form->f2.core = langcore_of(lang);
      if (strstr(lang,"949"))
	  BIT_SET(form->f2.flags,F2_FLAGS_LEM_BY_NORM);
    }
  if (BIT_ISSET(form->f2.flags,F2_FLAGS_LEM_BY_NORM))
    {
      form->f2.norm = (unsigned char *)formstr;
      form->f2.form = (const unsigned char *)"*";
    }
  else
    form->f2.form = (unsigned char *)formstr;
  form->file = (char*)file;
  form->lnum = lnum;
  form->lang = langcon;

  if (!ref[0])
    return;

  if (!curr_lsp->forms_alloced
      || curr_lsp->forms_used == curr_lsp->forms_alloced)
    {
      curr_lsp->forms_alloced += 16;
      curr_lsp->forms = realloc(curr_lsp->forms,
				curr_lsp->forms_alloced*sizeof(struct ilem_form*));
      curr_lsp->cells = realloc(curr_lsp->cells,
				curr_lsp->forms_alloced*sizeof(int));
      if (curr_lsp->forms_used < 0)
	curr_lsp->forms_used = 0;
    }
  /* when curr_cell = 0 we are in a line with no cells; by definition,
     all content in such a line is in cell 2 (because cell 1 is the line
     number) */
  curr_lsp->cells[curr_lsp->forms_used] = (curr_cell ? curr_cell : 2);
  curr_lsp->forms[curr_lsp->forms_used++] = form;
  hash_add(word_form_index,npool_copy((unsigned char*)ref,lemline_xcp->pool),form);
}
开发者ID:EleanorRobson,项目名称:oracc,代码行数:48,代码来源:lemline.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ BIT_WORD函数代码示例发布时间:2022-05-30
下一篇:
C++ BIT_MASK函数代码示例发布时间: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