Class to drive the Gyroscope (L3GD20 device) present on DISCO_L476VG board.
Dependents: DISCO_L476VG_Gyro DISCO_L476VG_AccGy1 DISCO_AcGy1_OK DISCO_L476VG_AccGy2 ... more
GYRO_DISCO_L476VG.cpp@0:9dc4ecb46a75, 2015-09-24 (annotated)
- Committer:
- bcostm
- Date:
- Thu Sep 24 06:56:41 2015 +0000
- Revision:
- 0:9dc4ecb46a75
Initial version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:9dc4ecb46a75 | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
bcostm | 0:9dc4ecb46a75 | 2 | * |
bcostm | 0:9dc4ecb46a75 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
bcostm | 0:9dc4ecb46a75 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
bcostm | 0:9dc4ecb46a75 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
bcostm | 0:9dc4ecb46a75 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
bcostm | 0:9dc4ecb46a75 | 7 | * Software is furnished to do so, subject to the following conditions: |
bcostm | 0:9dc4ecb46a75 | 8 | * |
bcostm | 0:9dc4ecb46a75 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
bcostm | 0:9dc4ecb46a75 | 10 | * substantial portions of the Software. |
bcostm | 0:9dc4ecb46a75 | 11 | * |
bcostm | 0:9dc4ecb46a75 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
bcostm | 0:9dc4ecb46a75 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
bcostm | 0:9dc4ecb46a75 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
bcostm | 0:9dc4ecb46a75 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
bcostm | 0:9dc4ecb46a75 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
bcostm | 0:9dc4ecb46a75 | 17 | */ |
bcostm | 0:9dc4ecb46a75 | 18 | |
bcostm | 0:9dc4ecb46a75 | 19 | #include "GYRO_DISCO_L476VG.h" |
bcostm | 0:9dc4ecb46a75 | 20 | |
bcostm | 0:9dc4ecb46a75 | 21 | // Constructor |
bcostm | 0:9dc4ecb46a75 | 22 | GYRO_DISCO_L476VG::GYRO_DISCO_L476VG() |
bcostm | 0:9dc4ecb46a75 | 23 | { |
bcostm | 0:9dc4ecb46a75 | 24 | BSP_GYRO_Init(); |
bcostm | 0:9dc4ecb46a75 | 25 | } |
bcostm | 0:9dc4ecb46a75 | 26 | |
bcostm | 0:9dc4ecb46a75 | 27 | // Destructor |
bcostm | 0:9dc4ecb46a75 | 28 | GYRO_DISCO_L476VG::~GYRO_DISCO_L476VG() |
bcostm | 0:9dc4ecb46a75 | 29 | { |
bcostm | 0:9dc4ecb46a75 | 30 | BSP_GYRO_DeInit(); |
bcostm | 0:9dc4ecb46a75 | 31 | } |
bcostm | 0:9dc4ecb46a75 | 32 | |
bcostm | 0:9dc4ecb46a75 | 33 | //================================================================================================================= |
bcostm | 0:9dc4ecb46a75 | 34 | // Public methods |
bcostm | 0:9dc4ecb46a75 | 35 | //================================================================================================================= |
bcostm | 0:9dc4ecb46a75 | 36 | |
bcostm | 0:9dc4ecb46a75 | 37 | uint8_t GYRO_DISCO_L476VG::Init(void) |
bcostm | 0:9dc4ecb46a75 | 38 | { |
bcostm | 0:9dc4ecb46a75 | 39 | return BSP_GYRO_Init(); |
bcostm | 0:9dc4ecb46a75 | 40 | } |
bcostm | 0:9dc4ecb46a75 | 41 | |
bcostm | 0:9dc4ecb46a75 | 42 | void GYRO_DISCO_L476VG::DeInit(void) |
bcostm | 0:9dc4ecb46a75 | 43 | { |
bcostm | 0:9dc4ecb46a75 | 44 | BSP_GYRO_DeInit(); |
bcostm | 0:9dc4ecb46a75 | 45 | } |
bcostm | 0:9dc4ecb46a75 | 46 | |
bcostm | 0:9dc4ecb46a75 | 47 | void GYRO_DISCO_L476VG::LowPower(void) |
bcostm | 0:9dc4ecb46a75 | 48 | { |
bcostm | 0:9dc4ecb46a75 | 49 | BSP_GYRO_LowPower(); |
bcostm | 0:9dc4ecb46a75 | 50 | } |
bcostm | 0:9dc4ecb46a75 | 51 | |
bcostm | 0:9dc4ecb46a75 | 52 | void GYRO_DISCO_L476VG::Reset(void) |
bcostm | 0:9dc4ecb46a75 | 53 | { |
bcostm | 0:9dc4ecb46a75 | 54 | BSP_GYRO_Reset(); |
bcostm | 0:9dc4ecb46a75 | 55 | } |
bcostm | 0:9dc4ecb46a75 | 56 | |
bcostm | 0:9dc4ecb46a75 | 57 | uint8_t GYRO_DISCO_L476VG::ReadID(void) |
bcostm | 0:9dc4ecb46a75 | 58 | { |
bcostm | 0:9dc4ecb46a75 | 59 | return BSP_GYRO_ReadID(); |
bcostm | 0:9dc4ecb46a75 | 60 | } |
bcostm | 0:9dc4ecb46a75 | 61 | |
bcostm | 0:9dc4ecb46a75 | 62 | void GYRO_DISCO_L476VG::ITConfig(GYRO_InterruptConfigTypeDef *pIntConfigStruct) |
bcostm | 0:9dc4ecb46a75 | 63 | { |
bcostm | 0:9dc4ecb46a75 | 64 | BSP_GYRO_ITConfig(pIntConfigStruct); |
bcostm | 0:9dc4ecb46a75 | 65 | } |
bcostm | 0:9dc4ecb46a75 | 66 | |
bcostm | 0:9dc4ecb46a75 | 67 | void GYRO_DISCO_L476VG::EnableIT(uint8_t IntPin) |
bcostm | 0:9dc4ecb46a75 | 68 | { |
bcostm | 0:9dc4ecb46a75 | 69 | BSP_GYRO_EnableIT(IntPin); |
bcostm | 0:9dc4ecb46a75 | 70 | } |
bcostm | 0:9dc4ecb46a75 | 71 | |
bcostm | 0:9dc4ecb46a75 | 72 | void GYRO_DISCO_L476VG::DisableIT(uint8_t IntPin) |
bcostm | 0:9dc4ecb46a75 | 73 | { |
bcostm | 0:9dc4ecb46a75 | 74 | BSP_GYRO_DisableIT(IntPin); |
bcostm | 0:9dc4ecb46a75 | 75 | } |
bcostm | 0:9dc4ecb46a75 | 76 | |
bcostm | 0:9dc4ecb46a75 | 77 | void GYRO_DISCO_L476VG::GetXYZ(float* pfData) |
bcostm | 0:9dc4ecb46a75 | 78 | { |
bcostm | 0:9dc4ecb46a75 | 79 | BSP_GYRO_GetXYZ(pfData); |
bcostm | 0:9dc4ecb46a75 | 80 | } |
bcostm | 0:9dc4ecb46a75 | 81 | |
bcostm | 0:9dc4ecb46a75 | 82 | //================================================================================================================= |
bcostm | 0:9dc4ecb46a75 | 83 | // Private methods |
bcostm | 0:9dc4ecb46a75 | 84 | //================================================================================================================= |
bcostm | 0:9dc4ecb46a75 | 85 | |
bcostm | 0:9dc4ecb46a75 | 86 |