imu.cpp
Go to the documentation of this file.
00001 #include "phidgets_api/imu.h"
00002 
00003 namespace phidgets {
00004 
00005 Imu::Imu():
00006   Phidget(),
00007   imu_handle_(0)
00008 {
00009   // create the handle
00010   CPhidgetSpatial_create(&imu_handle_);
00011 
00012   // pass handle to base class
00013   Phidget::init((CPhidgetHandle)imu_handle_);
00014 
00015   // register base class callbacks
00016   Phidget::registerHandlers();
00017   
00018   // register imu data callback
00019         CPhidgetSpatial_set_OnSpatialData_Handler(imu_handle_, SpatialDataHandler, this);
00020 }
00021 
00022 void Imu::setDataRate(int rate)
00023 {
00024         CPhidgetSpatial_setDataRate(imu_handle_, rate);
00025 }
00026 
00027 void Imu::zero()
00028 {
00029   // zero (calibrate) gyro
00030   CPhidgetSpatial_zeroGyro(imu_handle_);
00031 }
00032 
00033 int Imu::SpatialDataHandler(CPhidgetSpatialHandle handle, void *userptr, CPhidgetSpatial_SpatialEventDataHandle *data, int count)
00034 {
00035   ((Imu*)userptr)->dataHandler(data, count);
00036   return 0;
00037 }
00038 
00039 void Imu::dataHandler(CPhidgetSpatial_SpatialEventDataHandle *data, int count)
00040 {
00041   printf("Empty data handler\n");
00042 }
00043 
00044 } //namespace phidgets
00045 


phidgets_api
Author(s): Tully Foote, Ivan Dryanovski
autogenerated on Wed Aug 16 2017 02:50:15