Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
iio-gyroscope-console-and-mqtt-publish.c File Reference
#include <limits.h>
#include <errno.h>
#include <sol-iio.h>
#include <sol-log.h>
#include <sol-mainloop.h>
#include <sol-mqtt.h>
#include <math.h>

Data Structures

struct  filter_median
 
struct  gyro_cal
 
struct  iio_gyroscope_data
 

Macros

#define DENOISE_MEDIAN
 
#define GYRO_CALIBRATE
 
#define GYRO_DENOISE_MAX_SAMPLES   5
 
#define GYRO_DENOISE_NUM_FIELDS   3
 
#define GYRO_DROP_SAMPLES   5 /* Drop first few gyro samples for noisy sensor */
 
#define GYRO_DS_SIZE   100
 
#define GYRO_MAX_ERR   0.05
 

Functions

static void clamp_gyro_readings_to_zero (struct gyro_cal *cal_data, double *x, double *y, double *z)
 
static void denoise_median (struct filter_median *filter_data, double *x, double *y, double *z)
 
static bool gyro_collect (struct gyro_cal *cal_data, double x, double y, double z)
 
static void iio_gyroscope_reader_cb (void *data, struct sol_iio_device *device)
 
int main (int argc, char *argv[])
 
static double median (double *queue, unsigned int size)
 
static void on_connect (void *data, struct sol_mqtt *mqtt)
 
static void on_disconnect (void *data, struct sol_mqtt *mqtt)
 
static unsigned int partition (double *list, unsigned int left, unsigned int right, unsigned int pivot_index)
 
static void reset_calibrate (struct gyro_cal *cal_data)
 
static bool try_reconnect (void *data)
 

Variables

static struct sol_timeouttimeout
 

Macro Definition Documentation

#define DENOISE_MEDIAN
#define GYRO_CALIBRATE
#define GYRO_DENOISE_MAX_SAMPLES   5
#define GYRO_DENOISE_NUM_FIELDS   3
#define GYRO_DROP_SAMPLES   5 /* Drop first few gyro samples for noisy sensor */
#define GYRO_DS_SIZE   100
#define GYRO_MAX_ERR   0.05

Function Documentation

static void clamp_gyro_readings_to_zero ( struct gyro_cal cal_data,
double *  x,
double *  y,
double *  z 
)
static
static void denoise_median ( struct filter_median filter_data,
double *  x,
double *  y,
double *  z 
)
static
static bool gyro_collect ( struct gyro_cal cal_data,
double  x,
double  y,
double  z 
)
static
static void iio_gyroscope_reader_cb ( void *  data,
struct sol_iio_device device 
)
static
int main ( int  argc,
char *  argv[] 
)
static double median ( double *  queue,
unsigned int  size 
)
static
static void on_connect ( void *  data,
struct sol_mqtt mqtt 
)
static
static void on_disconnect ( void *  data,
struct sol_mqtt mqtt 
)
static

References SOL_INF, sol_timeout_add(), and try_reconnect().

Referenced by main().

static unsigned int partition ( double *  list,
unsigned int  left,
unsigned int  right,
unsigned int  pivot_index 
)
static
static void reset_calibrate ( struct gyro_cal cal_data)
static
static bool try_reconnect ( void *  data)
static

Variable Documentation

struct sol_timeout* timeout
static

Referenced by main(), and on_connect().