-
Notifications
You must be signed in to change notification settings - Fork 0
/
FSS100.h
49 lines (41 loc) · 1.17 KB
/
FSS100.h
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
39
40
41
42
43
44
45
46
47
48
49
#ifndef FSS100_h
#define FSS100_h
#include "Energia.h"
#define FSS100_SR_CLEAR ~((1 << 4) | (1 << 3))
#define FSS100_SR_32HZ (1 << 4) | (1 << 3)
#define FSS100_SR_16HZ (1 << 4) | (0 << 3)
#define FSS100_SR_8HZ (0 << 4) | (1 << 3)
#define FSS100_SR_4HZ (0 << 4) | (0 << 3)
#define FSS100_CONL_COMMIT (1 << 5)
#define FSS100_CONL_COMMIT_CLEAR ~FSS100_CONL_COMMIT
#define FSS100_CONL_CONTINUOUS (1 << 6)
#define FSS100_CONL_ONESHOT ~FSS100_CONL_CONTINUOUS
#define FSS100_CONL_SAMPLEREQUEST (1 << 7)
#define FSS100_CONL_SAMPLEDONE ~FSS100_CONL_SAMPLEREQUEST
class FSS100
{
public:
FSS100(int address);
void init();
void getSample(int16_t *theta, int16_t *phi, int16_t *temp);
int16_t getTheta();
int16_t getPhi();
int16_t getTemp();
uint8_t get_conl(void);
void set_conl(uint8_t new_conl);
void set_one_shot(void);
uint8_t getAddress(void);
void setI2CAddress(int address);
void update_conl();
void setContinuousSampling(bool continuous);
void setSamplingRate(int rate);
bool sample_wait(void);
void setSampleBit(bool sample);
void setCommitBit(bool commit);
void default_config(void);
void continuous_config(void);
private:
int _addr;
uint8_t _conl_reg;
};
#endif // FSS100