當前位置: 首頁>>代碼示例>>C++>>正文


C++ BIT_SET函數代碼示例

本文整理匯總了C++中BIT_SET函數的典型用法代碼示例。如果您正苦於以下問題:C++ BIT_SET函數的具體用法?C++ BIT_SET怎麽用?C++ BIT_SET使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了BIT_SET函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的BIT_SET函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。