Пример #1
0
uint32_t
reset_timer_ms()
{
    timer_ms_base = 0;
    timer_ms_base = get_timer_ms();
    return timer_ms_base;
}
Пример #2
0
int main(void)
{

	SetupHardware();

	data_init(&data, &calib_params); //put some values into structure for testing
	ahrs_init(&data, &u8g, &calib_params);

	GlobalInterruptEnable();

	for (;;)
	{
		//time between updates
		timer_old = timer;
		timer = get_timer_ms();
		if (timer > timer_old) {
			t_period = (timer - timer_old) / 1000.0; //in seconds
		}
		else
			t_period = 0;
		data.time_period = t_period;

		//read data - sensors
		adxl345_read(&data); //accelerometer read
		l3g4200d_read_seq(&data); //gyroscope read
		hmc5883l_read(&data); //magnetometer read

		//buttons
		buttons_read(&data);

		//compute
		//ahrs_orientation_from_gyro(&data);
		ahrs_orientation(&data);
		//ahrs_orientation_from_accel_mag(&data);

		HID_Task();
		USB_USBTask();
	}
}
Пример #3
0
uint64_t Timer::get_timer_sec() {
  return get_timer_ms()/1000;
}
Пример #4
0
std::string Timer::get_timer_ms_str() {
  std::stringstream ss;
  ss << get_timer_ms() << "ms";
  return ss.str();
}