123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- /**
- ******************************************************************************
- * @file pwrmon.h
- * @author MCD Application Team
- * @brief This header file contains the functions prototypes for the
- * Current/Power Monitor device driver.
- ******************************************************************************
- * @attention
- *
- * <h2><center>© Copyright (c) 2017 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __PWRMON_H
- #define __PWRMON_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- /* Includes ------------------------------------------------------------------*/
- #include <stdint.h>
- /** @addtogroup BSP
- * @{
- */
- /** @addtogroup Components
- * @{
- */
-
- /** @addtogroup PWRMON
- * @{
- */
- /** @defgroup PWRMON_Exported_Types
- * @{
- */
- /** @defgroup PWRMON_Operating_Mode_enum Power Monitor Operating Mode enums
- * @{
- */
- typedef enum {
- OPERATING_MODE_TRIGGERED = 0,
- OPERATING_MODE_CONTINUOUS,
- OPERATING_MODE_NB
- } PWRMON_OperatingMode_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Conversion_Time_enum Power Monitor Conversion_Time enums
- * @{
- */
- typedef enum {
- CONVERT_TIME_140 = 0,
- CONVERT_TIME_204,
- CONVERT_TIME_332,
- CONVERT_TIME_588,
- CONVERT_TIME_1100,
- CONVERT_TIME_2116,
- CONVERT_TIME_4156,
- CONVERT_TIME_8244,
- CONVERT_TIME_NB
- } PWRMON_ConvertTime_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Conversion_Time_enum Power Monitor Conversion_Time enums
- * @{
- */
- typedef enum {
- AVERAGING_MODE_1 = 0,
- AVERAGING_MODE_4,
- AVERAGING_MODE_16,
- AVERAGING_MODE_64,
- AVERAGING_MODE_128,
- AVERAGING_MODE_256,
- AVERAGING_MODE_512,
- AVERAGING_MODE_1024,
- AVERAGING_MODE_NB
- } PWRMON_AveragingMode_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Device_Configuration_structure Power Monitor Device Configuration structure
- * @{
- */
- typedef struct
- {
- PWRMON_ConvertTime_t ShuntConvertTime;
- PWRMON_ConvertTime_t BusConvertTime;
- PWRMON_AveragingMode_t AveragingMode;
- } PWRMON_Config_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Alert_Polarity_enum Power Monitor Alert Polarity enums
- * @{
- */
- typedef enum {
- ALERT_POLARITY_NORMAL = 0,
- ALERT_POLARITY_INVERTED,
- ALERT_POLARITY_NB
- } PWRMON_AlertPolarity_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Alert_Latch_Enable_enum Power Monitor Alert Latch Enable enums
- * @{
- */
- typedef enum {
- ALERT_LATCH_DISABLE = 0,
- ALERT_LATCH_ENABLE,
- ALERT_LATCH_NB
- } PWRMON_AlertLatchEnable_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Alert_Function_enum Power Monitor Alert Function enums
- * @{
- */
- typedef enum {
- ALERT_FUNCTION_NONE = 0,
- ALERT_FUNCTION_SOL,
- ALERT_FUNCTION_SUL,
- ALERT_FUNCTION_BOL,
- ALERT_FUNCTION_BUL,
- ALERT_FUNCTION_POL,
- ALERT_FUNCTION_NB,
- } PWRMON_AlertFunction_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Alert_Configuration_structure Power Monitor Alert Configuration structure
- * @{
- */
- typedef struct
- {
- PWRMON_AlertPolarity_t Polarity;
- PWRMON_AlertLatchEnable_t LatchEnable;
- } PWRMON_AlertPinConfig_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Voltage_Input_enum Power Monitor Voltage Input enums
- * @{
- */
- typedef enum {
- VOLTAGE_INPUT_SHUNT = 0,
- VOLTAGE_INPUT_BUS,
- VOLTAGE_INPUT_ALL,
- VOLTAGE_INPUT_NB
- } PWRMON_InputSignal_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Flag_enum Power Monitor Flag enums
- * @{
- */
- typedef enum {
- FLAG_ALERT_FUNCTION = 0,
- FLAG_CONVERSION_READY,
- FLAG_MATH_OVERFLOW,
- FLAG_NB
- } PWRMON_Flag_t;
- /**
- * @}
- */
- /** @defgroup PWRMON_Driver_structure Power Monitor Driver structure
- * @{
- */
- typedef struct
- {
- void (*Init)(uint16_t, PWRMON_Config_t *);
- void (*DeInit)(uint16_t);
- uint16_t (*ReadId)(uint16_t);
- void (*Reset)(uint16_t);
- void (*SetCalibration)(uint16_t, uint16_t);
- uint16_t (*GetCalibration)(uint16_t);
- void (*SetAlertFunction)(uint16_t, PWRMON_AlertFunction_t);
- PWRMON_AlertFunction_t (*GetAlertFunction)(uint16_t);
- void (*AlertPinConfig)(uint16_t, PWRMON_AlertPinConfig_t *);
- void (*SetVBusThreshold)(uint16_t, uint16_t);
- uint16_t (*GetVBusThreshold)(uint16_t);
- void (*SetVShuntThreshold)(uint16_t, int16_t);
- int16_t (*GetVShuntThreshold)(uint16_t);
- void (*SetPowerThreshold)(uint16_t, uint32_t);
- uint32_t (*GetPowerThreshold)(uint16_t);
- void (*AlertThresholdEnableIT)(uint16_t);
- void (*AlertThresholdDisableIT)(uint16_t);
- void (*ConversionReadyEnableIT)(uint16_t);
- void (*ConversionReadyDisableIT)(uint16_t);
- void (*StartConversion)(uint16_t, PWRMON_InputSignal_t, PWRMON_OperatingMode_t);
- void (*StopConversion)(uint16_t);
- uint16_t (*GetVBus)(uint16_t);
- int16_t (*GetVShunt)(uint16_t);
- uint16_t (*GetPower)(uint16_t);
- int16_t (*GetCurrent)(uint16_t);
- uint8_t (*GetFlag)(uint16_t, PWRMON_Flag_t);
- } PWRMON_Drv_t;
- /**
- * @}
- */
- /**
- * @}
- */
- /**
- * @}
- */
- /**
- * @}
- */
- /**
- * @}
- */
- #ifdef __cplusplus
- }
- #endif
- #endif /* __PWRMON_H */
- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|