Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 3_test_EEROMM-barometer 5_waitmode 5_flightmode 5-2_thrustermode ... more
LPS33HW.h@1:9574dea45061, 2020-07-20 (annotated)
- Committer:
- sasakisho
- Date:
- Mon Jul 20 15:57:55 2020 +0000
- Revision:
- 1:9574dea45061
- Parent:
- 0:efb4130c9550
at Pressure addr
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rary | 0:efb4130c9550 | 1 | #ifndef MBED_LPS33HW_H |
rary | 0:efb4130c9550 | 2 | #define MBED_LPS33HW_H |
rary | 0:efb4130c9550 | 3 | |
rary | 0:efb4130c9550 | 4 | #include "mbed.h" |
rary | 0:efb4130c9550 | 5 | |
rary | 0:efb4130c9550 | 6 | //LPS33HW slave address |
sasakisho | 1:9574dea45061 | 7 | #define SL_add 0xB8 |
sasakisho | 1:9574dea45061 | 8 | #define SH_add 0xBA |
rary | 0:efb4130c9550 | 9 | |
rary | 0:efb4130c9550 | 10 | //Check adress |
rary | 0:efb4130c9550 | 11 | #define WHO_AM_I 0x0F |
rary | 0:efb4130c9550 | 12 | |
rary | 0:efb4130c9550 | 13 | //CTRL_REG1 |
rary | 0:efb4130c9550 | 14 | #define CTRL_REG1 0x10 |
rary | 0:efb4130c9550 | 15 | |
rary | 0:efb4130c9550 | 16 | //Start Up |
rary | 0:efb4130c9550 | 17 | #define Normal 0x10 //normal(1Hz) |
rary | 0:efb4130c9550 | 18 | #define High_rate 0x50 //High rate(75Hz) |
rary | 0:efb4130c9550 | 19 | |
rary | 0:efb4130c9550 | 20 | //data register |
rary | 0:efb4130c9550 | 21 | #define press_msb 0x2A |
rary | 0:efb4130c9550 | 22 | #define press_lsb 0x29 |
rary | 0:efb4130c9550 | 23 | #define press_xlsb 0x28 |
rary | 0:efb4130c9550 | 24 | |
rary | 0:efb4130c9550 | 25 | class LPS33HW |
rary | 0:efb4130c9550 | 26 | { |
rary | 0:efb4130c9550 | 27 | public: |
rary | 0:efb4130c9550 | 28 | LPS33HW(PinName sda,PinName scl); |
rary | 0:efb4130c9550 | 29 | ~LPS33HW(); |
rary | 0:efb4130c9550 | 30 | |
rary | 0:efb4130c9550 | 31 | char read(char regist); //基本read関数 |
rary | 0:efb4130c9550 | 32 | void write(char regist,char data); //基本write関数 |
rary | 0:efb4130c9550 | 33 | char who(); //WHO_AM_I |
rary | 0:efb4130c9550 | 34 | void start(char mode); //Start,mode0;normal,mode1;high rate |
rary | 0:efb4130c9550 | 35 | double data_read(); //pressure read |
rary | 0:efb4130c9550 | 36 | |
rary | 0:efb4130c9550 | 37 | private: |
rary | 0:efb4130c9550 | 38 | I2C i2c; |
rary | 0:efb4130c9550 | 39 | char addr; |
rary | 0:efb4130c9550 | 40 | }; |
rary | 0:efb4130c9550 | 41 | |
rary | 0:efb4130c9550 | 42 | #endif |
rary | 0:efb4130c9550 | 43 |