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.
Fork of FXOS8700Q by
Revision 12:0ab2a7fab065, committed 2015-07-22
- Comitter:
- Pythia
- Date:
- Wed Jul 22 13:15:24 2015 +0000
- Parent:
- 11:aee7dea904e2
- Commit message:
- Added temperature measurement.
; The functionality is added only to magnetic sensor portion as physically is dependent on enabling the magnetic portion.
Changed in this revision
FXOS8700Q.cpp | Show annotated file Show diff for this revision Revisions of this file |
FXOS8700Q.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/FXOS8700Q.cpp Fri Jun 19 12:16:44 2015 -0500 +++ b/FXOS8700Q.cpp Wed Jul 22 13:15:24 2015 +0000 @@ -229,3 +229,10 @@ xyz.y = static_cast<float>(_xyz.y * 0.1f); xyz.z = static_cast<float>(_xyz.z * 0.1f); } + +int8_t FXOS8700QMagnetometer::getTemperature(void) +{ + uint8_t res; + readRegs(FXOS8700Q_TEMP, &res, sizeof(res)); + return (int8_t)res; +} \ No newline at end of file
--- a/FXOS8700Q.h Fri Jun 19 12:16:44 2015 -0500 +++ b/FXOS8700Q.h Wed Jul 22 13:15:24 2015 +0000 @@ -36,6 +36,7 @@ #define FXOS8700Q_WHOAMI 0x0D #define FXOS8700Q_XYZ_DATA_CFG 0x0E #define FXOS8700Q_CTRL_REG1 0x2A +#define FXOS8700Q_TEMP 0x51 #define FXOS8700Q_M_CTRL_REG1 0x5B #define FXOS8700Q_M_CTRL_REG2 0x5C #define FXOS8700Q_WHOAMI_VAL 0xC7 @@ -158,6 +159,7 @@ virtual float getZ(float &z) const; virtual void getAxis(motion_data_counts_t &xyz) const; virtual void getAxis(motion_data_units_t &xyz) const; + int8_t getTemperature(void); };