GyroAttr.h 581 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef __GYRO_ATTR_H__
#define __GYRO_ATTR_H__

#include "mbed.h"
#include "bmi160.h"
#include "cJSON.h"

#define GYRO_SENSOR_UPDATE_THREAD_STACK_SIZE 2048

class GyroAttr
{
public:
    GyroAttr(BMI160* _imu);
    ~GyroAttr();

    int sensor_init();
    int start_sensor_update(int _interval_ms);
    cJSON* get_gyro();

private:
    void init_attr();
    void sensor_update_main_loop();

private:
    BMI160* imu;
    BMI160::AccConfig acc_config;
    BMI160::GyroConfig gyro_config;
    cJSON *gyro;
    cJSON *x, *y, *z;
    int interval_ms;

     Thread thread;
};




#endif