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


C++ HIGH函数代码示例

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


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

示例1: array_offset

static int 
array_offset(int* arrayinfo, ...)
{
    int i = 0;
    int s = 0;
    int loc = 0;
    int space = 1;
    va_list list;

    va_start(list, arrayinfo);
    for (i = 1; i <= arrayinfo[0]; i++)
    {
        s = va_arg(list, int);

        if (s < arrayinfo[LOW(i)] || s > arrayinfo[HIGH(i)])
        {
            va_end(list);

            return -1;
        }

        space *= (arrayinfo[HIGH(i-1)]-arrayinfo[LOW(i-1)]+1);
        loc += (s-arrayinfo[LOW(i)])*space;
    }
    va_end(list);

    return loc;
}
开发者ID:codeliuer,项目名称:learn-code,代码行数:28,代码来源:array_offset2.c

示例2: insert_level

static void insert_level(int levToInsert) {
	int n;
    for (n = 2; n < bddnodesize; n++) {
        int lev, lo, hi, newLev, hash, r, r2, NEXT_r;
        if (LOW(n) == INVALID_BDD) continue;
        lev = LEVEL(n);
        if (lev <= levToInsert || lev == bddvarnum-1) {
            continue;
        }
        lo = LOW(n);
        hi = HIGH(n);
        newLev = lev+1;
        hash = NODEHASH(lev, lo, hi);
        r = HASH(hash);
        r2 = 0;
        while (r != n && r != 0) {
            r2 = r;
            r = NEXT(r);
        }
        NEXT_r = NEXT(r);
        if (r2 == 0) {
            SETHASH(hash, NEXT_r);
        } else {
            SETNEXT(r2, NEXT_r);
        }
        SETLEVEL(n, newLev);
        lo = LOW(n); hi = HIGH(n);
        hash = NODEHASH(newLev, lo, hi);
        r = HASH(hash);
        SETHASH(hash, n);
        SETNEXT(n, r);
    }
}
开发者ID:UGent-HES,项目名称:javabdd,代码行数:33,代码来源:kernel.c

示例3: GetICCStatus

/**
 * Get ICC status
 *
 * @param ctx Reader context
 * @param lr Length of response
 * @param rsp Response buffer
 * @return \ref OK, \ref ERR_CT, \ref ERR_MEMORY
 */
int GetICCStatus(struct scr *ctx, unsigned int *lr, unsigned char *rsp)
{
	int status;

	status = PC_to_RDR_GetSlotStatus(ctx);

	if (status < 0) {
		rsp[0] = HIGH(NOT_SUCCESSFUL);
		rsp[1] = LOW(NOT_SUCCESSFUL);
		*lr = 2;
		return ERR_CT;
	}

	if (*lr < 5) {
		return ERR_MEMORY;
	}

	rsp[0] = 0x80;
	rsp[1] = 0x01;
	rsp[2] = 0x00; /* Set ICC Status DO - default is no ICC present */

	if (status == ICC_PRESENT_AND_INACTIVE) {
		rsp[2] |= 0x03; /* card in, no CVCC                  */
	}

	if (status == ICC_PRESENT_AND_ACTIVE) {
		rsp[2] |= 0x05; /* card in, CVCC on                  */
	}

	rsp[3] = HIGH(SMARTCARD_SUCCESS);
	rsp[4] = LOW(SMARTCARD_SUCCESS);
	*lr = 5;

	return OK;
}
开发者ID:CardContact,项目名称:sc-hsm-embedded,代码行数:43,代码来源:ctbcs.c

示例4: bdd_scanset

/*
NAME    {* bdd\_scanset *}
SECTION {* kernel *}
SHORT   {* returns an integer representation of a variable set *}
PROTO   {* int bdd_scanset(BDD r, int **v, int *n) *}
DESCR   {* Scans a variable set {\tt r} and copies the stored variables into
           an integer array of variable numbers. The argument {\tt v} is
	   the address of an integer pointer where the array is stored and
	   {\tt n} is a pointer to an integer where the number of elements
	   are stored. It is the users responsibility to make sure the
	   array is deallocated by a call to {\tt free(v)}. The numbers
	   returned are guaranteed to be in ascending order. *}
ALSO    {* bdd\_makeset *}
RETURN  {* Zero on success, otherwise a negative error code. *}
*/
int bdd_scanset(BDD r, int **varset, int *varnum)
{
   int n, num;

   CHECK(r);
   if (r < 2)
   {
      *varnum = 0;
      *varset = NULL;
      return 0;
   }
   
   for (n=r, num=0 ; n > 1 ; n=HIGH(n))
      num++;

   if (((*varset) = (int *)malloc(sizeof(int)*num)) == NULL)
      return bdd_error(BDD_MEMORY);
   
   for (n=r, num=0 ; n > 1 ; n=HIGH(n))
      (*varset)[num++] = bddlevel2var[LEVEL(n)];

   *varnum = num;

   return 0;
}
开发者ID:RCambier,项目名称:EmbeddedAndVerification,代码行数:40,代码来源:kernel.c

示例5: right_rotate

void right_rotate(Node* &T, Node *x)
{
	if (NIL == LEFT(x))
		return;

	Node *y = LEFT(x);

	// y的右孩子挂到x的左孩子
	LEFT(x) = RIGHT(y);
	if (NIL != RIGHT(y))
		PARENT(RIGHT(y)) = x;
	
	// x的父亲作为y的父亲
	PARENT(y) = PARENT(x);

	// x是根节点,则y是新的根;否则,把y挂到x的父节点下
	if (NIL == PARENT(x)) {
		T = y;
	} else if (IS_LEFT(x)) {
		LEFT(PARENT(x)) = y;
	} else {
		RIGHT(PARENT(x)) = y;
	}

	// 把x挂到y的右孩子
	RIGHT(y) = x;
	PARENT(x) = y;

	// 重新计算x和y的max值
	MAX(x) = max(MAX(LEFT(x)), MAX(RIGHT(x)), HIGH(KEY(x)));
	MAX(y) = max(MAX(LEFT(y)), MAX(RIGHT(y)), HIGH(KEY(y)));
}
开发者ID:jarfield,项目名称:SolutionToCLR2nd,代码行数:32,代码来源:tree.cpp

示例6: GetStatus

/**
 * CT-BCS Get Status command
 *
 * @param ctx Reader context
 * @param cmd Command
 * @param lr Length of response
 * @param rsp Response buffer
 * @return \ref OK, \ref ERR_CT, \ref ERR_MEMORY
 */
int GetStatus(struct scr *ctx, unsigned char *cmd, unsigned int *lr,
			  unsigned char *rsp)
{
	int response;
	unsigned char func_unit = cmd[2];
	unsigned char what = cmd[3];

#ifdef DEBUG
	ctccid_debug("GetStatus(FU=%02x,%02x)\n", func_unit, what);
#endif

	if (func_unit == 0x00) {

		switch (what) {

		case 0x46: /* Card Manufacturer DO */

			if (*lr < 19) {
				return ERR_MEMORY;
			}

			memcpy(rsp, "\x46\x0F" "DESCMSCR3X00000", 17);
			rsp[17] = HIGH(SMARTCARD_SUCCESS);
			rsp[18] = LOW(SMARTCARD_SUCCESS);
			*lr = 17 + 2;
			break;

		case 0x80: /* ICC Status DO */

			if ((response = GetICCStatus(ctx, lr, rsp)) < 0) {
				return response;
			}

			break;

		case 0x81: /* Functional Unit DO */

			if (*lr < 5) {
				return ERR_MEMORY;
			}

			rsp[0] = 0x81; /* TAG */
			rsp[1] = 0x01; /* Length of following data */
			rsp[2] = 0x01; /* Status for CT/ICC-Interface1 */
			rsp[3] = HIGH(SMARTCARD_SUCCESS);
			rsp[4] = LOW(SMARTCARD_SUCCESS);
			*lr = 5;
			break;
		}

	} else {
		if ((response = GetICCStatus(ctx, lr, rsp)) < 0) {
			return response;
		}
	}

	return OK;
}
开发者ID:CardContact,项目名称:sc-hsm-embedded,代码行数:67,代码来源:ctbcs.c

示例7: lcd_dummy_read

void lcd_dummy_read(uint8_t chip)
{
	wait_while_busy(chip);
	HIGH(RW_PORT, RW_PIN);//read
	HIGH(RS_PORT, RS_PIN);//data
	HIGH(EN_PORT, EN_PIN);
	_delay_us(2);//>1000ns
	LOW(EN_PORT, EN_PIN);
}
开发者ID:leckardt,项目名称:glcd,代码行数:9,代码来源:lcd.c

示例8: lcd_data_read

uint8_t lcd_data_read(uint8_t chip)
{
	wait_while_busy(chip);
	uint8_t data;
	HIGH(RW_PORT, RW_PIN);//read
	HIGH(RS_PORT, RS_PIN);//data
	data = lcd_read();
	return data;
}
开发者ID:leckardt,项目名称:glcd,代码行数:9,代码来源:lcd.c

示例9: RequestICC

/**
 * CT-BCS Request ICC command
 *
 * @param ctx Reader context
 * @param lc Length of command
 * @param cmd Command
 * @param lr Length of response
 * @param rsp Response buffer
 * @return \ref OK, \ref ERR_CT, \ref ERR_MEMORY
 */
int RequestICC(struct scr *ctx, unsigned int lc, unsigned char *cmd,
			   unsigned int *lr, unsigned char *rsp)
{
	int status, timeout;

	if ((lc > 4) && (cmd[4] == 1)) {
		timeout = cmd[5];
	} else {
		timeout = 0;
	}

	status = PC_to_RDR_GetSlotStatus(ctx);

	if (status < 0) {
		rsp[0] = HIGH(NOT_SUCCESSFUL);
		rsp[1] = LOW(NOT_SUCCESSFUL);
		*lr = 2;
		return ERR_CT;
	}

	timeout *= 4;

	do {

		status = PC_to_RDR_GetSlotStatus(ctx);

		if (status < 0) {
			rsp[0] = HIGH(NOT_SUCCESSFUL);
			rsp[1] = LOW(NOT_SUCCESSFUL);
			*lr = 2;
			return ERR_CT;
		}

		if ((status == ICC_PRESENT_AND_INACTIVE) || !timeout) {
			break;
		}

		usleep(250000);
		timeout--;
	} while (timeout);

	if (!timeout && (status == NO_ICC_PRESENT)) {
		rsp[0] = HIGH(W_NO_CARD_PRESENTED);
		rsp[1] = LOW(W_NO_CARD_PRESENTED);
		*lr = 2;
		return OK;
	}

	if ((status = ResetCard(ctx, lc, cmd, lr, rsp)) < 0) {
		return status;
	}

	return OK;
}
开发者ID:CardContact,项目名称:sc-hsm-embedded,代码行数:64,代码来源:ctbcs.c

示例10: push

static ssize_t
push (gnutls_transport_ptr_t tr, const void *data, size_t len)
{
int fd = (long int)tr;

  if (to_send >= 0 && len < HIGH(MAX_BUF))
    {
      fail("Sent data (%u) are lower than expected (%u)\n", (unsigned)len, (unsigned)HIGH(MAX_BUF));
      terminate();
    }
  return send(fd, data, len, 0);
}
开发者ID:frankmorgner,项目名称:gnutls,代码行数:12,代码来源:mini-record-range.c

示例11: wait_while_busy

void wait_while_busy(uint8_t chip)
{
	lcd_select_chip(chip);
	HIGH(RW_PORT, RW_PIN);
	LOW(RS_PORT, RS_PIN);
	DATA_PORT = 0x00;
	DATA_DDR = 0x00;
	HIGH(EN_PORT, EN_PIN);
	_delay_us(2);//>1000ns
	LOW(EN_PORT, EN_PIN);
	while (LCD_BUSY & DATA_PIN);
	DATA_DDR = 0xFF;
}
开发者ID:leckardt,项目名称:glcd,代码行数:13,代码来源:lcd.c

示例12: i2clcd_init

uint32_t i2clcd_init( unsigned char contrast)
{
	OUTPUT(1, I2C_LCD_RST);

	LOW(1, I2C_LCD_RST);
	wait_ms(10);
	HIGH(1, I2C_LCD_RST);

	wait_ms(40);
	i2c_cmd(0x38);//0b00111000); // function set
	i2c_cmd(0x39);//0b00111001); // function set
	i2c_cmd(0x14);//0b00010100); // interval osc
	i2c_cmd(0x70 | (contrast & 0xF)); // contrast Low
        
	//i2c_cmd(0b01011100 | ((contrast >> 4) & 0x3)); // contast High/icon/power
	i2c_cmd(0x5C | ((contrast >> 4) & 0x3)); // contast High/icon/power
	i2c_cmd(0x6C); // follower control
	wait_ms(300);

	i2c_cmd(0x38);//0b00111000); // function set
	i2c_cmd(0x0c);//0b00001100); // Display On
	
	i2c_cmd(0x01);//0b00000001); // Clear Display
	wait_ms(2);			 // Clear Display�͒lj��E�F�C�g���K�v
  
  	return 0;
}
开发者ID:ADTL,项目名称:ARMWork,代码行数:27,代码来源:i2clcd.c

示例13: read_dht11

dht11_status read_dht11(dht11_data *data) {
  OUTPUT(DHT_PIN);
  LOW(DHT_PIN); // send DHT wakeup signal
  _delay_ms(18);
  HIGH(DHT_PIN);
  _delay_us(40);
  INPUT(DHT_PIN);

  if(!listen_edge(false, 0, 100)) // hold for DHT ack signal, 80us
    return bad_ack;

  _delay_us(5);
  if(!listen_edge(true, 0, 100)) // pre-transmission pause from DHT
    return bad_post_ack;

  union _dht_output raw = { .bytes={0} };
  for(uint8_t byte = 0; byte < sizeof(raw); byte++) {
    for(int8_t bit = 7; bit >= 0; bit--) {
      if(!listen_edge(false, 20, 80)) // 50us bit prelude
        return bad_bit_prelude;
      uint8_t bit_length = listen_edge(true, 10, 90); // bit signal - 26-28us for 0 70us for 1
      if(!bit_length)
        return bad_bit_data_pause; // invalid data pulse
      if(bit_length > 30)
        raw.bytes[byte] |= _BV(bit);
    }
  }

  if(raw.data.checksum != (uint8_t)(raw.bytes[0]+raw.bytes[1]+raw.bytes[2]+raw.bytes[3]))
    return bad_checksum;

  memcpy(data, &raw.data.inner, sizeof(dht11_data));
  return success;
}
开发者ID:projectgus,项目名称:flatdrier,代码行数:34,代码来源:dht11.c

示例14: lcd_data_write

void lcd_data_write(uint8_t data, uint8_t chip)
{
	wait_while_busy(chip);
	LOW(RW_PORT, RW_PIN);//write
	HIGH(RS_PORT, RS_PIN);//data
	lcd_write(data, chip);
}
开发者ID:leckardt,项目名称:glcd,代码行数:7,代码来源:lcd.c

示例15: drvEEPROMWriteBlock

///////////////////////////////////////////////////////////////////////////////
// write block to eeprom
void drvEEPROMWriteBlock( dosWord in_address, dosByte* in_buffer, dosWord in_length)
{
	dosWord i;
	
	// erase sector
	drvEEPROMSectorErase( in_address );
			
	// Set the Write Enable Latch
	drvEEPROMWriteEnable();
	
	// perform the write sequence
	EEPROMCS(PIN_LOW);												// select the Serial EEPROM
	EEPROMSendReceiveByte(SEE_WRITE);					// write command
	EEPROMSendReceiveByte( l_address_highest );	// address highest first
	EEPROMSendReceiveByte(HIGH(in_address));	// address MSB first
	EEPROMSendReceiveByte(LOW(in_address));		// address LSB (word aligned)

	// read block data
	for( i = 0; i < in_length; i++ )
	{
		EEPROMSendReceiveByte(in_buffer[i]); // read dummy, write byte
	}

	// relase CS
	EEPROMCS(PIN_HIGH);										// deselect terminate command

	// wait for busy	
	drvEEPROMWaitForBusy( 20 );
}
开发者ID:hightower70,项目名称:CygnusFlightControllerDev,代码行数:31,代码来源:drvW25Xxx.c


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