PX4 Firmware
PX4 Autopilot Software http://px4.io
mpu9x50 Namespace Reference

Functions

static void usage ()
 Print out the usage information. More...
 
static void stop ()
 mpu9x50 stop measurement More...
 
static void task_main_trampoline (int argc, char *argv[])
 task main trampoline function More...
 
static void task_main (int argc, char *argv[])
 mpu9x50 measurement thread primary entry point More...
 
static bool create_pubs ()
 create and advertise all publicatoins More...
 
static void update_reports ()
 update all sensor reports with the latest sensor reading More...
 
static void publish_reports ()
 publish all sensor reports More...
 
static void parameters_update ()
 update all parameters More...
 
static void parameters_init ()
 initialize all parameter handles and load the initial parameter values More...
 
static void parameter_update_poll ()
 poll parameter update More...
 
static void * data_ready_isr (void *context)
 MPU9x50 data ready interrupt service routine. More...
 
void start ()
 Attempt to start driver on all available I2C busses. More...
 

Variables

static char _device [MAX_LEN_DEV_PATH]
 SPI device path that mpu9x50 is connected to. More...
 
static bool _is_running = false
 flag indicating if mpu9x50 app is running More...
 
static bool _task_should_exit = false
 flag indicating if measurement thread should exit More...
 
static px4_task_t _task_handle = -1
 handle to the task main thread More...
 
static struct mpu9x50_data _data
 IMU measurement data. More...
 
static orb_advert_t _gyro_pub = nullptr
 gyro data publication More...
 
static int _gyro_orb_class_instance
 instance handle for gyro devices More...
 
static orb_advert_t _accel_pub = nullptr
 accelerameter data publication More...
 
static int _accel_orb_class_instance
 instance handle for accel devices More...
 
static orb_advert_t _mag_pub = nullptr
 compass data publication More...
 
static int _mag_orb_class_instance
 instance handle for mag devices More...
 
static int _params_sub
 parameter update subscription More...
 
static sensor_gyro_s _gyro
 gyro report More...
 
static sensor_accel_s _accel
 accel report More...
 
static struct mag_report _mag
 mag report More...
 
static struct gyro_calibration_s _gyro_sc
 gyro scale More...
 
static struct accel_calibration_s _accel_sc
 accel scale More...
 
static struct mag_calibration_s _mag_sc
 mag scale More...
 
static enum gyro_lpf_e _gyro_lpf = MPU9X50_GYRO_LPF_20HZ
 gyro lpf enum value More...
 
static enum acc_lpf_e _accel_lpf = MPU9X50_ACC_LPF_20HZ
 accel lpf enum value More...
 
static enum gyro_sample_rate_e _imu_sample_rate = MPU9x50_SAMPLE_RATE_500HZ
 IMU sample rate enum. More...
 
struct {
   param_t   mpu9x50::accel_x_offset
 
   param_t   mpu9x50::accel_x_scale
 
   param_t   mpu9x50::accel_y_offset
 
   param_t   mpu9x50::accel_y_scale
 
   param_t   mpu9x50::accel_z_offset
 
   param_t   mpu9x50::accel_z_scale
 
   param_t   mpu9x50::gyro_x_offset
 
   param_t   mpu9x50::gyro_x_scale
 
   param_t   mpu9x50::gyro_y_offset
 
   param_t   mpu9x50::gyro_y_scale
 
   param_t   mpu9x50::gyro_z_offset
 
   param_t   mpu9x50::gyro_z_scale
 
   param_t   mpu9x50::mag_x_offset
 
   param_t   mpu9x50::mag_x_scale
 
   param_t   mpu9x50::mag_y_offset
 
   param_t   mpu9x50::mag_y_scale
 
   param_t   mpu9x50::mag_z_offset
 
   param_t   mpu9x50::mag_z_scale
 
   param_t   mpu9x50::gyro_lpf_enum
 
   param_t   mpu9x50::accel_lpf_enum
 
   param_t   mpu9x50::imu_sample_rate_enum
 
_params_handles
 parameter handles More...
 
bool exit_mreasurement = false
 
static int64_t _isr_data_ready_timestamp = 0
 

Function Documentation

◆ create_pubs()

bool mpu9x50::create_pubs ( )
static

create and advertise all publicatoins

Returns
true on success, false otherwise

Definition at line 367 of file mpu9x50_main.cpp.

References _mag, mag_report, orb_advertise_multi(), ORB_ID, and ORB_PRIO_HIGH.

Referenced by task_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ data_ready_isr()

void * mpu9x50::data_ready_isr ( void *  context)
static

MPU9x50 data ready interrupt service routine.

Parameters
[out]contextaddress of the context data provided by user whill registering the interrupt servcie routine

Definition at line 178 of file mpu9x50_main.cpp.

References hrt_absolute_time().

Referenced by task_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parameter_update_poll()

void mpu9x50::parameter_update_poll ( )
static

poll parameter update

Definition at line 191 of file mpu9x50_main.cpp.

References orb_check(), orb_copy(), ORB_ID, and parameters_update().

Referenced by task_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parameters_init()

void mpu9x50::parameters_init ( )
static

initialize all parameter handles and load the initial parameter values

Definition at line 336 of file mpu9x50_main.cpp.

References _params_handles, param_find(), and parameters_update().

Referenced by task_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parameters_update()

◆ publish_reports()

void mpu9x50::publish_reports ( )
static

publish all sensor reports

Definition at line 436 of file mpu9x50_main.cpp.

References _data, _mag, OK, ORB_ID, and orb_publish().

Referenced by task_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void mpu9x50::start ( )

Attempt to start driver on all available I2C busses.

This function will return as soon as the first sensor is detected on one of the available busses or if no sensors are detected.

Attempt to start driver on all available I2C busses.

Definition at line 565 of file mpu9x50_main.cpp.

References task_main_trampoline(), and warn.

Referenced by mpu9x50_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void mpu9x50::stop ( )
static

mpu9x50 stop measurement

Definition at line 585 of file mpu9x50_main.cpp.

Referenced by mpu9x50_main().

Here is the caller graph for this function:

◆ task_main()

void mpu9x50::task_main ( int  argc,
char *  argv[] 
)
static

mpu9x50 measurement thread primary entry point

Definition at line 465 of file mpu9x50_main.cpp.

References _accel_lpf, _data, _device, _gyro_lpf, _imu_sample_rate, _isr_data_ready_timestamp, create_pubs(), data_ready_isr(), ORB_ID, orb_subscribe(), parameter_update_poll(), parameters_init(), publish_reports(), SPI_INT_GPIO, and update_reports().

Referenced by task_main_trampoline().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_main_trampoline()

void mpu9x50::task_main_trampoline ( int  argc,
char *  argv[] 
)
static

task main trampoline function

mpu9x50 main entrance

Definition at line 559 of file mpu9x50_main.cpp.

References task_main().

Referenced by start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_reports()

◆ usage()

void mpu9x50::usage ( void  )
static

Print out the usage information.

Definition at line 593 of file mpu9x50_main.cpp.

Referenced by mpu9x50_main().

Here is the caller graph for this function:

Variable Documentation

◆ _accel

sensor_accel_s mpu9x50::_accel
static

accel report

Definition at line 100 of file mpu9x50_main.cpp.

◆ _accel_lpf

enum acc_lpf_e mpu9x50::_accel_lpf = MPU9X50_ACC_LPF_20HZ
static

accel lpf enum value

Definition at line 106 of file mpu9x50_main.cpp.

Referenced by task_main().

◆ _accel_orb_class_instance

int mpu9x50::_accel_orb_class_instance
static

instance handle for accel devices

Definition at line 95 of file mpu9x50_main.cpp.

◆ _accel_pub

orb_advert_t mpu9x50::_accel_pub = nullptr
static

accelerameter data publication

Definition at line 94 of file mpu9x50_main.cpp.

◆ _accel_sc

struct accel_calibration_s mpu9x50::_accel_sc
static

accel scale

Definition at line 103 of file mpu9x50_main.cpp.

Referenced by parameters_update(), and update_reports().

◆ _data

◆ _device

char mpu9x50::_device[MAX_LEN_DEV_PATH]
static

SPI device path that mpu9x50 is connected to.

Definition at line 78 of file mpu9x50_main.cpp.

Referenced by mpu9x50_main(), and task_main().

◆ _gyro

sensor_gyro_s mpu9x50::_gyro
static

gyro report

Definition at line 99 of file mpu9x50_main.cpp.

◆ _gyro_lpf

enum gyro_lpf_e mpu9x50::_gyro_lpf = MPU9X50_GYRO_LPF_20HZ
static

gyro lpf enum value

Definition at line 105 of file mpu9x50_main.cpp.

Referenced by task_main().

◆ _gyro_orb_class_instance

int mpu9x50::_gyro_orb_class_instance
static

instance handle for gyro devices

Definition at line 93 of file mpu9x50_main.cpp.

◆ _gyro_pub

orb_advert_t mpu9x50::_gyro_pub = nullptr
static

gyro data publication

Definition at line 92 of file mpu9x50_main.cpp.

◆ _gyro_sc

struct gyro_calibration_s mpu9x50::_gyro_sc
static

gyro scale

Definition at line 102 of file mpu9x50_main.cpp.

Referenced by parameters_update(), and update_reports().

◆ _imu_sample_rate

enum gyro_sample_rate_e mpu9x50::_imu_sample_rate = MPU9x50_SAMPLE_RATE_500HZ
static

IMU sample rate enum.

Definition at line 107 of file mpu9x50_main.cpp.

Referenced by task_main().

◆ _is_running

bool mpu9x50::_is_running = false
static

flag indicating if mpu9x50 app is running

Definition at line 81 of file mpu9x50_main.cpp.

Referenced by mpu9x50_main().

◆ _isr_data_ready_timestamp

int64_t mpu9x50::_isr_data_ready_timestamp = 0
static

Definition at line 169 of file mpu9x50_main.cpp.

Referenced by task_main().

◆ _mag

struct mag_report mpu9x50::_mag
static

mag report

Definition at line 101 of file mpu9x50_main.cpp.

Referenced by create_pubs(), publish_reports(), and update_reports().

◆ _mag_orb_class_instance

int mpu9x50::_mag_orb_class_instance
static

instance handle for mag devices

Definition at line 97 of file mpu9x50_main.cpp.

◆ _mag_pub

orb_advert_t mpu9x50::_mag_pub = nullptr
static

compass data publication

Definition at line 96 of file mpu9x50_main.cpp.

◆ _mag_sc

struct mag_calibration_s mpu9x50::_mag_sc
static

mag scale

Definition at line 104 of file mpu9x50_main.cpp.

Referenced by parameters_update(), and update_reports().

◆ _params_handles

struct { ... } mpu9x50::_params_handles

parameter handles

Referenced by parameters_init(), and parameters_update().

◆ _params_sub

int mpu9x50::_params_sub
static

parameter update subscription

Definition at line 98 of file mpu9x50_main.cpp.

◆ _task_handle

px4_task_t mpu9x50::_task_handle = -1
static

handle to the task main thread

Definition at line 87 of file mpu9x50_main.cpp.

◆ _task_should_exit

bool mpu9x50::_task_should_exit = false
static

flag indicating if measurement thread should exit

Definition at line 84 of file mpu9x50_main.cpp.

◆ accel_lpf_enum

param_t mpu9x50::accel_lpf_enum

Definition at line 129 of file mpu9x50_main.cpp.

◆ accel_x_offset

param_t mpu9x50::accel_x_offset

Definition at line 110 of file mpu9x50_main.cpp.

◆ accel_x_scale

param_t mpu9x50::accel_x_scale

Definition at line 111 of file mpu9x50_main.cpp.

◆ accel_y_offset

param_t mpu9x50::accel_y_offset

Definition at line 112 of file mpu9x50_main.cpp.

◆ accel_y_scale

param_t mpu9x50::accel_y_scale

Definition at line 113 of file mpu9x50_main.cpp.

◆ accel_z_offset

param_t mpu9x50::accel_z_offset

Definition at line 114 of file mpu9x50_main.cpp.

◆ accel_z_scale

param_t mpu9x50::accel_z_scale

Definition at line 115 of file mpu9x50_main.cpp.

◆ exit_mreasurement

bool mpu9x50::exit_mreasurement = false

Definition at line 133 of file mpu9x50_main.cpp.

◆ gyro_lpf_enum

param_t mpu9x50::gyro_lpf_enum

Definition at line 128 of file mpu9x50_main.cpp.

◆ gyro_x_offset

param_t mpu9x50::gyro_x_offset

Definition at line 116 of file mpu9x50_main.cpp.

◆ gyro_x_scale

param_t mpu9x50::gyro_x_scale

Definition at line 117 of file mpu9x50_main.cpp.

◆ gyro_y_offset

param_t mpu9x50::gyro_y_offset

Definition at line 118 of file mpu9x50_main.cpp.

◆ gyro_y_scale

param_t mpu9x50::gyro_y_scale

Definition at line 119 of file mpu9x50_main.cpp.

◆ gyro_z_offset

param_t mpu9x50::gyro_z_offset

Definition at line 120 of file mpu9x50_main.cpp.

◆ gyro_z_scale

param_t mpu9x50::gyro_z_scale

Definition at line 121 of file mpu9x50_main.cpp.

◆ imu_sample_rate_enum

param_t mpu9x50::imu_sample_rate_enum

Definition at line 130 of file mpu9x50_main.cpp.

◆ mag_x_offset

param_t mpu9x50::mag_x_offset

Definition at line 122 of file mpu9x50_main.cpp.

◆ mag_x_scale

param_t mpu9x50::mag_x_scale

Definition at line 123 of file mpu9x50_main.cpp.

◆ mag_y_offset

param_t mpu9x50::mag_y_offset

Definition at line 124 of file mpu9x50_main.cpp.

◆ mag_y_scale

param_t mpu9x50::mag_y_scale

Definition at line 125 of file mpu9x50_main.cpp.

◆ mag_z_offset

param_t mpu9x50::mag_z_offset

Definition at line 126 of file mpu9x50_main.cpp.

◆ mag_z_scale

param_t mpu9x50::mag_z_scale

Definition at line 127 of file mpu9x50_main.cpp.