Synergy Software Package User's Manual

Driver for Low Voltage Detection. More...

Data Structures

struct  lvd_instance_ctrl_t
 
struct  lvd_extend_t
 

Enumerations

enum  lvd_sample_clock_t {
  LVD_SAMPLE_CLOCK_LOCO_DIV_2 = 0, LVD_SAMPLE_CLOCK_LOCO_DIV_4 = 1, LVD_SAMPLE_CLOCK_LOCO_DIV_8 = 2, LVD_SAMPLE_CLOCK_LOCO_DIV_16 = 3,
  LVD_SAMPLE_CLOCK_DISABLED = -1
}
 
enum  lvd_negation_delay_t { LVD_NEGATION_DELAY_FROM_VOLTAGE = 0, LVD_NEGATION_DELAY_FROM_RESET = 1 }
 

Functions

ssp_err_t R_LVD_Open (lvd_ctrl_t *const p_api_ctrl, lvd_cfg_t const *const p_cfg)
 Initializes a low voltage detection driver according to the passed in configuration structure. Enables an LVD peripheral based on configuration structure. More...
 
ssp_err_t R_LVD_Close (lvd_ctrl_t *const p_api_ctrl)
 Disables the LVD peripheral. Closes the driver instance. More...
 
ssp_err_t R_LVD_StatusGet (lvd_ctrl_t *const p_api_ctrl, lvd_status_t *p_lvd_status)
 Get the current state of the monitor, (threshold crossing detected, voltage currently within range) More...
 
ssp_err_t R_LVD_StatusClear (lvd_ctrl_t *const p_api_ctrl)
 Clears the latched status of the monitor. More...
 
ssp_err_t R_LVD_VersionGet (ssp_version_t *const p_version)
 Returns the LVD driver version based on compile time macros. More...
 

Detailed Description

Driver for Low Voltage Detection.

Implementation of the LVD API.For a detailed description see the Low Voltage Detection Interface.

Summary

This module implements the following interface: Low Voltage Detection Interface.

Enumeration Type Documentation

◆ lvd_negation_delay_t

Negation of LVD signal follows reset or voltage in range

Enumerator
LVD_NEGATION_DELAY_FROM_VOLTAGE 

Negation follows a stabilization time (tLVDn) after VCC > Vdet1 is detected. If a transition to software standby or deep software standby is to be made, the only possible value for the RN bit is LVD_NEGATION_DELAY_FROM_VOLTAGE

LVD_NEGATION_DELAY_FROM_RESET 

Negation follows a stabilization time (tLVDn) after assertion of the LVDn reset. If a transition to software standby or deep software standby is to be made, the only possible value for the RN bit is LVD_NEGATION_DELAY_FROM_VOLTAGE

◆ lvd_sample_clock_t

Sample clock divider, use LVD_SAMPLE_CLOCK_DISABLED to disable digital filtering

Enumerator
LVD_SAMPLE_CLOCK_LOCO_DIV_2 

Digital filter sample clock is LOCO divided by 2.

LVD_SAMPLE_CLOCK_LOCO_DIV_4 

Digital filter sample clock is LOCO divided by 4.

LVD_SAMPLE_CLOCK_LOCO_DIV_8 

Digital filter sample clock is LOCO divided by 8.

LVD_SAMPLE_CLOCK_LOCO_DIV_16 

Digital filter sample clock is LOCO divided by 16.

LVD_SAMPLE_CLOCK_DISABLED 

Digital filter is disabled.

Function Documentation

◆ R_LVD_Close()

ssp_err_t R_LVD_Close ( lvd_ctrl_t *const  p_api_ctrl)

Disables the LVD peripheral. Closes the driver instance.

Implements
Return values
SSP_SUCCESSSuccessful
SSP_ERR_ASSERTIONPointers passed as function argument is NULL or the monitor number is invalid.
SSP_ERR_NOT_OPENDriver is not open.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

Disable voltage monitor comparison result output

Disable reset/interrupt event

Clear low voltage detection flag LVDnSR.DET = 0

Disable digital filtering

Disable voltage monitor

◆ R_LVD_Open()

ssp_err_t R_LVD_Open ( lvd_ctrl_t *const  p_api_ctrl,
lvd_cfg_t const *const  p_cfg 
)

Initializes a low voltage detection driver according to the passed in configuration structure. Enables an LVD peripheral based on configuration structure.

Implements
Note
Digital filter is not to be used with standby modes
Return values
SSP_SUCCESSSuccessful
SSP_ERR_ASSERTIONOne or more pointers passed as function argument point to NULL or the Requested configuration, detection, voltage, monitor number or sample clock configuration of a voltage monitor is invalid.
SSP_ERR_IN_USEUnable to acquire the hardware lock.
SSP_ERR_INVALID_MODEMOCO must be running for LVD_NEGATION_DELAY_FROM_RESET negation delay option
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

Verify channel is not already used

Select the detection voltage by setting the LVDLVLR.LVDnLVL[m:0] bits.

Enable voltage detection LVCMPCR.LVDnE = 1

Configure the digital filter.

Configure LVD monitor detection response.

Enable output of the results of comparison by voltage monitor LVDnCR0.CMPE = 1

Mark driver as opened by initializing it to "LVD" in its ASCII equivalent.

◆ R_LVD_StatusClear()

ssp_err_t R_LVD_StatusClear ( lvd_ctrl_t *const  p_api_ctrl)

Clears the latched status of the monitor.

Implements
Return values
SSP_SUCCESSSuccessful
SSP_ERR_ASSERTIONPointers passed as function argument point to NULL, invalid LVD monitor number
SSP_ERR_NOT_OPENDriver is not open, status will not be valid

Clears the latched status of the monitor

◆ R_LVD_StatusGet()

ssp_err_t R_LVD_StatusGet ( lvd_ctrl_t *const  p_api_ctrl,
lvd_status_t p_lvd_status 
)

Get the current state of the monitor, (threshold crossing detected, voltage currently within range)

Implements
Return values
SSP_SUCCESSSuccessful
SSP_ERR_ASSERTIONOne or more pointers passed as function argument point to NULL, invalid LVD monitor number
SSP_ERR_NOT_OPENDriver is not open, status will not be valid

Get the current state of the monitor

◆ R_LVD_VersionGet()

ssp_err_t R_LVD_VersionGet ( ssp_version_t *const  p_version)

Returns the LVD driver version based on compile time macros.

Implements
Return values
SSP_SUCCESSSuccessful
SSP_ERR_ASSERTIONp_version was NULL