MPL115A2 library
See http://developer.mbed.org/users/yasuyuki/notebook/MPL115A2/
MPL115.h@0:ae28484ad07d, 2014-10-12 (annotated)
- Committer:
- yasuyuki
- Date:
- Sun Oct 12 02:36:30 2014 +0000
- Revision:
- 0:ae28484ad07d
first release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yasuyuki | 0:ae28484ad07d | 1 | //********************** |
yasuyuki | 0:ae28484ad07d | 2 | // MPL115.h for mbed |
yasuyuki | 0:ae28484ad07d | 3 | // |
yasuyuki | 0:ae28484ad07d | 4 | // (C)Copyright 2014 All rights reserved by Y.Onodera |
yasuyuki | 0:ae28484ad07d | 5 | // http://einstlab.web.fc2.com |
yasuyuki | 0:ae28484ad07d | 6 | //********************** |
yasuyuki | 0:ae28484ad07d | 7 | #ifndef MPL115_H_ |
yasuyuki | 0:ae28484ad07d | 8 | #define MPL115_H_ |
yasuyuki | 0:ae28484ad07d | 9 | |
yasuyuki | 0:ae28484ad07d | 10 | #define MPL115_ADDR 0xC0 |
yasuyuki | 0:ae28484ad07d | 11 | #define MPL115_Padc_MSB 0x00 |
yasuyuki | 0:ae28484ad07d | 12 | #define MPL115_Padc_LSB 0x01 |
yasuyuki | 0:ae28484ad07d | 13 | #define MPL115_Tadc_MSB 0x02 |
yasuyuki | 0:ae28484ad07d | 14 | #define MPL115_Tadc_LSB 0x03 |
yasuyuki | 0:ae28484ad07d | 15 | #define MPL115_a0MSB 0x04 |
yasuyuki | 0:ae28484ad07d | 16 | #define MPL115_a0LSB 0x05 |
yasuyuki | 0:ae28484ad07d | 17 | #define MPL115_b1MSB 0x06 |
yasuyuki | 0:ae28484ad07d | 18 | #define MPL115_b1LSB 0x07 |
yasuyuki | 0:ae28484ad07d | 19 | #define MPL115_b2MSB 0x08 |
yasuyuki | 0:ae28484ad07d | 20 | #define MPL115_b2LSB 0x09 |
yasuyuki | 0:ae28484ad07d | 21 | #define MPL115_c12MSB 0x0A |
yasuyuki | 0:ae28484ad07d | 22 | #define MPL115_c12LSB 0x0B |
yasuyuki | 0:ae28484ad07d | 23 | #define MPL115_CONVERT 0x12 |
yasuyuki | 0:ae28484ad07d | 24 | |
yasuyuki | 0:ae28484ad07d | 25 | #include "mbed.h" |
yasuyuki | 0:ae28484ad07d | 26 | #include "typedef.h" |
yasuyuki | 0:ae28484ad07d | 27 | |
yasuyuki | 0:ae28484ad07d | 28 | class MPL115A2{ |
yasuyuki | 0:ae28484ad07d | 29 | public: |
yasuyuki | 0:ae28484ad07d | 30 | MPL115A2 (PinName sda, PinName scl); |
yasuyuki | 0:ae28484ad07d | 31 | MPL115A2 (I2C& p_i2c); |
yasuyuki | 0:ae28484ad07d | 32 | void start(); |
yasuyuki | 0:ae28484ad07d | 33 | short temperature(); |
yasuyuki | 0:ae28484ad07d | 34 | short pressure(); |
yasuyuki | 0:ae28484ad07d | 35 | void init(); |
yasuyuki | 0:ae28484ad07d | 36 | |
yasuyuki | 0:ae28484ad07d | 37 | protected: |
yasuyuki | 0:ae28484ad07d | 38 | |
yasuyuki | 0:ae28484ad07d | 39 | I2C _i2c; |
yasuyuki | 0:ae28484ad07d | 40 | char buf[8]; |
yasuyuki | 0:ae28484ad07d | 41 | WORD_VAL Padc; |
yasuyuki | 0:ae28484ad07d | 42 | WORD_VAL Tadc; |
yasuyuki | 0:ae28484ad07d | 43 | WORD_VAL a0; |
yasuyuki | 0:ae28484ad07d | 44 | WORD_VAL b1; |
yasuyuki | 0:ae28484ad07d | 45 | WORD_VAL b2; |
yasuyuki | 0:ae28484ad07d | 46 | WORD_VAL c12; |
yasuyuki | 0:ae28484ad07d | 47 | |
yasuyuki | 0:ae28484ad07d | 48 | }; |
yasuyuki | 0:ae28484ad07d | 49 | |
yasuyuki | 0:ae28484ad07d | 50 | #endif /* MPL115_H_ */ |
yasuyuki | 0:ae28484ad07d | 51 | |
yasuyuki | 0:ae28484ad07d | 52 |