Class to drive the Compass (LSM303 device with Accelerometer and Magnetometer) present on DISCO_L476VG board.
Dependents: DiscoLogger vcdMaker_Demo_DISCO_L476 DISCO_L476VG_Compass_Lab_6 Final_project_Compass ... more
COMPASS_DISCO_L476VG.cpp@0:6508fa5521e0, 2015-09-22 (annotated)
- Committer:
- bcostm
- Date:
- Tue Sep 22 14:53:31 2015 +0000
- Revision:
- 0:6508fa5521e0
Initial version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:6508fa5521e0 | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
bcostm | 0:6508fa5521e0 | 2 | * |
bcostm | 0:6508fa5521e0 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
bcostm | 0:6508fa5521e0 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
bcostm | 0:6508fa5521e0 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
bcostm | 0:6508fa5521e0 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
bcostm | 0:6508fa5521e0 | 7 | * Software is furnished to do so, subject to the following conditions: |
bcostm | 0:6508fa5521e0 | 8 | * |
bcostm | 0:6508fa5521e0 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
bcostm | 0:6508fa5521e0 | 10 | * substantial portions of the Software. |
bcostm | 0:6508fa5521e0 | 11 | * |
bcostm | 0:6508fa5521e0 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
bcostm | 0:6508fa5521e0 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
bcostm | 0:6508fa5521e0 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
bcostm | 0:6508fa5521e0 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
bcostm | 0:6508fa5521e0 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
bcostm | 0:6508fa5521e0 | 17 | */ |
bcostm | 0:6508fa5521e0 | 18 | |
bcostm | 0:6508fa5521e0 | 19 | #include "COMPASS_DISCO_L476VG.h" |
bcostm | 0:6508fa5521e0 | 20 | |
bcostm | 0:6508fa5521e0 | 21 | // Constructor |
bcostm | 0:6508fa5521e0 | 22 | COMPASS_DISCO_L476VG::COMPASS_DISCO_L476VG() |
bcostm | 0:6508fa5521e0 | 23 | { |
bcostm | 0:6508fa5521e0 | 24 | BSP_COMPASS_Init(); |
bcostm | 0:6508fa5521e0 | 25 | } |
bcostm | 0:6508fa5521e0 | 26 | |
bcostm | 0:6508fa5521e0 | 27 | // Destructor |
bcostm | 0:6508fa5521e0 | 28 | COMPASS_DISCO_L476VG::~COMPASS_DISCO_L476VG() |
bcostm | 0:6508fa5521e0 | 29 | { |
bcostm | 0:6508fa5521e0 | 30 | BSP_COMPASS_DeInit(); |
bcostm | 0:6508fa5521e0 | 31 | } |
bcostm | 0:6508fa5521e0 | 32 | |
bcostm | 0:6508fa5521e0 | 33 | //================================================================================================================= |
bcostm | 0:6508fa5521e0 | 34 | // Public methods |
bcostm | 0:6508fa5521e0 | 35 | //================================================================================================================= |
bcostm | 0:6508fa5521e0 | 36 | |
bcostm | 0:6508fa5521e0 | 37 | COMPASS_StatusTypeDef COMPASS_DISCO_L476VG::Init(void) |
bcostm | 0:6508fa5521e0 | 38 | { |
bcostm | 0:6508fa5521e0 | 39 | return BSP_COMPASS_Init(); |
bcostm | 0:6508fa5521e0 | 40 | } |
bcostm | 0:6508fa5521e0 | 41 | |
bcostm | 0:6508fa5521e0 | 42 | void COMPASS_DISCO_L476VG::DeInit(void) |
bcostm | 0:6508fa5521e0 | 43 | { |
bcostm | 0:6508fa5521e0 | 44 | BSP_COMPASS_DeInit(); |
bcostm | 0:6508fa5521e0 | 45 | } |
bcostm | 0:6508fa5521e0 | 46 | |
bcostm | 0:6508fa5521e0 | 47 | void COMPASS_DISCO_L476VG::LowPower(void) |
bcostm | 0:6508fa5521e0 | 48 | { |
bcostm | 0:6508fa5521e0 | 49 | BSP_COMPASS_LowPower(); |
bcostm | 0:6508fa5521e0 | 50 | } |
bcostm | 0:6508fa5521e0 | 51 | |
bcostm | 0:6508fa5521e0 | 52 | void COMPASS_DISCO_L476VG::AccGetXYZ(int16_t *pDataXYZ) |
bcostm | 0:6508fa5521e0 | 53 | { |
bcostm | 0:6508fa5521e0 | 54 | BSP_COMPASS_AccGetXYZ(pDataXYZ); |
bcostm | 0:6508fa5521e0 | 55 | } |
bcostm | 0:6508fa5521e0 | 56 | |
bcostm | 0:6508fa5521e0 | 57 | void COMPASS_DISCO_L476VG::MagGetXYZ(int16_t *pDataXYZ) |
bcostm | 0:6508fa5521e0 | 58 | { |
bcostm | 0:6508fa5521e0 | 59 | BSP_COMPASS_MagGetXYZ(pDataXYZ); |
bcostm | 0:6508fa5521e0 | 60 | } |
bcostm | 0:6508fa5521e0 | 61 | |
bcostm | 0:6508fa5521e0 | 62 | //================================================================================================================= |
bcostm | 0:6508fa5521e0 | 63 | // Private methods |
bcostm | 0:6508fa5521e0 | 64 | //================================================================================================================= |
bcostm | 0:6508fa5521e0 | 65 |