Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1993 - 1
 
2
#ifndef _BMA180_h
3
#define _BMA180_h
4
 
5
#include <Wire.h>
6
/*
7
extern "C" {
8
#include <../Wire/Wire.h>
9
 
10
}
11
*/
12
 
13
#define BMA180_ADDRESS_SDO_LOW 0x40
14
#define BMA180_ADDRESS_SDO_HIGH 0x41
15
 
16
class BMA180
17
{
18
  public:
19
    typedef enum {F10HZ=0,F20HZ=1,F40HZ, F75HZ,F15HZ0,F300HZ,F600HZ,F1200HZ,HIGHPASS,BANDPASS} FILTER;
20
    typedef enum {G1=0,G15=1,G2,G3,G4,G8,G16}GSENSITIVITY;
21
private:
22
    unsigned char address;
23
    GSENSITIVITY gSense;
24
  public:
25
 
26
    int x,y,z; // yes, public, what the heck
27
    int temp;
28
 
29
    BMA180();
30
 
31
    void setAddress(int val);
32
    void readAccel(int * x, int * y, int * z);
33
 
34
    float getGSense();
35
    float getXValFloat();
36
    float getYValFloat();
37
    float getZValFloat();
38
    void setRegValue(int regAdr, int val, int maskPreserve);
39
    int getRegValue(int adr);
40
    void setGSensitivty(GSENSITIVITY maxg);
41
    void SetFilter(FILTER f);
42
    void SetISRMode();
43
    void SoftReset();
44
    void SetSMPSkip();
45
    int getIDs(int *id, int *version);
46
    void enableWrite();
47
    void disableWrite();
48
    virtual bool checkResult(int result);
49
};
50
 
51
 
52
#endif //_BMA180_h