BSP Drivers

Dependencies:   CMSIS_STM32L4xx CMSIS_DSP_401 STM32L4xx_HAL_Driver

Dependents:   DiscoAudioRecord

Committer:
EricLew
Date:
Mon Nov 02 19:38:36 2015 +0000
Revision:
0:ad9dfc0179dc
commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EricLew 0:ad9dfc0179dc 1 /**
EricLew 0:ad9dfc0179dc 2 ******************************************************************************
EricLew 0:ad9dfc0179dc 3 * @file idd.h
EricLew 0:ad9dfc0179dc 4 * @author MCD Application Team
EricLew 0:ad9dfc0179dc 5 * @version V4.0.1
EricLew 0:ad9dfc0179dc 6 * @date 21-July-2015
EricLew 0:ad9dfc0179dc 7 * @brief This file contains all the functions prototypes for the IDD driver.
EricLew 0:ad9dfc0179dc 8 ******************************************************************************
EricLew 0:ad9dfc0179dc 9 * @attention
EricLew 0:ad9dfc0179dc 10 *
EricLew 0:ad9dfc0179dc 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
EricLew 0:ad9dfc0179dc 12 *
EricLew 0:ad9dfc0179dc 13 * Redistribution and use in source and binary forms, with or without modification,
EricLew 0:ad9dfc0179dc 14 * are permitted provided that the following conditions are met:
EricLew 0:ad9dfc0179dc 15 * 1. Redistributions of source code must retain the above copyright notice,
EricLew 0:ad9dfc0179dc 16 * this list of conditions and the following disclaimer.
EricLew 0:ad9dfc0179dc 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
EricLew 0:ad9dfc0179dc 18 * this list of conditions and the following disclaimer in the documentation
EricLew 0:ad9dfc0179dc 19 * and/or other materials provided with the distribution.
EricLew 0:ad9dfc0179dc 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
EricLew 0:ad9dfc0179dc 21 * may be used to endorse or promote products derived from this software
EricLew 0:ad9dfc0179dc 22 * without specific prior written permission.
EricLew 0:ad9dfc0179dc 23 *
EricLew 0:ad9dfc0179dc 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
EricLew 0:ad9dfc0179dc 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
EricLew 0:ad9dfc0179dc 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
EricLew 0:ad9dfc0179dc 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
EricLew 0:ad9dfc0179dc 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
EricLew 0:ad9dfc0179dc 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
EricLew 0:ad9dfc0179dc 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
EricLew 0:ad9dfc0179dc 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
EricLew 0:ad9dfc0179dc 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
EricLew 0:ad9dfc0179dc 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EricLew 0:ad9dfc0179dc 34 *
EricLew 0:ad9dfc0179dc 35 ******************************************************************************
EricLew 0:ad9dfc0179dc 36 */
EricLew 0:ad9dfc0179dc 37
EricLew 0:ad9dfc0179dc 38 /* Define to prevent recursive inclusion -------------------------------------*/
EricLew 0:ad9dfc0179dc 39 #ifndef __IDD_H
EricLew 0:ad9dfc0179dc 40 #define __IDD_H
EricLew 0:ad9dfc0179dc 41
EricLew 0:ad9dfc0179dc 42 #ifdef __cplusplus
EricLew 0:ad9dfc0179dc 43 extern "C" {
EricLew 0:ad9dfc0179dc 44 #endif
EricLew 0:ad9dfc0179dc 45
EricLew 0:ad9dfc0179dc 46 /* Includes ------------------------------------------------------------------*/
EricLew 0:ad9dfc0179dc 47 #include <stdint.h>
EricLew 0:ad9dfc0179dc 48
EricLew 0:ad9dfc0179dc 49 /** @addtogroup BSP
EricLew 0:ad9dfc0179dc 50 * @{
EricLew 0:ad9dfc0179dc 51 */
EricLew 0:ad9dfc0179dc 52
EricLew 0:ad9dfc0179dc 53 /** @addtogroup Components
EricLew 0:ad9dfc0179dc 54 * @{
EricLew 0:ad9dfc0179dc 55 */
EricLew 0:ad9dfc0179dc 56
EricLew 0:ad9dfc0179dc 57 /** @addtogroup IDD
EricLew 0:ad9dfc0179dc 58 * @{
EricLew 0:ad9dfc0179dc 59 */
EricLew 0:ad9dfc0179dc 60
EricLew 0:ad9dfc0179dc 61 /** @defgroup IDD_Exported_Types IDD Exported Types
EricLew 0:ad9dfc0179dc 62 * @{
EricLew 0:ad9dfc0179dc 63 */
EricLew 0:ad9dfc0179dc 64
EricLew 0:ad9dfc0179dc 65 /** @defgroup IDD_Config_structure IDD Configuration structure
EricLew 0:ad9dfc0179dc 66 * @{
EricLew 0:ad9dfc0179dc 67 */
EricLew 0:ad9dfc0179dc 68 typedef struct
EricLew 0:ad9dfc0179dc 69 {
EricLew 0:ad9dfc0179dc 70 uint16_t AmpliGain; /*!< Specifies ampli gain value
EricLew 0:ad9dfc0179dc 71 */
EricLew 0:ad9dfc0179dc 72 uint16_t VddMin; /*!< Specifies minimum MCU VDD can reach to protect MCU from reset
EricLew 0:ad9dfc0179dc 73 */
EricLew 0:ad9dfc0179dc 74 uint16_t Shunt0Value; /*!< Specifies value of Shunt 0 if existing
EricLew 0:ad9dfc0179dc 75 */
EricLew 0:ad9dfc0179dc 76 uint16_t Shunt1Value; /*!< Specifies value of Shunt 1 if existing
EricLew 0:ad9dfc0179dc 77 */
EricLew 0:ad9dfc0179dc 78 uint16_t Shunt2Value; /*!< Specifies value of Shunt 2 if existing
EricLew 0:ad9dfc0179dc 79 */
EricLew 0:ad9dfc0179dc 80 uint16_t Shunt3Value; /*!< Specifies value of Shunt 3 if existing
EricLew 0:ad9dfc0179dc 81 */
EricLew 0:ad9dfc0179dc 82 uint16_t Shunt4Value; /*!< Specifies value of Shunt 4 if existing
EricLew 0:ad9dfc0179dc 83 */
EricLew 0:ad9dfc0179dc 84 uint16_t Shunt0StabDelay; /*!< Specifies delay of Shunt 0 stabilization if existing
EricLew 0:ad9dfc0179dc 85 */
EricLew 0:ad9dfc0179dc 86 uint16_t Shunt1StabDelay; /*!< Specifies delay of Shunt 1 stabilization if existing
EricLew 0:ad9dfc0179dc 87 */
EricLew 0:ad9dfc0179dc 88 uint16_t Shunt2StabDelay; /*!< Specifies delay of Shunt 2 stabilization if existing
EricLew 0:ad9dfc0179dc 89 */
EricLew 0:ad9dfc0179dc 90 uint16_t Shunt3StabDelay; /*!< Specifies delay of Shunt 3 stabilization if existing
EricLew 0:ad9dfc0179dc 91 */
EricLew 0:ad9dfc0179dc 92 uint16_t Shunt4StabDelay; /*!< Specifies delay of Shunt 4 stabilization if existing
EricLew 0:ad9dfc0179dc 93 */
EricLew 0:ad9dfc0179dc 94 uint8_t ShuntNbOnBoard; /*!< Specifies number of shunts that are present on board
EricLew 0:ad9dfc0179dc 95 This parameter can be a value of @ref IDD_shunt_number */
EricLew 0:ad9dfc0179dc 96 uint8_t ShuntNbUsed; /*!< Specifies number of shunts used for measurement
EricLew 0:ad9dfc0179dc 97 This parameter can be a value of @ref IDD_shunt_number */
EricLew 0:ad9dfc0179dc 98 uint8_t VrefMeasurement; /*!< Specifies if Vref is automatically measured before each Idd measurement
EricLew 0:ad9dfc0179dc 99 This parameter can be a value of @ref IDD_Vref_Measurement */
EricLew 0:ad9dfc0179dc 100 uint8_t Calibration; /*!< Specifies if calibration is done before each Idd measurement
EricLew 0:ad9dfc0179dc 101 */
EricLew 0:ad9dfc0179dc 102 uint8_t PreDelayUnit; /*!< Specifies Pre delay unit
EricLew 0:ad9dfc0179dc 103 This parameter can be a value of @ref IDD_PreDelay */
EricLew 0:ad9dfc0179dc 104 uint8_t PreDelayValue; /*!< Specifies Pre delay value in selected unit
EricLew 0:ad9dfc0179dc 105 */
EricLew 0:ad9dfc0179dc 106 uint8_t MeasureNb; /*!< Specifies number of Measure to be performed
EricLew 0:ad9dfc0179dc 107 This parameter can be a value between 1 and 256 */
EricLew 0:ad9dfc0179dc 108 uint8_t DeltaDelayUnit; /*!< Specifies Delta delay unit
EricLew 0:ad9dfc0179dc 109 This parameter can be a value of @ref IDD_DeltaDelay */
EricLew 0:ad9dfc0179dc 110 uint8_t DeltaDelayValue; /*!< Specifies Delta delay between 2 measures
EricLew 0:ad9dfc0179dc 111 value can be between 1 and 128 */
EricLew 0:ad9dfc0179dc 112 }IDD_ConfigTypeDef;
EricLew 0:ad9dfc0179dc 113 /**
EricLew 0:ad9dfc0179dc 114 * @}
EricLew 0:ad9dfc0179dc 115 */
EricLew 0:ad9dfc0179dc 116
EricLew 0:ad9dfc0179dc 117 /** @defgroup IDD_Driver_structure IDD Driver structure
EricLew 0:ad9dfc0179dc 118 * @{
EricLew 0:ad9dfc0179dc 119 */
EricLew 0:ad9dfc0179dc 120 typedef struct
EricLew 0:ad9dfc0179dc 121 {
EricLew 0:ad9dfc0179dc 122 void (*Init)(uint16_t);
EricLew 0:ad9dfc0179dc 123 void (*DeInit)(uint16_t);
EricLew 0:ad9dfc0179dc 124 uint16_t (*ReadID)(uint16_t);
EricLew 0:ad9dfc0179dc 125 void (*Reset)(uint16_t);
EricLew 0:ad9dfc0179dc 126 void (*LowPower)(uint16_t);
EricLew 0:ad9dfc0179dc 127 void (*WakeUp)(uint16_t);
EricLew 0:ad9dfc0179dc 128 void (*Start)(uint16_t);
EricLew 0:ad9dfc0179dc 129 void (*Config)(uint16_t,IDD_ConfigTypeDef);
EricLew 0:ad9dfc0179dc 130 void (*GetValue)(uint16_t, uint32_t *);
EricLew 0:ad9dfc0179dc 131 void (*EnableIT)(uint16_t);
EricLew 0:ad9dfc0179dc 132 void (*ClearIT)(uint16_t);
EricLew 0:ad9dfc0179dc 133 uint8_t (*GetITStatus)(uint16_t);
EricLew 0:ad9dfc0179dc 134 void (*DisableIT)(uint16_t);
EricLew 0:ad9dfc0179dc 135 void (*ErrorEnableIT)(uint16_t);
EricLew 0:ad9dfc0179dc 136 void (*ErrorClearIT)(uint16_t);
EricLew 0:ad9dfc0179dc 137 uint8_t (*ErrorGetITStatus)(uint16_t);
EricLew 0:ad9dfc0179dc 138 void (*ErrorDisableIT)(uint16_t);
EricLew 0:ad9dfc0179dc 139 uint8_t (*ErrorGetSrc)(uint16_t);
EricLew 0:ad9dfc0179dc 140 uint8_t (*ErrorGetCode)(uint16_t);
EricLew 0:ad9dfc0179dc 141 }IDD_DrvTypeDef;
EricLew 0:ad9dfc0179dc 142 /**
EricLew 0:ad9dfc0179dc 143 * @}
EricLew 0:ad9dfc0179dc 144 */
EricLew 0:ad9dfc0179dc 145
EricLew 0:ad9dfc0179dc 146 /**
EricLew 0:ad9dfc0179dc 147 * @}
EricLew 0:ad9dfc0179dc 148 */
EricLew 0:ad9dfc0179dc 149
EricLew 0:ad9dfc0179dc 150 /**
EricLew 0:ad9dfc0179dc 151 * @}
EricLew 0:ad9dfc0179dc 152 */
EricLew 0:ad9dfc0179dc 153
EricLew 0:ad9dfc0179dc 154 /**
EricLew 0:ad9dfc0179dc 155 * @}
EricLew 0:ad9dfc0179dc 156 */
EricLew 0:ad9dfc0179dc 157
EricLew 0:ad9dfc0179dc 158 /**
EricLew 0:ad9dfc0179dc 159 * @}
EricLew 0:ad9dfc0179dc 160 */
EricLew 0:ad9dfc0179dc 161
EricLew 0:ad9dfc0179dc 162 #ifdef __cplusplus
EricLew 0:ad9dfc0179dc 163 }
EricLew 0:ad9dfc0179dc 164 #endif
EricLew 0:ad9dfc0179dc 165
EricLew 0:ad9dfc0179dc 166 #endif /* __IDD_H */
EricLew 0:ad9dfc0179dc 167
EricLew 0:ad9dfc0179dc 168 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
EricLew 0:ad9dfc0179dc 169