mpl115A2 i2c pressure and temperature sensor
Dependents: HTTPClient_SuperTweet_MPL115A2 mpl115a2_display_local
MPL115A2.h@1:6dbe3322f203, 2012-05-07 (annotated)
- Committer:
- joeh
- Date:
- Mon May 07 14:04:39 2012 +0000
- Revision:
- 1:6dbe3322f203
- Parent:
- 0:5a72175e5cb2
edited comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joeh | 1:6dbe3322f203 | 1 | /* |
joeh | 1:6dbe3322f203 | 2 | *@section LICENSE |
joeh | 1:6dbe3322f203 | 3 | * This program is free software; you can redistribute it and/or modify |
joeh | 1:6dbe3322f203 | 4 | * it under the terms of the GNU General Public License as published by |
joeh | 1:6dbe3322f203 | 5 | * the Free Software Foundation; either version 2 of the License, or |
joeh | 1:6dbe3322f203 | 6 | * (at your option) any later version. |
joeh | 1:6dbe3322f203 | 7 | * |
joeh | 1:6dbe3322f203 | 8 | * This program is distributed in the hope that it will be useful, but |
joeh | 1:6dbe3322f203 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
joeh | 1:6dbe3322f203 | 10 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
joeh | 1:6dbe3322f203 | 11 | * for more details. |
joeh | 1:6dbe3322f203 | 12 | * |
joeh | 1:6dbe3322f203 | 13 | * You should have received a copy of the GNU General Public License along |
joeh | 1:6dbe3322f203 | 14 | * with this program; if not, write to the Free Software Foundation, Inc., |
joeh | 1:6dbe3322f203 | 15 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
joeh | 1:6dbe3322f203 | 16 | * |
joeh | 1:6dbe3322f203 | 17 | *@section NOTES |
joeh | 1:6dbe3322f203 | 18 | *MPL115A2 Sensor Library for mbed |
joeh | 1:6dbe3322f203 | 19 | * |
joeh | 1:6dbe3322f203 | 20 | *created for arduino by R.N <zan73722@gmail.com> |
joeh | 1:6dbe3322f203 | 21 | *ported to mbed by joe holdsworth <joeholdsworth@gmail.com> |
joeh | 1:6dbe3322f203 | 22 | * |
joeh | 1:6dbe3322f203 | 23 | *2012-05-07 Ported mbed beta version - tested on LPC1768 |
joeh | 0:5a72175e5cb2 | 24 | */ |
joeh | 0:5a72175e5cb2 | 25 | |
joeh | 0:5a72175e5cb2 | 26 | #ifndef MPL115A2_H |
joeh | 0:5a72175e5cb2 | 27 | #define MPL115A2_H |
joeh | 0:5a72175e5cb2 | 28 | |
joeh | 0:5a72175e5cb2 | 29 | #include "mbed.h" |
joeh | 0:5a72175e5cb2 | 30 | |
joeh | 0:5a72175e5cb2 | 31 | class MPL115A2 |
joeh | 0:5a72175e5cb2 | 32 | { |
joeh | 0:5a72175e5cb2 | 33 | private: |
joeh | 0:5a72175e5cb2 | 34 | DigitalOut _shdnPin; |
joeh | 0:5a72175e5cb2 | 35 | bool _bShutdown; |
joeh | 0:5a72175e5cb2 | 36 | short _i2c_address; |
joeh | 0:5a72175e5cb2 | 37 | short _sia0, _sib1, _sib2, _sic12, _sic11, _sic22; |
joeh | 0:5a72175e5cb2 | 38 | unsigned short _uiPadc, _uiTadc; |
joeh | 0:5a72175e5cb2 | 39 | I2C *_i2c; |
joeh | 0:5a72175e5cb2 | 40 | Serial *_pc; |
joeh | 0:5a72175e5cb2 | 41 | bool _debug; |
joeh | 0:5a72175e5cb2 | 42 | |
joeh | 0:5a72175e5cb2 | 43 | |
joeh | 0:5a72175e5cb2 | 44 | public: |
joeh | 0:5a72175e5cb2 | 45 | MPL115A2(I2C *i2c, const PinName shdnPin = p21); |
joeh | 0:5a72175e5cb2 | 46 | MPL115A2(I2C *i2c, Serial *pc, const PinName shdnPin = p21); //pass serial for debug |
joeh | 0:5a72175e5cb2 | 47 | void begin(); |
joeh | 0:5a72175e5cb2 | 48 | void shutdown(); |
joeh | 0:5a72175e5cb2 | 49 | void ReadSensor(); |
joeh | 0:5a72175e5cb2 | 50 | float GetPressure(); |
joeh | 0:5a72175e5cb2 | 51 | float GetTemperature(); |
joeh | 0:5a72175e5cb2 | 52 | }; |
joeh | 0:5a72175e5cb2 | 53 | #endif |