Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ahrs_gx3.h File Reference

Driver for Microstrain GX3 IMU/AHRS subsystem. More...

#include "generated/airframe.h"
#include "subsystems/imu.h"
#include "subsystems/ahrs.h"
#include "subsystems/ins.h"
#include "mcu_periph/uart.h"
#include "subsystems/ahrs/ahrs_aligner.h"
#include "state.h"
#include "led.h"
+ Include dependency graph for ahrs_gx3.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GX3_packet
 
struct  AhrsFloatQuat
 

Macros

#define __GX3Link(dev, _x)   dev##_x
 
#define _GX3Link(dev, _x)   __GX3Link(dev, _x)
 
#define GX3Link(_x)   _GX3Link(GX3_LINK, _x)
 
#define GX3Buffer()   GX3Link(ChAvailable())
 
#define ImuScaleGyro(_imu)   {}
 
#define ImuScaleAccel(_imu)   {}
 
#define ImuScaleMag(_imu)   {}
 
#define GX3_MAX_PAYLOAD   128
 
#define GX3_MSG_LEN   67
 
#define GX3_HEADER   0xC8
 
#define GX3_MIN_FREQ   300
 
#define IMU_GX3_LONG_DELAY   4000000
 

Enumerations

enum  GX36PacketStatus { GX3PacketWaiting, GX3PacketReading }
 
enum  GX3Status { GX3Uninit, GX3Running }
 

Functions

void GX3_packet_read_message (void)
 
void GX3_packet_parse (uint8_t c)
 
static void ReadGX3Buffer (void)
 
static void ImuEvent (void(*_gyro_handler)(void), void(*_accel_handler)(void), void(*_mag_handler)(void))
 

Variables

struct GX3_packet GX3_packet
 
enum GX3Status GX3_status
 
float GX3_freq
 
uint16_t GX3_chksm
 
uint16_t GX3_calcsm
 
uint32_t GX3_time
 
struct AhrsFloatQuat ahrs_impl
 

Detailed Description

Driver for Microstrain GX3 IMU/AHRS subsystem.

Takes care of configuration of the IMU, communication and parsing the received packets. See GX3 datasheet for configuration options.

Author
Michal Podhradsky micha.nosp@m.l.po.nosp@m.dhrad.nosp@m.sky@.nosp@m.aggie.nosp@m.mail.nosp@m..usu..nosp@m.edu

Definition in file ahrs_gx3.h.

Macro Definition Documentation

#define __GX3Link (   dev,
  _x 
)    dev##_x

Definition at line 45 of file ahrs_gx3.h.

#define _GX3Link (   dev,
  _x 
)    __GX3Link(dev, _x)

Definition at line 46 of file ahrs_gx3.h.

#define GX3_HEADER   0xC8

Definition at line 68 of file ahrs_gx3.h.

Referenced by GX3_packet_parse().

#define GX3_MAX_PAYLOAD   128

Definition at line 66 of file ahrs_gx3.h.

#define GX3_MIN_FREQ   300

Definition at line 69 of file ahrs_gx3.h.

Referenced by ahrs_aligner_run().

#define GX3_MSG_LEN   67

Definition at line 67 of file ahrs_gx3.h.

Referenced by GX3_packet_parse(), and GX3_verify_chk().

#define GX3Buffer ( )    GX3Link(ChAvailable())

Definition at line 49 of file ahrs_gx3.h.

Referenced by ImuEvent().

#define GX3Link (   _x)    _GX3Link(GX3_LINK, _x)

Definition at line 47 of file ahrs_gx3.h.

Referenced by ahrs_align(), imu_impl_init(), and ReadGX3Buffer().

#define IMU_GX3_LONG_DELAY   4000000

Definition at line 71 of file ahrs_gx3.h.

Referenced by imu_impl_init().

#define ImuScaleAccel (   _imu)    {}

Definition at line 59 of file ahrs_gx3.h.

Referenced by on_accel_event(), on_gyro_accel_event(), and on_gyro_event().

#define ImuScaleGyro (   _imu)    {}

Definition at line 54 of file ahrs_gx3.h.

Referenced by on_gyro_accel_event(), and on_gyro_event().

#define ImuScaleMag (   _imu)    {}

Definition at line 64 of file ahrs_gx3.h.

Referenced by on_mag_event().

Enumeration Type Documentation

Enumerator
GX3PacketWaiting 
GX3PacketReading 

Definition at line 93 of file ahrs_gx3.h.

enum GX3Status
Enumerator
GX3Uninit 
GX3Running 

Definition at line 98 of file ahrs_gx3.h.

Function Documentation

void GX3_packet_parse ( uint8_t  c)

Definition at line 242 of file ahrs_gx3.c.

References c, GX3_packet::chksm_error, FALSE, GX3_HEADER, GX3_MSG_LEN, GX3_verify_chk(), GX3PacketReading, GX3PacketWaiting, GX3_packet::hdr_error, GX3_packet::msg_available, GX3_packet::msg_buf, GX3_packet::msg_idx, GX3_packet::status, and TRUE.

Referenced by ReadGX3Buffer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void ImuEvent ( void(*)(void)  _gyro_handler,
void(*)(void)  _accel_handler,
void(*)(void)  _mag_handler 
)
inlinestatic

Definition at line 118 of file ahrs_gx3.h.

References FALSE, GX3_packet_read_message(), GX3Buffer, GX3_packet::msg_available, and ReadGX3Buffer().

+ Here is the call graph for this function:

static void ReadGX3Buffer ( void  )
inlinestatic

Definition at line 113 of file ahrs_gx3.h.

References GX3_packet_parse(), GX3Link, and GX3_packet::msg_available.

Referenced by ImuEvent().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

struct AhrsFloatQuat ahrs_impl

Definition at line 40 of file ahrs_ardrone2.c.

uint16_t GX3_calcsm

Definition at line 49 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

uint16_t GX3_chksm

Definition at line 48 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().

float GX3_freq

Definition at line 50 of file ahrs_gx3.c.

Referenced by ahrs_aligner_run(), and GX3_packet_read_message().

Definition at line 44 of file ahrs_gx3.c.

enum GX3Status GX3_status

Definition at line 45 of file ahrs_gx3.c.

Referenced by ahrs_align(), and imu_impl_init().

uint32_t GX3_time

Definition at line 46 of file ahrs_gx3.c.

Referenced by GX3_packet_read_message().