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


C++ CLR_BIT函数代码示例

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


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

示例1: main

int main(void){

	DDRA = 0xFF; //set all pins of port A to output
	DDRC = 0x00; //set all pins of port C to input

	while(1)
	{
		int one = 1;
		int count = 0;
		int i = 0;
		while(i < 8)
		{
			int temp = GET_BIT(PINC,i);
			if(temp != 0)
			{
				count++;
			}
			++i;
		}
		if ((count % 2) != 0)
		{
			CLR_BIT(PORTA, 1);
			one = SET_BIT(PORTA, 0);
		}
		else 
		{
				CLR_BIT(PORTA, 0);
			one = SET_BIT(PORTA, 1);
		}
		count = 0;
	}

return 0;
	
}
开发者ID:redgarthwaite,项目名称:UCR,代码行数:35,代码来源:lab1p2.c

示例2: qat_hal_set_ae_lm_mode

int qat_hal_set_ae_lm_mode(struct icp_qat_fw_loader_handle *handle,
			   unsigned char ae, enum icp_qat_uof_regtype lm_type,
			   unsigned char mode)
{
	unsigned int csr, new_csr;

	qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &csr);
	csr &= IGNORE_W1C_MASK;
	switch (lm_type) {
	case ICP_LMEM0:
		new_csr = (mode) ?
			SET_BIT(csr, CE_LMADDR_0_GLOBAL_BITPOS) :
			CLR_BIT(csr, CE_LMADDR_0_GLOBAL_BITPOS);
		break;
	case ICP_LMEM1:
		new_csr = (mode) ?
			SET_BIT(csr, CE_LMADDR_1_GLOBAL_BITPOS) :
			CLR_BIT(csr, CE_LMADDR_1_GLOBAL_BITPOS);
		break;
	default:
		pr_err("QAT: lmType = 0x%x\n", lm_type);
		return -EINVAL;
	}

	if (new_csr != csr)
		qat_hal_wr_ae_csr(handle, ae, CTX_ENABLES, new_csr);
	return 0;
}
开发者ID:GavinHwa,项目名称:linux,代码行数:28,代码来源:qat_hal.c

示例3: Hyperjump

/*
 * Player has used hyperjump item.
 */
static void Hyperjump(player_t *pl)
{
    clpos_t dest;
    int counter;
    hitmask_t hitmask = NONBALL_BIT | HITMASK(pl->team); /* kps - ok ? */

    /* Try to find empty space to hyperjump to. */
    for (counter = 100; counter > 0; counter--) {
	dest = World_get_random_clpos();
	if (shape_is_inside(dest.cx, dest.cy, hitmask, OBJ_PTR(pl),
			    (shape_t *)pl->ship, pl->dir) == NO_GROUP)
	    break;
    }

    /* We can't find an empty space, hyperjump failed. */
    if (!counter) {
	/* need to do something else here ? */
	Set_player_message(pl, "Could not hyperjump. [*Server notice*]");
	CLR_BIT(pl->obj_status, WARPING);
	sound_play_sensors(pl->pos, HYPERJUMP_SOUND);
	return;
    }

    sound_play_sensors(pl->pos, HYPERJUMP_SOUND);

    Warp_balls(pl, dest);

    Object_position_init_clpos(OBJ_PTR(pl), dest);
    pl->forceVisible += 15;

    CLR_BIT(pl->obj_status, WARPING);
}
开发者ID:calumchisholm,项目名称:XPilotNG-web,代码行数:35,代码来源:wormhole.c

示例4: LCD_WriteCommand

void LCD_WriteCommand (unsigned char Command) {
   CLR_BIT(CONTROL_BUS,RS);
   DATA_BUS = Command;
   SET_BIT(CONTROL_BUS,E);
   asm("nop");
   CLR_BIT(CONTROL_BUS,E);
   delay_ms(2); // ClearScreen requires 1.52ms to execute
}
开发者ID:Martin-Ting,项目名称:RunningClock,代码行数:8,代码来源:io.c

示例5: set_to_NC

void set_to_NC(c) {
	for (int x=4; x < 8; x++) {
		if (x != c) {
			CLR_BIT(DDRC, x);
			CLR_BIT(PORTC, x);
		}
	}
}
开发者ID:eputh,项目名称:Play-Music,代码行数:8,代码来源:keypad.c

示例6: output

static void output(unsigned char d, unsigned char rs) {
  if( rs ) SET_BIT(PORT, RS_PIN); else CLR_BIT(PORT, RS_PIN);
  CLR_BIT(PORT, RW_PIN);
  set_data(d);
  SET_BIT(PORT, EN_PIN);
  sleep_700ns();
  CLR_BIT(PORT, EN_PIN);
}
开发者ID:abdulmajeed90,项目名称:SixthSense,代码行数:8,代码来源:lcd.c

示例7: input

static unsigned char input(unsigned char rs) {
  unsigned char d;
  if( rs ) SET_BIT(PORT, RS_PIN); else CLR_BIT(PORT, RS_PIN);
  SET_BIT(PORT, RW_PIN);
  get_data();
  SET_BIT(PORT, EN_PIN);
  sleep_700ns();
  d = get_data();
  CLR_BIT(PORT, EN_PIN);
  return d;
}
开发者ID:abdulmajeed90,项目名称:SixthSense,代码行数:11,代码来源:lcd.c

示例8: timer1_init

void timer1_init()
{
//	uint16_t count;

	//Timer 1 is used by or for:
	//	a) Control Loop Timing and interrupt
	//	b) Decoding RC reciever pulses

	//With a clock prescale of 8 we get
	//Minimum interrupt time period = 400ns(2.5MHz)
	//Maxiumum interrupt time period = 26.2144ms(38.14Hz)
	
	//With a clock prescale of 64 we get
	//Minimum interrupt time period = 3.2us
	

	//Do not use loop rate greater than 500Hz as that will mess up the RC decoding logic.
	//Safe operating loop rate in terms of not conflicting with RC reciever decoding is from
	//lower than 300Hz.

	TCCR1A = 0;
	TCCR1B = 0;

	// Prescalar 64
	SET_BIT(TCCR1B, CS11);
	SET_BIT(TCCR1B, CS10); 

// 	//CTC (Clear Timer on Compare Match)
// 	CLR_BIT(TCCR1B, WGM13); 
// 	SET_BIT(TCCR1B, WGM12); 
// 	CLR_BIT(TCCR1A, WGM11); 
// 	CLR_BIT(TCCR1A, WGM10); 

	//Normal non PWM mode
 	CLR_BIT(TCCR1B, WGM13); 
 	CLR_BIT(TCCR1B, WGM12); 
 	CLR_BIT(TCCR1A, WGM11); 
 	CLR_BIT(TCCR1A, WGM10); 


// 	//Calculate count value to generate given interrupt rate.
// 	//8 is clock prescale used for Timer 1
// 	count = (F_CPU/(CONTROL_LOOP_RATE*8));
// 	OCR1A = count;

// 	TIMSK1 = 0;
// 	//Enable interrupt on Compare Match A
// 	SET_BIT(TIMSK1, OCIE1A); 
 	SET_BIT(TIMSK1, TOIE1); 

}
开发者ID:liubingzsd,项目名称:pushpak,代码行数:51,代码来源:pushpak.C

示例9: key_pressed

unsigned char key_pressed(unsigned char r, unsigned char c) {
	DDRC = 0;
	PORTC = 0;
	CLR_BIT(DDRC, r);
	SET_BIT(PORTC, r);
	SET_BIT(DDRC, c + 4);
	CLR_BIT(PORTC, c + 4);
	if (!GET_BIT(PINC, r)) {
		return 1;
	}
	else {
		return 0;
	}
}
开发者ID:arashn,项目名称:obdii-reader,代码行数:14,代码来源:main.c

示例10: flashSuccess

void flashSuccess(void)
{
	SET_BIT(PORTB, 0);
	wait_avr(150);
	CLR_BIT(PORTB, 0);
	wait_avr(150);
	SET_BIT(PORTB, 0);
	wait_avr(150);
	CLR_BIT(PORTB, 0);
	wait_avr(150);
	SET_BIT(PORTB, 0);
	wait_avr(150);
	CLR_BIT(PORTB, 0);
}
开发者ID:abdulmajeed90,项目名称:SixthSense,代码行数:14,代码来源:i2c.c

示例11: handleDisconnect1

static int handleDisconnect1(struct slice *slice, int clNo)
{    
    if(slice != NULL) {
	if (BIT_ISSET(clNo, slice->sl_reqack.readySet)) {
	    /* avoid counting client both as left and ready */
	    CLR_BIT(clNo, slice->sl_reqack.readySet);
	    slice->nrReady--;
	}
	if (BIT_ISSET(clNo, slice->answeredSet)) {
	    slice->nrAnswered--;
	    CLR_BIT(clNo, slice->answeredSet);
	}
    }
    return 0;
}
开发者ID:elisescu,项目名称:udpcast,代码行数:15,代码来源:senddata.c

示例12: get_key

unsigned char get_key(void) {
	for (int r=0; r < 4; r++) {
		CLR_BIT(DDRC, r);
		SET_BIT(PORTC, r);
		for (int c=4; c < 8; c++) {
			SET_BIT(DDRC, c);
			CLR_BIT(PORTC, c);
			set_to_NC(c);
			if (key_pressed(r,c)) {
				return (r*4) + c - 3;
			}
		}
	}
	return 0;
}
开发者ID:eputh,项目名称:Play-Music,代码行数:15,代码来源:keypad.c

示例13: setPinModeInput

void setPinModeInput(t_SetPortCfg* cfg, uint8_t bit)
{
	t_stPort* stport=(t_stPort *)cfg->pID;  //make the pointer points to the Port Registers in memory
	cfg->Portdir=stport->portDirReg;
    CLR_BIT(cfg->Portdir,bit);
    stport->portDirReg &= cfg->Portdir;
}
开发者ID:Integreight,项目名称:1Sheeld-Firmware,代码行数:7,代码来源:gpio.c

示例14: pressed

_Bool pressed(int col, int row)
{
	CLR_BIT(PORTC, col);
	_Bool buttonPressed = !GET_BIT(PINC, col) && !GET_BIT(PINC, row);
	
	return !GET_BIT(PINC, col) && !GET_BIT(PINC, row);
}
开发者ID:ellenmliu,项目名称:CS145,代码行数:7,代码来源:avr.c

示例15: psivshmem_free_mem

int psivshmem_free_mem(ivshmem_pci_dev_t *dev, char * frame_ptr, size_t size)
{
/*
 * first implementation: just clear corresponding bit in bitmap -> frame is available
 *
 * "a = b/c"  int division round up
 * int a = (b + (c - 1)) / c  <- rounds up for positiv int, e.g. frameIndices
 *
 *
 */
    unsigned long long n;
    unsigned long long index_low, index_high;

    if(!psivshmem_ptr_in_dev(dev, frame_ptr)) return -1;
    if(!psivshmem_ptr_in_dev(dev, frame_ptr + size)) return -1;

    index_low = (frame_ptr - dev->ivshmem_base) / dev->frame_size; //has to be a multiple of it!
    index_high = (frame_ptr - dev->ivshmem_base + size + (dev->frame_size - 1)) / dev->frame_size;

    pthread_spin_lock(dev->spinlock);

        for(n = index_low; n<=index_high;n++) {  //'unlock' all N used frames
	    CLR_BIT(dev->bitmap, n);
	}

    pthread_spin_unlock(dev->spinlock);

return 0;
}
开发者ID:RWTH-OS,项目名称:pscom,代码行数:29,代码来源:psivshmem.c


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