本文整理汇总了C++中BYTE0函数的典型用法代码示例。如果您正苦于以下问题:C++ BYTE0函数的具体用法?C++ BYTE0怎么用?C++ BYTE0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BYTE0函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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);
}
示例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);
}
示例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);
}
示例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
}
示例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);;
}
示例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
}
示例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
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}