예제 #1
0
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
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);
}