当前位置: 首页>>代码示例>>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;未经允许,请勿转载。