• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BYTE0函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例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_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


示例8: 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


示例9: 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


示例10: 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


示例11:

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


示例12: 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


示例13: 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


示例14: NRF_Send_RC

void NRF_Send_RC(void)
{
	NRF24L01_TXDATA_RC[0] = 0x8A;	//源程序中为8A	遥控指令
	NRF24L01_TXDATA_RC[1] = 0x8A;	//源程序中为8A	遥控指令
	NRF24L01_TXDATA_RC[2] = 0x1C;
	NRF24L01_TXDATA_RC[3] = BYTE1(Rc_Get.THROTTLE);
	NRF24L01_TXDATA_RC[4] = BYTE0(Rc_Get.THROTTLE);

	NRF24L01_TXDATA_RC[5] = BYTE1(Rc_Get.YAW);
	NRF24L01_TXDATA_RC[6] = BYTE0(Rc_Get.YAW);
	NRF24L01_TXDATA_RC[7] = BYTE1(Rc_Get.ROLL);
	NRF24L01_TXDATA_RC[8] = BYTE0(Rc_Get.ROLL);
	NRF24L01_TXDATA_RC[9] = BYTE1(Rc_Get.PITCH);
	NRF24L01_TXDATA_RC[10] = BYTE0(Rc_Get.PITCH);
	
	NRF24L01_TXDATA_RC[11] = BYTE1(Rc_Get.AUX1);
	NRF24L01_TXDATA_RC[12] = BYTE0(Rc_Get.AUX1);
	NRF24L01_TXDATA_RC[13] = BYTE1(Rc_Get.AUX2);
	NRF24L01_TXDATA_RC[14] = BYTE0(Rc_Get.AUX2);
	NRF24L01_TXDATA_RC[15] = BYTE1(Rc_Get.AUX3);
	NRF24L01_TXDATA_RC[16] = BYTE0(Rc_Get.AUX3);
	NRF24L01_TXDATA_RC[17] = BYTE1(Rc_Get.AUX4);
	NRF24L01_TXDATA_RC[18] = BYTE0(Rc_Get.AUX4);
	NRF24L01_TXDATA_RC[19] = BYTE1(Rc_Get.AUX5);
	NRF24L01_TXDATA_RC[20] = BYTE0(Rc_Get.AUX5);
	
	u8 sum = 0;
	for(u8 i=0;i<31;i++)
		sum += NRF24L01_TXDATA_RC[i];
	NRF24L01_TXDATA_RC[31] = sum;
	NRF_SEND_RC_FLAG = 1;
}
开发者ID:JokerGeek,项目名称:Raging_Fire_Quad-rotor_Remote,代码行数:32,代码来源:Rc.c


示例15: test

void Communication::test(float a,float b,float c,float d,float e,float f,float g,float h,float i)
{
	u8 _cnt=0;
	vs16 _temp;
	u8 data_to_send[30];
	

	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x02;
	data_to_send[_cnt++]=0;
	
	
	_temp = (int)(a*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(b*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(c*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(d*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(e*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(f*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	
	_temp = (int)(g*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(h*100);
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = (int)(i*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);

}
开发者ID:lissettecarlr,项目名称:Quadcopter,代码行数:59,代码来源:Communication.cpp


示例16: SendPID

bool Communication::SendPID(u8 PIDnumber,float p1_p,float p1_i,float p1_d,float p2_p,float p2_i,float p2_d,float p3_p,float p3_i,float p3_d)
{
	u8 data_to_send[30]={0};
	//u8 _cnt=0;
	vs16 _temp=0;
	
	data_to_send[0]=0xAA;
	data_to_send[1]=0xAA;
	data_to_send[2]=PIDnumber;
	data_to_send[3]=18;
	
	_temp = (int)(p1_p*1000);
	data_to_send[4]=BYTE1(_temp);
	data_to_send[5]=BYTE0(_temp);
	
	_temp = (int)(p1_i*1000);
	data_to_send[6]=BYTE1(_temp);
	data_to_send[7]=BYTE0(_temp);
	
	_temp = (int)(p1_d*1000);
	data_to_send[8]=BYTE1(_temp);
	data_to_send[9]=BYTE0(_temp);
	
	_temp = (int)(p2_p*1000);
	data_to_send[10]=BYTE1(_temp);
	data_to_send[11]=BYTE0(_temp);
	
	_temp = (int)(p2_i*1000);
	data_to_send[12]=BYTE1(_temp);
	data_to_send[13]=BYTE0(_temp);
	
	_temp = (int)(p2_d*1000);
	data_to_send[14]=BYTE1(_temp);
	data_to_send[15]=BYTE0(_temp);
	
	_temp = (int)(p3_p*1000);
	data_to_send[16]=BYTE1(_temp);
	data_to_send[17]=BYTE0(_temp);
	
	_temp = (int)(p3_i*1000);	
	data_to_send[18]=BYTE1(_temp);
	data_to_send[19]=BYTE0(_temp);
	
	_temp = (int)(p3_d*1000);
	data_to_send[20]=BYTE1(_temp);
	data_to_send[21]=BYTE0(_temp);
	
	//data_to_send[3] = _cnt-4;
	u8 sum = 0;
	for(u8 i=0;i<=21;i++)
		sum += data_to_send[i];
	
	data_to_send[22]=sum;
	usart.SendData(data_to_send, 23);
	
	
	return true;
}
开发者ID:lissettecarlr,项目名称:Quadcopter,代码行数:58,代码来源:Communication.cpp


示例17: SendSensorOriginalData

bool Communication::SendSensorOriginalData(Vector3<int> acc, Vector3<int> gyro,Vector3<int> mag)
{
	u8 _cnt=0;
	vs16 _temp;
	u8 data_to_send[30];
	

	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0xAA;
	data_to_send[_cnt++]=0x02;
	data_to_send[_cnt++]=0;
	
	_temp = acc.x;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = acc.y;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = acc.z;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = gyro.x;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = gyro.y;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = gyro.z;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	
	_temp = mag.x;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = mag.y;
	data_to_send[_cnt++]=BYTE1(_temp);
	data_to_send[_cnt++]=BYTE0(_temp);
	
	_temp = mag.z;
	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,代码行数:58,代码来源:Communication.cpp


示例18: play_sound

// Function to play sound from the EEPROM
void play_sound(short rate, unsigned long offset, unsigned long length) {
    unsigned int wave_data;

    // Wake up EEPROM - with power-up delay
    PORTC.F0 = 1;
    PORTC.F0 = 0;
    spi_write(0xAB);
    PORTC.F0 = 1;
    delay_us(100);

    // Setup the EEPROM
    PORTC.F0 = 0;
    PORTC.F2 = 1; // Unhold EEPROM
    spi_write(0x03); // EEPROM read command
    spi_write(BYTE2(offset));
    spi_write(BYTE1(offset));
    spi_write(BYTE0(offset));

    // Process all bytes in sound file
    for (wave_scan = 0x000000; wave_scan < length; wave_scan++) {
        // Retrieve a byte of audio data
        PORTC.F2 = 1; // Unhold EEPROM
        wave_data = (SPI_Read(0x00) << 4); // Read EEPROM byte
        PORTC.F2 = 0; // Hold EEPROM

        // Write audio data to DAC
        PORTC.F1 = 0;
        spi_write(BYTE1(wave_data) | 0x10);
        spi_write(BYTE0(wave_data));
        PORTC.F1 = 1;

        // Set delays for different sampling rates
        switch (rate) {
            case FREQ_8000:  delay_us(0x65); break;
            case FREQ_11025: delay_us(0x41); break;
            case FREQ_22050: delay_us(0x12); break;
        }
    }

    // Set DAC voltage output to normalized level
    PORTC.F1 = 0;
    spi_write(0x18);
    spi_write(0x00);
    PORTC.F1 = 1;

    // Shutdown EEPROM - with power-down delay
    PORTC.F0 = 1;
    PORTC.F0 = 0;
    spi_write(0xB9);
    PORTC.F0 = 1;
    delay_us(100);
}
开发者ID:dsnet,项目名称:mario-doorbell,代码行数:53,代码来源:door_ringer.c


示例19: Send_RCData

void ANO_DT::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.rawData[THROTTLE]);
	data_to_send[_cnt++]=BYTE0(rc.rawData[THROTTLE]);
	data_to_send[_cnt++]=BYTE1(rc.rawData[YAW]);
	data_to_send[_cnt++]=BYTE0(rc.rawData[YAW]);
	data_to_send[_cnt++]=BYTE1(rc.rawData[ROLL]);
	data_to_send[_cnt++]=BYTE0(rc.rawData[ROLL]);
	data_to_send[_cnt++]=BYTE1(rc.rawData[PITCH]);
	data_to_send[_cnt++]=BYTE0(rc.rawData[PITCH]);
	data_to_send[_cnt++]=BYTE1(rc.rawData[AUX1]);
	data_to_send[_cnt++]=BYTE0(rc.rawData[AUX1]);
	data_to_send[_cnt++]=BYTE1(rc.rawData[AUX2]);
	data_to_send[_cnt++]=BYTE0(rc.rawData[AUX2]);
	data_to_send[_cnt++]=BYTE1(rc.rawData[AUX3]);
	data_to_send[_cnt++]=BYTE0(rc.rawData[AUX3]);
	data_to_send[_cnt++]=BYTE1(rc.rawData[AUX4]);
	data_to_send[_cnt++]=BYTE0(rc.rawData[AUX4]);
	
	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,代码行数:34,代码来源:ANO_DT.cpp


示例20: Data_Send_MotoPWM

void Data_Send_MotoPWM(void)
{
    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(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE0(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE1(MOTO2_PWM);
    data_to_send[_cnt++] = BYTE0(MOTO2_PWM);
    data_to_send[_cnt++] = BYTE1(MOTO3_PWM);
    data_to_send[_cnt++] = BYTE0(MOTO3_PWM);
    data_to_send[_cnt++] = BYTE1(MOTO4_PWM);
    data_to_send[_cnt++] = BYTE0(MOTO4_PWM);
    data_to_send[_cnt++] = BYTE1(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE0(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE1(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE0(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE1(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE0(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE1(MOTO1_PWM);
    data_to_send[_cnt++] = BYTE0(MOTO1_PWM);
    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
    Sys_sPrintf(Printf_USART, data_to_send, _cnt);
#else
    NRF_TxPacket(data_to_send, _cnt);
#endif
}
开发者ID:jasongwq,项目名称:FLY,代码行数:34,代码来源:data_transfer.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BYTE1函数代码示例发布时间:2022-05-30
下一篇:
C++ BX_UNUSED函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap