コード例 #1
0
ファイル: as_translator.cpp プロジェクト: gavinljj/revolver
void CASTranslator::TranslateProtocol()
{
    const MsgBodyDefMap& msgbody_map = CVistor::GetMsgBodyMap();

    for (MsgBodyDefMap::const_iterator itr = msgbody_map.begin();
            itr != msgbody_map.end(); ++itr)
    {
        string msgid = GET_VARDEFMAP()->fetch_value(itr->first.msg_id_);
        generate_package(itr->second, itr->first.msg_cname_, msgid);
    }

    const UserClassDescMap& user_class_map = CVistor::GetUserClassDescMap();
    for (UserClassDescMap::const_iterator itr = user_class_map.begin();
            itr != user_class_map.end(); ++itr)
    {
        generate_package(itr->second, itr->first);
    }
}
コード例 #2
0
ファイル: main.c プロジェクト: james54068/imu_binary_comm
int main(void)
{
	int16_t buff[6];
	uint8_t bin_buff[13];
	comm_package imu_comm;
	imu_comm.header = (uint8_t)'I';
	init_led();
	init_usart1();
	MPU6050_I2C_Init();
	MPU6050_Initialize();
	init_tim2();
	if( MPU6050_TestConnection() == TRUE)
	{
	   puts("connection success\r\n");
	}else {
	   puts("connection failed\r\n");
	}
	imu_calibration();

	while (1) {
		//puts("running now\r\n");
		MPU6050_GetRawAccelGyro(buff);
		imu_comm.acc_x = buff[0]-ACC_X_OFFSET;
		imu_comm.acc_y = buff[1]-ACC_Y_OFFSET;
		imu_comm.acc_z = buff[2]-ACC_Z_OFFSET;
		imu_comm.gyro_x = buff[3]-GYRO_X_OFFSET;
		imu_comm.gyro_y = buff[4]-GYRO_Y_OFFSET;
		imu_comm.gyro_z = buff[5]-GYRO_Z_OFFSET;
		generate_package( &imu_comm, &bin_buff[0]);
		for (int i = 0 ; i<13 ; i++)
			send_byte( bin_buff[i] );
		gpio_toggle(GPIOA, GPIO_Pin_0);
		gpio_toggle(GPIOA, GPIO_Pin_1);
		delay_ms(10);

	}
}
コード例 #3
0
ファイル: tst_stubs.c プロジェクト: RobinLiu/msg
void* gen_retrans_req(uint16 seq) {
  return generate_package(PDU_RETRANS, 0, seq);
}
コード例 #4
0
ファイル: tst_stubs.c プロジェクト: RobinLiu/msg
void* gen_data(uint16 seq, uint32 data_len) {
  void* data = generate_package(PDU_DATA, data_len, seq);
//  dbg_print_msg(data);
  return data;
}
コード例 #5
0
ファイル: tst_stubs.c プロジェクト: RobinLiu/msg
void* gen_ack(uint16 seq){
  return generate_package(PDU_ACK, 0, seq);
}