ST / BSP_DISCO_L4R9I

Dependents:   DISCO_L4R9I-LCD-demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pwrmon.h Source File

pwrmon.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    pwrmon.h
00004   * @author  MCD Application Team
00005   * @brief   This header file contains the functions prototypes for the
00006   *          Current/Power Monitor device driver.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
00011   * All rights reserved.</center></h2>
00012   *
00013   * This software component is licensed by ST under BSD 3-Clause license,
00014   * the "License"; You may not use this file except in compliance with the
00015   * License. You may obtain a copy of the License at:
00016   *                        opensource.org/licenses/BSD-3-Clause
00017   *
00018   ******************************************************************************
00019   */
00020 
00021 /* Define to prevent recursive inclusion -------------------------------------*/
00022 #ifndef __PWRMON_H
00023 #define __PWRMON_H
00024 
00025 #ifdef __cplusplus
00026  extern "C" {
00027 #endif
00028 
00029 /* Includes ------------------------------------------------------------------*/
00030 #include <stdint.h>
00031 
00032 /** @addtogroup BSP
00033   * @{
00034   */
00035 
00036 /** @addtogroup Components
00037   * @{
00038   */
00039     
00040 /** @addtogroup PWRMON
00041   * @{
00042   */
00043 
00044 /** @defgroup PWRMON_Exported_Types
00045   * @{
00046   */
00047 
00048 /** @defgroup PWRMON_Operating_Mode_enum  Power Monitor Operating Mode enums
00049   * @{
00050   */
00051 typedef enum {
00052   OPERATING_MODE_TRIGGERED = 0,
00053   OPERATING_MODE_CONTINUOUS,
00054   OPERATING_MODE_NB
00055 } PWRMON_OperatingMode_t;
00056 /**
00057   * @}
00058   */
00059 
00060 /** @defgroup PWRMON_Conversion_Time_enum  Power Monitor Conversion_Time enums
00061   * @{
00062   */
00063 typedef enum {
00064   CONVERT_TIME_140 = 0,
00065   CONVERT_TIME_204,
00066   CONVERT_TIME_332,
00067   CONVERT_TIME_588,
00068   CONVERT_TIME_1100,
00069   CONVERT_TIME_2116,
00070   CONVERT_TIME_4156,
00071   CONVERT_TIME_8244,
00072   CONVERT_TIME_NB
00073 } PWRMON_ConvertTime_t;
00074 /**
00075   * @}
00076   */
00077 
00078 /** @defgroup PWRMON_Conversion_Time_enum  Power Monitor Conversion_Time enums
00079   * @{
00080   */
00081 typedef enum {
00082   AVERAGING_MODE_1 = 0,
00083   AVERAGING_MODE_4,
00084   AVERAGING_MODE_16,
00085   AVERAGING_MODE_64,
00086   AVERAGING_MODE_128,
00087   AVERAGING_MODE_256,
00088   AVERAGING_MODE_512,
00089   AVERAGING_MODE_1024,
00090   AVERAGING_MODE_NB
00091 } PWRMON_AveragingMode_t;
00092 /**
00093   * @}
00094   */
00095 
00096 /** @defgroup PWRMON_Device_Configuration_structure  Power Monitor Device Configuration structure
00097   * @{
00098   */
00099 typedef struct
00100 {
00101   PWRMON_ConvertTime_t    ShuntConvertTime;
00102   PWRMON_ConvertTime_t    BusConvertTime;
00103   PWRMON_AveragingMode_t  AveragingMode;
00104 } PWRMON_Config_t;
00105 /**
00106   * @}
00107   */
00108 
00109 /** @defgroup PWRMON_Alert_Polarity_enum  Power Monitor Alert Polarity enums
00110   * @{
00111   */
00112 typedef enum {
00113   ALERT_POLARITY_NORMAL = 0,
00114   ALERT_POLARITY_INVERTED,
00115   ALERT_POLARITY_NB
00116 } PWRMON_AlertPolarity_t;
00117 /**
00118   * @}
00119   */
00120 
00121 /** @defgroup PWRMON_Alert_Latch_Enable_enum  Power Monitor Alert Latch Enable enums
00122   * @{
00123   */
00124 typedef enum {
00125   ALERT_LATCH_DISABLE = 0,
00126   ALERT_LATCH_ENABLE,
00127   ALERT_LATCH_NB
00128 } PWRMON_AlertLatchEnable_t;
00129 /**
00130   * @}
00131   */
00132 
00133 /** @defgroup PWRMON_Alert_Function_enum  Power Monitor Alert Function enums
00134   * @{
00135   */
00136 typedef enum {
00137   ALERT_FUNCTION_NONE = 0,
00138   ALERT_FUNCTION_SOL,
00139   ALERT_FUNCTION_SUL,
00140   ALERT_FUNCTION_BOL,
00141   ALERT_FUNCTION_BUL,
00142   ALERT_FUNCTION_POL,
00143   ALERT_FUNCTION_NB,
00144 } PWRMON_AlertFunction_t;
00145 /**
00146   * @}
00147   */
00148 
00149 /** @defgroup PWRMON_Alert_Configuration_structure  Power Monitor Alert Configuration structure
00150   * @{
00151   */
00152 typedef struct
00153 {  
00154   PWRMON_AlertPolarity_t    Polarity;
00155   PWRMON_AlertLatchEnable_t LatchEnable;
00156 } PWRMON_AlertPinConfig_t;
00157 /**
00158   * @}
00159   */
00160 
00161 /** @defgroup PWRMON_Voltage_Input_enum  Power Monitor Voltage Input enums
00162   * @{
00163   */
00164 typedef enum {
00165   VOLTAGE_INPUT_SHUNT = 0,
00166   VOLTAGE_INPUT_BUS,
00167   VOLTAGE_INPUT_ALL,
00168   VOLTAGE_INPUT_NB
00169 } PWRMON_InputSignal_t;
00170 /**
00171   * @}
00172   */
00173 
00174 /** @defgroup PWRMON_Flag_enum  Power Monitor Flag enums
00175   * @{
00176   */
00177 typedef enum {
00178   FLAG_ALERT_FUNCTION = 0,
00179   FLAG_CONVERSION_READY,
00180   FLAG_MATH_OVERFLOW,
00181   FLAG_NB
00182 } PWRMON_Flag_t;
00183 /**
00184   * @}
00185   */
00186 
00187 /** @defgroup PWRMON_Driver_structure  Power Monitor Driver structure
00188   * @{
00189   */
00190 typedef struct
00191 {  
00192 void                        (*Init)(uint16_t, PWRMON_Config_t *);
00193 void                        (*DeInit)(uint16_t);
00194 uint16_t                    (*ReadId)(uint16_t);
00195 void                        (*Reset)(uint16_t);
00196 void                        (*SetCalibration)(uint16_t, uint16_t);
00197 uint16_t                    (*GetCalibration)(uint16_t);
00198 void                        (*SetAlertFunction)(uint16_t, PWRMON_AlertFunction_t);
00199 PWRMON_AlertFunction_t (*GetAlertFunction)(uint16_t);
00200 void                        (*AlertPinConfig)(uint16_t, PWRMON_AlertPinConfig_t *);
00201 void                        (*SetVBusThreshold)(uint16_t, uint16_t);
00202 uint16_t                    (*GetVBusThreshold)(uint16_t);
00203 void                        (*SetVShuntThreshold)(uint16_t, int16_t);
00204 int16_t                     (*GetVShuntThreshold)(uint16_t);
00205 void                        (*SetPowerThreshold)(uint16_t, uint32_t);
00206 uint32_t                    (*GetPowerThreshold)(uint16_t);
00207 void                        (*AlertThresholdEnableIT)(uint16_t);
00208 void                        (*AlertThresholdDisableIT)(uint16_t);
00209 void                        (*ConversionReadyEnableIT)(uint16_t);
00210 void                        (*ConversionReadyDisableIT)(uint16_t);
00211 void                        (*StartConversion)(uint16_t, PWRMON_InputSignal_t, PWRMON_OperatingMode_t);
00212 void                        (*StopConversion)(uint16_t);
00213 uint16_t                    (*GetVBus)(uint16_t);
00214 int16_t                     (*GetVShunt)(uint16_t);
00215 uint16_t                    (*GetPower)(uint16_t);
00216 int16_t                     (*GetCurrent)(uint16_t);
00217 uint8_t                     (*GetFlag)(uint16_t, PWRMON_Flag_t);
00218 } PWRMON_Drv_t;
00219 /**
00220   * @}
00221   */
00222 
00223 /**
00224   * @}
00225   */
00226 
00227 
00228 /**
00229   * @}
00230   */
00231 
00232 /**
00233   * @}
00234   */
00235 
00236 /**
00237   * @}
00238   */
00239 
00240 #ifdef __cplusplus
00241 }
00242 #endif
00243 
00244 #endif /* __PWRMON_H */
00245 
00246 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/