PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
Low Voltage Detection (LVD)

Data Structures

struct  stc_lvd_intern_data
 Low Voltage Detection internal data. More...
 
struct  stc_lvd_config
 Clock Supervisor configuration. More...
 

Macros

#define LvdSVHI_220   (0x00)
 
#define LvdSVHI_240   (0x01)
 
#define LvdSVHI_245   (0x03)
 
#define LvdSVHI_260   (0x02)
 
#define LvdSVHI_270   (0x06)
 
#define LvdSVHI_280   (0x07)
 
#define LvdSVHI_290   (0x05)
 
#define LvdSVHI_300   (0x04)
 
#define LvdSVHI_320   (0x0C)
 
#define LvdSVHI_350   (0x0D)
 
#define LvdSVHI_360   (0x0F)
 
#define LvdSVHI_370   (0x0E)
 
#define LvdSVHI_380   (0x0A)
 
#define LvdSVHI_390   (0x0B)
 
#define LvdSVHI_400   (0x09)
 
#define LvdSVHI_410   (0x08)
 
#define LvdSVHI_420   (0x18)
 
#define LvdSVHI_430   (0x19)
 
#define LvdSVHI_452   (0x1B)
 
#define LvdCtlUnlock   (0x1ACCE553)
 

Typedefs

typedef enum en_lvd_irq_voltage en_lvd_irq_voltage_t
 Interruption voltage settings for Low Voltage Detection. More...
 
typedef struct stc_lvd_intern_data stc_lvd_intern_data_t
 Low Voltage Detection internal data. More...
 
typedef struct stc_lvd_config stc_lvd_config_t
 Clock Supervisor configuration. More...
 

Enumerations

enum  en_lvd_irq_voltage {
  LvdIrqVoltage220 = 0,
  LvdIrqVoltage240 = 1,
  LvdIrqVoltage245 = 2,
  LvdIrqVoltage260 = 3,
  LvdIrqVoltage270 = 4,
  LvdIrqVoltage280 = 5,
  LvdIrqVoltage290 = 6,
  LvdIrqVoltage300 = 7,
  LvdIrqVoltage320 = 8,
  LvdIrqVoltage350 = 9,
  LvdIrqVoltage360 = 10,
  LvdIrqVoltage370 = 11,
  LvdIrqVoltage380 = 12,
  LvdIrqVoltage390 = 13,
  LvdIrqVoltage400 = 14,
  LvdIrqVoltage410 = 15,
  LvdIrqVoltage420 = 16,
  LvdIrqVoltage430 = 17,
  LvdIrqVoltage452 = 18
}
 Interruption voltage settings for Low Voltage Detection. More...
 

Functions

void LvdIrqHandler (void)
 ISR of the LVD module. More...
 
en_result_t Lvd_Init (stc_lvd_config_t *pstcConfig)
 Init the LVD module. More...
 
en_result_t Lvd_DeInit (void)
 De-Init the Interrupt of the LVD module. More...
 
boolean_t Lvd_GetIntStatus (void)
 Get the LVD interrupt status. More...
 
void Lvd_ClearIntStatus (void)
 Clear the LVD interrupt status. More...
 
boolean_t Lvd_GetIntOperationStatus (void)
 Get the operation status of the LVD interrupt. More...
 

Variables

static stc_lvd_intern_data_t stcLvdInternData = {NULL}
 

Detailed Description

Provided functions of LVD module:

Lvd_Init() enables the LVD function with the given voltage threshold. If a callback function is not specified when Lvd_Init() is called, NVIC is is not enabled. So user has to check interrupt by Lvd_GetIntStatus() and clear interrupt by Lvd_ClearIntStatus(). Lvd_DeInit() disables the LVD function. Lvd_GetIntOperationStatus() is used for checking the operation status of a LVD interrupt.

Macro Definition Documentation

#define LvdCtlUnlock   (0x1ACCE553)

Definition at line 111 of file lvd.c.

Referenced by Lvd_DeInit(), and Lvd_Init().

#define LvdSVHI_220   (0x00)

Definition at line 90 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_240   (0x01)

Definition at line 91 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_245   (0x03)

Definition at line 92 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_260   (0x02)

Definition at line 93 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_270   (0x06)

Definition at line 94 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_280   (0x07)

Definition at line 95 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_290   (0x05)

Definition at line 96 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_300   (0x04)

Definition at line 97 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_320   (0x0C)

Definition at line 98 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_350   (0x0D)

Definition at line 99 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_360   (0x0F)

Definition at line 100 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_370   (0x0E)

Definition at line 101 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_380   (0x0A)

Definition at line 102 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_390   (0x0B)

Definition at line 103 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_400   (0x09)

Definition at line 104 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_410   (0x08)

Definition at line 105 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_420   (0x18)

Definition at line 106 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_430   (0x19)

Definition at line 107 of file lvd.c.

Referenced by Lvd_Init().

#define LvdSVHI_452   (0x1B)

Definition at line 108 of file lvd.c.

Referenced by Lvd_Init().

Typedef Documentation

Interruption voltage settings for Low Voltage Detection.

Note
The enumerated values do not correspond with the bit patterns of SVHI for upward compatibility reasons.

Clock Supervisor configuration.

The Clock Supervisor configuration settings

Low Voltage Detection internal data.

Enumeration Type Documentation

Interruption voltage settings for Low Voltage Detection.

Note
The enumerated values do not correspond with the bit patterns of SVHI for upward compatibility reasons.
Enumerator
LvdIrqVoltage220 

Interrupt when voltage is vicinity of 2.20 volts.

LvdIrqVoltage240 

Interrupt when voltage is vicinity of 2.40 volts.

LvdIrqVoltage245 

Interrupt when voltage is vicinity of 2.45 volts.

LvdIrqVoltage260 

Interrupt when voltage is vicinity of 2.60 volts.

LvdIrqVoltage270 

Interrupt when voltage is vicinity of 2.70 volts.

LvdIrqVoltage280 

Interrupt when voltage is vicinity of 2.80 volts.

LvdIrqVoltage290 

Interrupt when voltage is vicinity of 2.90 volts.

LvdIrqVoltage300 

Interrupt when voltage is vicinity of 3.00 volts.

LvdIrqVoltage320 

Interrupt when voltage is vicinity of 3.20 volts.

LvdIrqVoltage350 

Interrupt when voltage is vicinity of 3.50 volts.

LvdIrqVoltage360 

Interrupt when voltage is vicinity of 3.60 volts.

LvdIrqVoltage370 

Interrupt when voltage is vicinity of 3.70 volts.

LvdIrqVoltage380 

Interrupt when voltage is vicinity of 3.80 volts.

LvdIrqVoltage390 

Interrupt when voltage is vicinity of 3.90 volts.

LvdIrqVoltage400 

Interrupt when voltage is vicinity of 4.00 volts.

LvdIrqVoltage410 

Interrupt when voltage is vicinity of 4.10 volts.

LvdIrqVoltage420 

Interrupt when voltage is vicinity of 4.20 volts.

LvdIrqVoltage430 

Interrupt when voltage is vicinity of 4.30 volts.

LvdIrqVoltage452 

Interrupt when voltage is vicinity of 4.52 volts.

Definition at line 104 of file lvd.h.

Function Documentation

void Lvd_ClearIntStatus ( void  )

Clear the LVD interrupt status.

Definition at line 303 of file lvd.c.

en_result_t Lvd_DeInit ( void  )

De-Init the Interrupt of the LVD module.

Return values
OkDe-Initializiation of LVD interupt successfully done.

Definition at line 259 of file lvd.c.

References LvdCtlUnlock, Ok, PDL_DEFAULT_INTERRUPT_LEVEL, and stc_lvd_intern_data::pfnCallback.

boolean_t Lvd_GetIntOperationStatus ( void  )

Get the operation status of the LVD interrupt.

Return values
FALSEStabilization wait state or monitoring stop state
TRUEMonitoring state

Definition at line 316 of file lvd.c.

References FALSE, and TRUE.

boolean_t Lvd_GetIntStatus ( void  )

Get the LVD interrupt status.

Return values
FALSEA low-voltage detection is not detected.
TRUEA low-voltage detection has been detected.

Definition at line 286 of file lvd.c.

References FALSE, and TRUE.

en_result_t Lvd_Init ( stc_lvd_config_t *  pstcConfig)

Init the LVD module.

The LVD (reset) is always active. Generating interrupts is able to use by specifying callback function. If callback function is not specified (NULL), interrupt (LVD function) is enabled, but NVIC is not enabled. So user has to check interrupt status by Lvd_GetIntStatus. This function enables the interrupt and the user setting voltage for the LVD module.

Parameters
[in]pstcConfigLVD module configuration
Return values
OkInitializiation of LVD interupt successfully done.
ErrorInvalidParameterpstcConfig == NULL or invalid stc_lvd_config::enIrqVoltage setting.

Definition at line 147 of file lvd.c.

References stc_lvd_config::enIrqVoltage, ErrorInvalidParameter, LvdCtlUnlock, LvdIrqVoltage220, LvdIrqVoltage240, LvdIrqVoltage245, LvdIrqVoltage260, LvdIrqVoltage270, LvdIrqVoltage280, LvdIrqVoltage290, LvdIrqVoltage300, LvdIrqVoltage320, LvdIrqVoltage350, LvdIrqVoltage360, LvdIrqVoltage370, LvdIrqVoltage380, LvdIrqVoltage390, LvdIrqVoltage400, LvdIrqVoltage410, LvdIrqVoltage420, LvdIrqVoltage430, LvdIrqVoltage452, LvdSVHI_220, LvdSVHI_240, LvdSVHI_245, LvdSVHI_260, LvdSVHI_270, LvdSVHI_280, LvdSVHI_290, LvdSVHI_300, LvdSVHI_320, LvdSVHI_350, LvdSVHI_360, LvdSVHI_370, LvdSVHI_380, LvdSVHI_390, LvdSVHI_400, LvdSVHI_410, LvdSVHI_420, LvdSVHI_430, LvdSVHI_452, Ok, PDL_IRQ_LEVEL_LVD, stc_lvd_intern_data::pfnCallback, stc_lvd_config::pfnCallback, and TRUE.

void LvdIrqHandler ( void  )

ISR of the LVD module.

Definition at line 118 of file lvd.c.

References stc_lvd_intern_data::pfnCallback.

Variable Documentation

stc_lvd_intern_data_t stcLvdInternData = {NULL}
static

Definition at line 72 of file lvd.c.