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


C++ CLEARBIT函数代码示例

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


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

示例1: ckps_init_state_variables

void ckps_init_state_variables(void)
{
 _BEGIN_ATOMIC_BLOCK();

 hall.stroke_period = 0xFFFF;
 hall.advance_angle = HALL_ADVANCE; //=0

 CLEARBIT(flags, F_STROKE);
 CLEARBIT(flags, F_VHTPER);
 CLEARBIT(flags, F_HALLEV);
 CLEARBIT(flags, F_SPSIGN);
 SETBIT(flags2, F_SHUTTER);
 SETBIT(flags2, F_SHUTTER_S);
 SETBIT(flags, F_IGNIEN);

 TCCR0 = 0; //timer is stopped (останавливаем таймер0)

 MCUCR|=_BV(ISC11); //falling edge for INT1
 MCUCR|=_BV(ISC10);

 TIMSK|=_BV(TOIE1);                   //enable Timer 1 overflow interrupt. Used for correct calculation of very low RPM
 hall.t1oc = 0;                       //reset overflow counter
 hall.t1oc_s = 255;                   //RPM is very low

#ifdef STROBOSCOPE
 hall.strobe = 0;
#endif

 hall.knkwnd_mode = 0;
 _END_ATOMIC_BLOCK();
}
开发者ID:abelom,项目名称:secu3app,代码行数:31,代码来源:hall.c

示例2: Button_SingleInit

void Button_SingleInit(sButtonPinPort buttonPinPort)
{
#ifdef __AVR__
#if defined (__AVR_ATmega16__)
	if(buttonPinPort.port == &PINA)
	{
		CLEARBIT(DDRA, buttonPinPort.pin);
		SETBIT(PORTA, buttonPinPort.pin);
	}
#else
   if(0)
   {
   }
#endif
	else if(buttonPinPort.port == &PINB)
	{
		CLEARBIT(DDRB, buttonPinPort.pin);
		SETBIT(PORTB, buttonPinPort.pin);
	}
	else if(buttonPinPort.port == &PINC)
	{
		CLEARBIT(DDRC, buttonPinPort.pin);
		SETBIT(PORTC, buttonPinPort.pin);
	}
	else if(buttonPinPort.port == &PIND)
	{
		CLEARBIT(DDRD, buttonPinPort.pin);
		SETBIT(PORTD, buttonPinPort.pin);
	}
#endif	
}
开发者ID:pikeBishop,项目名称:OMP_8x8LedToy,代码行数:31,代码来源:Button.c

示例3: ckps_init_state

void ckps_init_state(void)
{
 _BEGIN_ATOMIC_BLOCK();

 if ((IOCFG_CB(IOP_CKPS) == (fnptr_t)iocfg_g_ckps) || (IOCFG_CB(IOP_CKPS) == (fnptr_t)iocfg_g_ckpsi))
 {
  CLEARBIT(flags2, F_SELEDGE); //falling edge
  hall.ckps_inpalt = 1; //not remapped
 }
 else
  hall.ckps_inpalt = 0; //CKPS mapped on other input

 ckps_init_state_variables();
 CLEARBIT(flags, F_ERROR);

 //Compare channels do not connected to lines of ports (normal port mode)
 //(Каналы Compare не подключены к линиям портов (нормальный режим портов))
 TCCR1A = 0;

 TCCR1B = _BV(CS11)|_BV(CS10);  //Tune timer 1 (clock = 312.5 kHz)
 TCCR0B = _BV(CS01)|_BV(CS00);  //Tune timer 0 (clock = 312.5 kHz)

 if (hall.ckps_inpalt)
  TIMSK1|=_BV(ICIE1);    //enable input capture interrupt only if CKPS is not remapped
 _END_ATOMIC_BLOCK();
}
开发者ID:ashabelnikov,项目名称:secu3app,代码行数:26,代码来源:hall.c

示例4: ckps_init_state_variables

void ckps_init_state_variables(void)
{
 _BEGIN_ATOMIC_BLOCK();

 hall.stroke_period = 0xFFFF;
 hall.advance_angle = hall.shutter_wnd_width; //=0

 CLEARBIT(flags, F_STROKE);
 CLEARBIT(flags, F_VHTPER);
 CLEARBIT(flags, F_HALLEV);
 CLEARBIT(flags, F_SPSIGN);
 SETBIT(flags, F_IGNIEN);
 SETBIT(flags2, F_SHUTTER);
 SETBIT(flags2, F_SHUTTER_S);

 TIMSK1|=_BV(TOIE1);                  //enable Timer 1 overflow interrupt. Used for correct calculation of very low RPM

 hall.t1oc = 0;                       //reset overflow counter
 hall.t1oc_s = 255;                   //RPM is very low

#ifdef STROBOSCOPE
 hall.strobe = 0;
#endif

 hall.knkwnd_mode = 0;
#ifdef DWELL_CONTROL
 hall.cr_acc_time = 0;
#endif

#ifdef FUEL_INJECT
 hall.cur_chan = 0;
#endif
 _END_ATOMIC_BLOCK();
}
开发者ID:ashabelnikov,项目名称:secu3app,代码行数:34,代码来源:hall.c

示例5: touch_init

void touch_init(){//uint8_t chan){
    //set up the I/O pins E1, E2, E3 to be output pins
    CLEARBIT(TRISEbits.TRISE1); //I/O pin set to output
    CLEARBIT(TRISEbits.TRISE2); //I/O pin set to output
    CLEARBIT(TRISEbits.TRISE3); //I/O pin set to output

    // ADC init
    //disable ADC
    CLEARBIT(AD1CON1bits.ADON);
    //initialize PIN
    SETBIT(TRISBbits.TRISB15); //set TRISE RB15 to input
    SETBIT(TRISBbits.TRISB9); //set TRISE RB9 to input
    SETBIT(AD1PCFGLbits.PCFG15); // RB15 analog ADC1CH15
    SETBIT(AD1PCFGLbits.PCFG9); // RB9 analog ADC1CH9
    //Configure ADxCON1
    SETBIT(AD1CON1bits.AD12B); //set 12b Operation Mode
    AD1CON1bits.FORM = 0; //set integer output
    AD1CON1bits.SSRC = 0x7; //set automatic conversion
    //Configure ADxCON2
    AD1CON2 = 0; //not using scanning sampling
    //Configure ADxCON3
    CLEARBIT(AD1CON3bits.ADRC); //internal clock source
    AD1CON3bits.SAMC = 0x1F; //sample-to-conversion clock = 31Tad
    AD1CON3bits.ADCS = 0x2; //Tad = 3Tcy (Time cycles)
    //Leave ADxCON4 at its default value
    //enable ADC
    SETBIT(AD1CON1bits.ADON);
}
开发者ID:ericmeyers12,项目名称:Embedded_Systems_dsPIC_MCU_Work,代码行数:28,代码来源:flextouch.c

示例6: SETBIT

/**
 * set a single port to Output or Input - function requrired for wiringPi interface
 * @param pin - port relative to pinBase
 * @param newMode - 0 - Output; 1 - Input
 * @return new value of complete port
 */
int Max7312::configPort(int pin, bool newMode){
   if (isLowerPort(pin)) {
      if(newMode)
      {
         SETBIT(_port1_mode, (GET_LOWER_PIN_ID(pin)));
      }
      else
      {
         CLEARBIT(_port1_mode, (GET_LOWER_PIN_ID(pin)));
      }
      configPort1(_port1_mode);
      return _port1_mode;
   } else {
      if(newMode)
      {
         SETBIT(_port2_mode, (GET_HIGHER_PIN_ID(pin)));
      }
      else
      {
         CLEARBIT(_port2_mode, (GET_HIGHER_PIN_ID(pin)));
      }
      configPort2(_port2_mode);
      return _port2_mode;
   }
}
开发者ID:Rosi2143,项目名称:HouseWorkspace,代码行数:31,代码来源:Max7312.cpp

示例7: touch_select_dim

void touch_select_dim(uint8_t dim){
    /*
    if (dim == 1){ // x
        //set up the I/O pins E1, E2, E3 so that the touchscreen X-coordinate pin
        //connects to the ADC
        CLEARBIT(PORTEbits.RE1);
        SETBIT(PORTEbits.RE2);
        SETBIT(PORTEbits.RE3);
    }else if (dim == 2){ // y
        SETBIT(PORTEbits.RE1);
        CLEARBIT(PORTEbits.RE2);
        CLEARBIT(PORTEbits.RE3);
    } else{
        SETBIT(PORTEbits.RE1);
        SETBIT(PORTEbits.RE2);
        CLEARBIT(PORTEbits.RE3);
    }
    */
    if (dim == 1){ // x
        //set up the I/O pins E1, E2, E3 so that the touchscreen X-coordinate pin
        //connects to the ADC
        CLEARBIT(LATEbits.LATE1);
        SETBIT(LATEbits.LATE2);
        SETBIT(LATEbits.LATE3);
    }else if (dim == 2){ // y
        SETBIT(LATEbits.LATE1);
        CLEARBIT(LATEbits.LATE2);
        CLEARBIT(LATEbits.LATE3);
    } else{
        SETBIT(LATEbits.LATE1);
        SETBIT(LATEbits.LATE2);
        CLEARBIT(LATEbits.LATE3);
    }
}
开发者ID:ericmeyers12,项目名称:Embedded_Systems_dsPIC_MCU_Work,代码行数:34,代码来源:flextouch.c

示例8: key

static void key(byte mode) 
/*! 
 @brief     Keys the transmitter and produces a sidetone
 
 .. but only if the corresponding functions (TXKEY and SIDETONE) have been set in
 the feature register. This function also handles a request to invert the keyer line
 if necessary (TXINV bit).
 
 This is a private function.

 @param mode    UP or DOWN
 
 */
{
	
    if (mode == DOWN) 
    {
        if (volflags & SIDETONE) // Are we generating a Sidetone?
        {
            OCR0A = ctcvalue;		// Then switch on the Sidetone generator
            OCR0B = ctcvalue;
            
            // Activate CTC mode
            TCCR0A |= (1<<COM0B0 | 1<<WGM01);
            
            // Configure prescaler
            TCCR0B = 1<<CS01;
        }
        
        if (volflags & TXKEY) // Are we keying the TX?
        {
            if (yackflags & TXINV) // Do we need to invert keying?
                CLEARBIT(OUTPORT,OUTPIN);
            else
                SETBIT(OUTPORT,OUTPIN);
        }

    }
    
    if (mode == UP) 
    {

        if (volflags & SIDETONE) // Sidetone active?
        {
            TCCR0A = 0;
            TCCR0B = 0;
        }
        
        if (volflags & TXKEY) // Are we keying the TX?
        {
            if (yackflags & TXINV) // Do we need to invert keying?
                SETBIT(OUTPORT,OUTPIN);
            else
                CLEARBIT(OUTPORT,OUTPIN);
        }

    }
    
}
开发者ID:denrusio,项目名称:vak-opensource,代码行数:59,代码来源:yack.c

示例9: timedAlarmCheck

void timedAlarmCheck(void)
{
	for (uint8_t alarm=1; alarm<=4; alarm++)
	{
		uint16_t pos = 400 + ((alarm-1)*15); //400 415 430 445

		if (eepromReadByte(pos+0) == 1)
		{
				uint8_t sensorpos = findSensor(
				eepromReadByte(pos+1),
				eepromReadByte(pos+2),
				eepromReadByte(pos+3),
				eepromReadByte(pos+4),
				eepromReadByte(pos+5),
				eepromReadByte(pos+6),
				eepromReadByte(pos+7),
				eepromReadByte(pos+8));

				int8_t value = (int8_t)sensorValues[(sensorpos*SENSORSIZE)+VALUE1];
				char sign = sensorValues[(sensorpos*SENSORSIZE)+SIGN];
				if (sign == '-') value *= -1;

				int8_t target = eepromReadByteSigned(pos+10);

				if (
					(eepromReadByte(pos+9) == 1 && value < target)
					||
					(eepromReadByte(pos+9) == 2 && value == target)
					||
					(eepromReadByte(pos+9) == 3 && value > target)
				)
				{
					//ALARM
					//DDR=in/out PIN=value/pullup PORT=state
					uint8_t pin = eepromReadByte(pos+11);

					if (pin >= 1 && pin <= 4)
					{
						if (eepromReadByte(pos+12) == 1)
						{
							SETBIT(PORTC, (1+pin));
						}
						else
							CLEARBIT(PORTC, (1+pin));
					}
 				} else if (eepromReadByte(pos+13) == 1) {
 					//REVERSE
					uint8_t pin = eepromReadByte(pos+11);
					if (pin >= 1 && pin <= 4)
					{
						if (eepromReadByte(pos+12) == 1)
							CLEARBIT(PORTC, (1+pin));
						else
							SETBIT(PORTC, (1+pin));
					}
 				}
		}
	}
}
开发者ID:jaseg,项目名称:avr-uip,代码行数:59,代码来源:main.c

示例10: main

void main(){
	//Init LCD
	__C30_UART=1;	
	lcd_initialize();
	lcd_clear();
        touch_init();

        CLEARBIT(T1CONbits.TON); // Disable Timer
        CLEARBIT(T1CONbits.TCS); // Select internal instruction cycle clock
        CLEARBIT(T1CONbits.TGATE); // Disable Gated Timer mode
        TMR1 = 0x00; // Clear timer register
        T1CONbits.TCKPS = 0b10; // Select 1:64 Prescaler
        PR1 = 2000; // Load the period value
        IPC0bits.T1IP = 0x01; // Set Timer1 Interrupt Priority Level
        CLEARBIT(IFS0bits.T1IF); // Clear Timer1 Interrupt Flag
        SETBIT(IEC0bits.T1IE); // Enable Timer1 interrupt



        while(1) {
            int i = 0;

            
            
            touch_select_dim(0);
            lock = 1;
            TMR1 = 0x00;
            SETBIT(T1CONbits.TON); // Start Timer
            while(lock);
            
            for (i = 0; i < 5; i++) {
                xs[i] = touch_adc();
            }

            // read y
            touch_select_dim(1);
            lock = 1;
            TMR1 = 0x00;
            SETBIT(T1CONbits.TON); // Start Timer
            while(lock);
            for (i = 0; i < 5; i++) {
                ys[i] = touch_adc();
            }

            

            qsort(xs, 5, sizeof(uint16_t), cmpfunc);
            qsort(ys, 5, sizeof(uint16_t), cmpfunc);

            lcd_locate(0,0);
            lcd_printf("x position:             ");
            lcd_locate(0,0);
            lcd_printf("x position: %d", xs[2]);
            lcd_locate(0,1);
            lcd_printf("y position:             ");
            lcd_locate(0,1);
            lcd_printf("y position: %d", ys[2]);
        }
}
开发者ID:LeonHeTheFirst,项目名称:Embedded-Projects,代码行数:59,代码来源:main.c

示例11: lcd_spi_transmit_CMD

void lcd_spi_transmit_CMD(unsigned char temp){
   CLEARBIT(PORTB,RS);
   CLEARBIT(PORTB,SS_bar);
   SPDR = temp;
   while(!TESTBIT(SPSR,SPIF));
   SPSR &= 0x7F;
   SETBIT(PORTB, SS_bar);
 }
开发者ID:ZLAllen,项目名称:Temperature_monitor_system,代码行数:8,代码来源:LCD_Driver.c

示例12: if

/*!
 * \brief   sends a chunk of data and does not block
 * \param   thisport = which port to use
 * \param	data = pointer to data to send
 * \param	length = number of bytes to send
 * \return	SSP_TX_BUFOVERRUN = tried to send too much data
 * \return	SSP_TX_WAITING = data sent and waiting for an ack to arrive
 * \return	SSP_TX_BUSY = a packet has already been sent, but not yet acked
 *
 * \note
 *
 */
int16_t qssp::ssp_SendData(const uint8_t *data, const uint16_t length )
{

    int16_t value = SSP_TX_WAITING;

    if( (length + 2) > thisport->txBufSize ) {
        // TRYING to send too much data.
        value = SSP_TX_BUFOVERRUN;
    } else if( thisport->SendState == SSP_IDLE ) {
#ifdef ACTIVE_SYNCH
        if( thisport->sendSynch == TRUE )  {
            sf_SendSynchPacket();
        }
#endif

#ifdef SYNCH_SEND
        if( length == 0 ) {
            // TODO this method could allow a task/user to start a synchronisation step if a zero is mistakenly passed to this function.
            //      could add a check for a NULL data pointer, or use some sort of static flag that can only be accessed by a static function
            //      that must be called before calling this function.
            // we are attempting to send a synch packet
            thisport->txSeqNo = 0;                        // make this zero to cause the other end to re-synch with us
            SETBIT(thisport->flags, SENT_SYNCH);
        } else {
            // we are sending a data packet
            CLEARBIT( thisport->txSeqNo, ACK_BIT );     // make sure we are not sending a ACK packet
            thisport->txSeqNo++;                        // update the sequence number.
            if( thisport->txSeqNo > 0x7F) {             // check for sequence number rollover
                thisport->txSeqNo = 1;                  // if we do have rollover then reset to 1 not zero,
                // zero is reserviced for synchronization requests
            }
        }

#else
        CLEARBIT( thisport->txSeqNo, ACK_BIT );     // make sure we are not sending a ACK packet
        thisport->txSeqNo++;                        // update the sequence number.
        if( thisport->txSeqNo > 0x7F) {             // check for sequence number rollover
            thisport->txSeqNo = 1;                  // if we do have rollover then reset to 1 not zero,
            // zero is reserved for synchronization requests
        }
#endif
        CLEARBIT( thisport->flags, ACK_RECEIVED);
        thisport->SendState = SSP_AWAITING_ACK;
        value = SSP_TX_WAITING;
        thisport->retryCount = 0;				// zero out the retry counter for this transmission
        sf_MakePacket( thisport->txBuf, data, length, thisport->txSeqNo );
        sf_SendPacket( );				// punch out the packet to the serial port
        sf_SetSendTimeout(  );	// do the timeout values
         if (debug)
             qDebug()<<"Sent DATA PACKET:"<<thisport->txSeqNo;
    } else {
        // error we are already sending a packet. Need to wait for the current packet to be acked or timeout.
        value = SSP_TX_BUSY;
         if (debug)
             qDebug()<<"Error sending TX was busy";
    }
    return value;
}
开发者ID:BangBo,项目名称:OpenPilot,代码行数:70,代码来源:qssp.cpp

示例13: led_init

void led_init(void)
{
  LEDDIR |= _BV(LEDBIT);

  CLEARBIT(PINSEL1, 28);
  CLEARBIT(PINSEL1, 29);

  led_off();
}
开发者ID:gluke77,项目名称:arm-reeler,代码行数:9,代码来源:led.c

示例14: lcd_spi_transmit_DATA

/*
;*********************************
 NAME:       lcd_spi_transmit_DATA
 ASSUMES:    temp = byte to transmit to LCD.
             SPI port is configured.
 RETURNS:    nothing
 MODIFIES:   temp, SPCR
 CALLED BY:  init_dsp, update
 DESCRITION: outputs a byte passed in r16 via SPI port. Waits for
             data to be written by spi port before continuing.
 *****************************************************************
 */
  void lcd_spi_transmit_DATA(unsigned char data){
    PORTB = (1 << RS);
    CLEARBIT(PORTB, SS_bar);
    CLEARBIT(SPSR, SPIF);
    SPDR = data;
    while(!TESTBIT(SPSR,SPIF));
    SPSR &= 0x7F;
    SETBIT(PORTB, SS_bar);
  }
开发者ID:ZLAllen,项目名称:Temperature_monitor_system,代码行数:21,代码来源:LCD_Driver.c

示例15: initialize

//intialize
void initialize(void){
    size_t i;
    //bit-array set to one
    for (i = 0; i < size; i++ ){
        SETBIT(threadstack, i);
    }
    CLEARBIT(threadstack, 0);
    CLEARBIT(threadstack, 1);
    //http://www.mathcs.emory.edu/~cheung/Courses/255/Syllabus/1-C-intro/bit-array.html
    
}
开发者ID:disatapp,项目名称:Operating-Systems,代码行数:12,代码来源:primepthread.c


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