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


C++ BYTE1函數代碼示例

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


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

示例1:

void ANO_DT::Send_Senser2(s32 alt_bar,u16 alt_csb)
{
	u8 _cnt=0;
	vs32 _temp;
	
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x07;
	data_to_send[_cnt++]=0;
	
	_temp = alt_bar;
	data_to_send[_cnt++]=BYTE3(_temp);
	data_to_send[_cnt++]=BYTE2(_temp);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	_temp = alt_csb;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);

	data_to_send[3] = _cnt-4;
	
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	data_to_send[_cnt++] = sum;
	
	Send_Data(data_to_send, _cnt);
}
開發者ID:YuMeiLau,項目名稱:UAV,代碼行數:28,代碼來源:ANO_DT.cpp

示例2: write_multibyte

static void write_multibyte(long i)
{
    if (BYTE1(i) != 0) buffer[last++] = BYTE1(i);
    if (BYTE2(i) != 0) buffer[last++] = BYTE2(i);
    /* always */       buffer[last++] = BYTE3(i);
    /* always */       buffer[last++] = BYTE4(i);
}
開發者ID:clerkma,項目名稱:ptex-ng,代碼行數:7,代碼來源:ptexenc.c

示例3: Data_Send_VOTAGE

void Data_Send_VOTAGE(void)
{
	u8 _cnt=0;
	float adc;
	adc = (ADC_ConvertedValue / 4096.0) * 3.3 * 11.0;
	ADC_ConvertedValue = (u32)(adc * 100);
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x05;
	data_to_send[_cnt++]=0;
	data_to_send[_cnt++]=BYTE1(ADC_ConvertedValue);
	data_to_send[_cnt++]=BYTE0(ADC_ConvertedValue);
	data_to_send[_cnt++]=BYTE1(ADC_ConvertedValue);
	data_to_send[_cnt++]=BYTE0(ADC_ConvertedValue);
	data_to_send[_cnt++]=BYTE1(ADC_ConvertedValue);
	data_to_send[_cnt++]=BYTE0(ADC_ConvertedValue);
	data_to_send[_cnt++]=BYTE1(ADC_ConvertedValue);
	data_to_send[_cnt++]=BYTE0(ADC_ConvertedValue);
	
	data_to_send[3] = _cnt-4;
	
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	
	data_to_send[_cnt++]=sum;
	
#ifdef DATA_TRANSFER_USE_USART
	Uart2_Put_Buf(data_to_send,_cnt);
#else
	NRF_TxPacket(data_to_send,_cnt);
#endif
}
開發者ID:guruebaran,項目名稱:fly0513,代碼行數:33,代碼來源:Data_Transfer.c

示例4: Data_Send_MotoPWM

//■4:發送PWM值
void Data_Send_MotoPWM(void)
{
	u8 _cnt=0;
	u8 i;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x06;
	data_to_send[_cnt++]=0;
	data_to_send[_cnt++]=BYTE1(Pwm_Para.motor_front_pwm);
	data_to_send[_cnt++]=BYTE0(Pwm_Para.motor_front_pwm);
	data_to_send[_cnt++]=BYTE1(Pwm_Para.motor_back_pwm);
	data_to_send[_cnt++]=BYTE0(Pwm_Para.motor_back_pwm);
	data_to_send[_cnt++]=BYTE1(Pwm_Para.motor_left_pwm);
	data_to_send[_cnt++]=BYTE0(Pwm_Para.motor_left_pwm);
	data_to_send[_cnt++]=BYTE1(Pwm_Para.motor_right_pwm);
	data_to_send[_cnt++]=BYTE0(Pwm_Para.motor_right_pwm);  //四個電機油門

	data_to_send[3] = _cnt-4;

	u8 sum = 0;
	for(i=0;i<_cnt;i++)
		sum += data_to_send[i];

	data_to_send[_cnt++]=sum;

	Uart0_Put_Buf(data_to_send,_cnt);
}
開發者ID:zcatao,項目名稱:FourAxis,代碼行數:28,代碼來源:bluth.c

示例5: Send_Status

void ANO_DT::Send_Status(void)
{
	u8 _cnt=0;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x01;
	data_to_send[_cnt++]=0;
	vs16 _temp;
	_temp = (int)(imu.angle.x*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	_temp = (int)(imu.angle.y*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	_temp = (int)(imu.angle.z*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	vs32 _temp2 = 0;//UltraAlt * 100;
	data_to_send[_cnt++]=BYTE3(_temp2);
	data_to_send[_cnt++]=BYTE2(_temp2);
	data_to_send[_cnt++]=BYTE1(_temp2);
	data_to_send[_cnt++]=BYTE0(_temp2);
	
	data_to_send[3] = _cnt-4;
	
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	data_to_send[_cnt++]=sum;
	
	Send_Data(data_to_send, _cnt);
}
開發者ID:yangshishu,項目名稱:HexCopter,代碼行數:32,代碼來源:ANO_DT.cpp

示例6: Data_Send_MotoPWM

/* -------------發送PWM值---------------------------- */
void Data_Send_MotoPWM(void)
{
	uint8_t _cnt=0;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x02;
//	data_to_send[_cnt++]=0x06;
	data_to_send[_cnt++]=0;
	data_to_send[_cnt++]=BYTE1(MOTOR4);          //X軸正向電機
	data_to_send[_cnt++]=BYTE0(MOTOR4);          
	data_to_send[_cnt++]=BYTE1(MOTOR3);          //X軸負向電機
	data_to_send[_cnt++]=BYTE0(MOTOR3);
	data_to_send[_cnt++]=BYTE1(MOTOR2);          //Y軸正向電機
	data_to_send[_cnt++]=BYTE0(MOTOR2);
	data_to_send[_cnt++]=BYTE1(MOTOR1);          //Y軸負向電機
	data_to_send[_cnt++]=BYTE0(MOTOR1);
//	data_to_send[_cnt++]=BYTE1(Moto_PWM_5);
//	data_to_send[_cnt++]=BYTE0(Moto_PWM_5);
//	data_to_send[_cnt++]=BYTE1(Moto_PWM_6);
//	data_to_send[_cnt++]=BYTE0(Moto_PWM_6);
//	data_to_send[_cnt++]=BYTE1(Moto_PWM_7);
//	data_to_send[_cnt++]=BYTE0(Moto_PWM_7);
//	data_to_send[_cnt++]=BYTE1(Moto_PWM_8);
//	data_to_send[_cnt++]=BYTE0(Moto_PWM_8);
	
	data_to_send[3] = _cnt-4;
	
	uint8_t sum = 0;
	for(uint8_t i=0;i<_cnt;i++)
		sum += data_to_send[i];
	
	data_to_send[_cnt++]=sum;
	
	HAL_UART_Transmit_DMA(&huart2, data_to_send, _cnt);;
}
開發者ID:ageofflight,項目名稱:2015NUEDC,代碼行數:36,代碼來源:Data_Transfer.c

示例7: Data_Send_Voltage

void Data_Send_Voltage(T_RC_Voltage *data)
{
	rt_uint8_t _cnt=0;
	data_to_send[_cnt++]=0XAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x05;//µçѹ¹¦ÄÜ×Ö
	data_to_send[_cnt++]=0;
	
	rt_uint16_t _temp;//µçѹ¿Ï¶¨ÎªÕý
	_temp = data->Voltage1*100;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = data->Voltage2*100;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);	
	
	_temp =  data->Voltage3*100;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	data_to_send[3] = _cnt-4;
	
	
	rt_uint8_t sum = 0;
	for(rt_uint8_t i=0;i<_cnt;i++)
		sum += data_to_send[i];
	data_to_send[_cnt++]=sum;
	
	NRF24L01_TxPacket(data_to_send);
	
}
開發者ID:trigrass2,項目名稱:MircoFlyV0.7,代碼行數:32,代碼來源:transfer_app.c

示例8: ANO_DT_Send_Power

void ANO_DT_Send_Power(u16 votage, u16 current)
{
	u8 _cnt=0;
	u16 temp;
	
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x05;
	data_to_send[_cnt++]=0;
	
	temp = votage;
	data_to_send[_cnt++]=BYTE1(temp);
	data_to_send[_cnt++]=BYTE0(temp);
	temp = current;
	data_to_send[_cnt++]=BYTE1(temp);
	data_to_send[_cnt++]=BYTE0(temp);
	
	data_to_send[3] = _cnt-4;
	
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	
	data_to_send[_cnt++]=sum;
	
	ANO_DT_Send_Data(data_to_send, _cnt);
}
開發者ID:StefanJia,項目名稱:test2,代碼行數:27,代碼來源:ANO_DT.c

示例9: ixp4xx_copy_from

/*
 * The IXP4xx expansion bus only allows 16-bit wide acceses
 * when attached to a 16-bit wide device (such as the 28F128J3A),
 * so we can't just memcpy_fromio().
 */
static void ixp4xx_copy_from(struct map_info *map, void *to,
                             unsigned long from, ssize_t len)
{
    u8 *dest = (u8 *) to;
    void __iomem *src = map->virt + from;

    if (len <= 0)
        return;

    if (from & 1) {
        *dest++ = BYTE1(flash_read16(src-1));
        src++;
        --len;
    }

    while (len >= 2) {
        u16 data = flash_read16(src);
        *dest++ = BYTE0(data);
        *dest++ = BYTE1(data);
        src += 2;
        len -= 2;
    }

    if (len > 0)
        *dest++ = BYTE0(flash_read16(src));
}
開發者ID:jerem,項目名稱:hi35xx-buildroot,代碼行數:31,代碼來源:ixp4xx.c

示例10: ANO_DT_Send_Version

void ANO_DT_Send_Version(u8 hardware_type, u16 hardware_ver,u16 software_ver,u16 protocol_ver,u16 bootloader_ver)
{
	u8 _cnt=0;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x00;
	data_to_send[_cnt++]=0;
	
	data_to_send[_cnt++]=hardware_type;
	data_to_send[_cnt++]=BYTE1(hardware_ver);
	data_to_send[_cnt++]=BYTE0(hardware_ver);
	data_to_send[_cnt++]=BYTE1(software_ver);
	data_to_send[_cnt++]=BYTE0(software_ver);
	data_to_send[_cnt++]=BYTE1(protocol_ver);
	data_to_send[_cnt++]=BYTE0(protocol_ver);
	data_to_send[_cnt++]=BYTE1(bootloader_ver);
	data_to_send[_cnt++]=BYTE0(bootloader_ver);
	
	data_to_send[3] = _cnt-4;
	
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	data_to_send[_cnt++]=sum;
	
	ANO_DT_Send_Data(data_to_send, _cnt);
}
開發者ID:StefanJia,項目名稱:test2,代碼行數:27,代碼來源:ANO_DT.c

示例11: Data_Send_RCData

void Data_Send_RCData(void)
{
	u8 _cnt=0;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x03;
	data_to_send[_cnt++]=0;
	data_to_send[_cnt++]=BYTE1(Rc_D.THROTTLE);
	data_to_send[_cnt++]=BYTE0(Rc_D.THROTTLE);
	data_to_send[_cnt++]=BYTE1(Rc_D.YAW);
	data_to_send[_cnt++]=BYTE0(Rc_D.YAW);
	data_to_send[_cnt++]=BYTE1(Rc_D.ROLL);
	data_to_send[_cnt++]=BYTE0(Rc_D.ROLL);
	data_to_send[_cnt++]=BYTE1(Rc_D.PITCH);
	data_to_send[_cnt++]=BYTE0(Rc_D.PITCH);

	
	data_to_send[3] = _cnt-4;
	
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	
	data_to_send[_cnt++]=sum;
	
#ifdef DATA_TRANSFER_USE_USART
	Uart2_Put_Buf(data_to_send,_cnt);
#else
	NRF_TxPacket(data_to_send,_cnt);
#endif
}
開發者ID:guruebaran,項目名稱:fly0513,代碼行數:31,代碼來源:Data_Transfer.c

示例12: Data_Send_OFFSET

void Data_Send_OFFSET(void)
{
	u8 _cnt=0;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x16;
	data_to_send[_cnt++]=0;
	vs16 _temp = AngleOffset_Rol*1000;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	_temp = AngleOffset_Pit*1000;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	data_to_send[3] = _cnt-4;
	
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	
	data_to_send[_cnt++]=sum;
	
#ifdef DATA_TRANSFER_USE_USART
	Uart1_Put_Buf(data_to_send,_cnt);
#else
	NRF_TxPacket(data_to_send,_cnt);
#endif
}
開發者ID:kenziD,項目名稱:Other-People-Program,代碼行數:28,代碼來源:Data_Transfer.c

示例13: Data_Send_MotoPWM

void Data_Send_MotoPWM(void)
{
	vs16 a,b,c,d;
	a=Moto_PWM_1-1000;
	b=Moto_PWM_2-1000;
	c=Moto_PWM_3-1000;
	d=Moto_PWM_4-1000;
	u8 _cnt=0;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x06;
	data_to_send[_cnt++]=0;
	data_to_send[_cnt++]=BYTE1(a);//((Moto_PWM_1-1000));
	data_to_send[_cnt++]=BYTE0(a);//((Moto_PWM_1-1000));
	data_to_send[_cnt++]=BYTE1(b);//((Moto_PWM_2-1000));
	data_to_send[_cnt++]=BYTE0(b);//((Moto_PWM_2-1000));
	data_to_send[_cnt++]=BYTE1(c);//((Moto_PWM_3-1000));
	data_to_send[_cnt++]=BYTE0(c);//((Moto_PWM_3-1000));
	data_to_send[_cnt++]=BYTE1(d);//((Moto_PWM_4-1000));
	data_to_send[_cnt++]=BYTE0(d);//((Moto_PWM_4-1000));
	
	data_to_send[3] = _cnt-4;
	
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	
	data_to_send[_cnt++]=sum;
	
#ifdef DATA_TRANSFER_USE_USART
	Uart2_Put_Buf(data_to_send,_cnt);
#else
	NRF_TxPacket(data_to_send,_cnt);
#endif
}
開發者ID:guruebaran,項目名稱:fly0513,代碼行數:35,代碼來源:Data_Transfer.c

示例14: vtuDownsampleImageRGBA

uint32_t * vtuDownsampleImageRGBA(const uint32_t *tex)
{
	uint32_t *smallTex = (uint32_t *)malloc(c.pageDimension * c.pageDimension);
	assert(smallTex);

	for (uint16_t x = 0; x < c.pageDimension / 2; x++)
	{
		for (uint16_t y = 0; y < c.pageDimension / 2; y++)
		{
#ifdef COLOR_CODE_MIPPED_PHYSTEX
			smallTex[y * (c.pageDimension / 2) + x] = (255 << 24) + (0 << 16) + (0 << 8) + 255;
#else
			uint32_t pix1 = tex[(y*2) * c.pageDimension + (x*2)];
			uint32_t pix2 = tex[(y*2+1) * c.pageDimension + (x*2)];
			uint32_t pix3 = tex[(y*2) * c.pageDimension + (x*2+1)];
			uint32_t pix4 = tex[(y*2+1) * c.pageDimension + (x*2+1)];

			uint32_t b1 = BYTE1(pix1) + BYTE1(pix2) + BYTE1(pix3) + BYTE1(pix4);
			uint32_t b2 = BYTE2(pix1) + BYTE2(pix2) + BYTE2(pix3) + BYTE2(pix4);
			uint32_t b3 = BYTE3(pix1) + BYTE3(pix2) + BYTE3(pix3) + BYTE3(pix4);
			uint32_t b4 = BYTE4(pix1) + BYTE4(pix2) + BYTE4(pix3) + BYTE4(pix4);


			smallTex[y * (c.pageDimension / 2) + x] =  ((b4 / 4) << 24) + ((b3 / 4) << 16) + ((b2 / 4) << 8) + (b1 / 4); // ARGB
#endif
		}
	}

	return smallTex;
}
開發者ID:caomw,項目名稱:benthicQT,代碼行數:30,代碼來源:LibVT_Utilities.cpp

示例15: SendRcvControlQuantity

bool Communication::SendRcvControlQuantity(float aux1,float aux2,float aux3,float aux4,float aux5,float aux6)
{
	u8 _cnt=0;
	u8 data_to_send[30];
	vs16 _temp;
	
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x03;
	data_to_send[_cnt++]=0;
	
	data_to_send[_cnt++]=BYTE1(mRcvTargetThr);
	data_to_send[_cnt++]=BYTE0(mRcvTargetThr);
	
	data_to_send[_cnt++]=BYTE1(mRcvTargetYaw);
	data_to_send[_cnt++]=BYTE0(mRcvTargetYaw);
	
	data_to_send[_cnt++]=BYTE1(mRcvTargetRoll);
	data_to_send[_cnt++]=BYTE0(mRcvTargetRoll);
	
	data_to_send[_cnt++]=BYTE1(mRcvTargetPitch);
	data_to_send[_cnt++]=BYTE0(mRcvTargetPitch);
	
	
	_temp = (int)(aux1*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(aux2*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(aux3*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(aux4*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(aux5*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(aux6*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	


	data_to_send[3] = _cnt-4;
	u8 sum = 0;
	for(u8 i=0;i<_cnt;i++)
		sum += data_to_send[i];
	data_to_send[_cnt++] = sum;
	
	usart.SendData(data_to_send, _cnt);
	return true;
}
開發者ID:lissettecarlr,項目名稱:Quadcopter,代碼行數:59,代碼來源:Communication.cpp


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