![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
Data Structures | |
struct | stc_qprc_int_sel |
Enumeration to define QPRC interrupt selection. More... | |
struct | stc_qprc_int_cb |
Enumeration to define QPRC interrupt callback function. More... | |
struct | stc_qprc_filter |
Structure to configuration QPRC filter. More... | |
struct | stc_qprc_config |
Structure to configuration QPRC. More... | |
struct | stc_qprc_intern_data |
Structure of QPRC internal data. More... | |
struct | stc_qprc_instance_data |
Structure of QPRC instance data. More... | |
Defines | |
#define | stc_qprcn_t FM0P_QPRC_TypeDef |
#define | stc_qprc_nfn_t FM0P_QPRC_NF_TypeDef |
#define | QPRC0 (*((volatile stc_qprcn_t *) FM0P_QPRC0_BASE)) |
#define | QPRC1 (*((volatile stc_qprcn_t *) FM0P_QPRC1_BASE)) |
#define | QPRC2 (*((volatile stc_qprcn_t *) FM0P_QPRC2_BASE)) |
#define | QPRC3 (*((volatile stc_qprcn_t *) FM0P_QPRC3_BASE)) |
#define | QPRCNF0 (*((volatile stc_qprc_nfn_t *) FM0P_QPRC0_NF_BASE)) |
#define | QPRCNF1 (*((volatile stc_qprc_nfn_t *) FM0P_QPRC1_NF_BASE)) |
#define | QPRCNF2 (*((volatile stc_qprc_nfn_t *) FM0P_QPRC2_NF_BASE)) |
#define | QPRCNF3 (*((volatile stc_qprc_nfn_t *) FM0P_QPRC3_NF_BASE)) |
#define | QPRC_INSTANCE_COUNT |
#define | QPRC_PC_OVERFLOW_INT 0 |
#define | QPRC_PC_UNDERFLOW_INT 1 |
#define | QPRC_PC_ZERO_INDEX_INT 2 |
Typedefs | |
typedef enum en_qprc_instance_index | en_qprc_instance_index_t |
Enumeration to define an index for each QPRC instance. | |
typedef enum en_qprc_pcmode | en_qprc_pcmode_t |
Enumeration to define position counter mode. | |
typedef enum en_qprc_rcmode | en_qprc_rcmode_t |
Enumeration to define revolution counter mode. | |
typedef enum en_qprc_zinedge | en_qprc_zinedge_t |
Enumeration to define ZIN valid edge. | |
typedef enum en_qprc_binedge | en_qprc_binedge_t |
Enumeration to define BIN valid edge. | |
typedef enum en_qprc_ainedge | en_qprc_ainedge_t |
Enumeration to define AIN valid edge. | |
typedef enum en_qprc_pcresetmask | en_qprc_pcresetmask_t |
Enumeration to define reset mask times of position counter. | |
typedef enum en_qprc_compmode | en_qprc_compmode_t |
Enumeration to define compare object of QPRCR register. | |
typedef enum en_qprc_int | en_qprc_int_t |
Enumeration to define QPRC interrupt type. | |
typedef struct stc_qprc_int_sel | stc_qprc_int_sel_t |
Enumeration to define QPRC interrupt selection. | |
typedef struct stc_qprc_int_cb | stc_qprc_int_cb_t |
Enumeration to define QPRC interrupt callback function. | |
typedef enum en_qprc_filter_width | en_qprc_filter_width_t |
Enumeration to define QPRC filter width. | |
typedef struct stc_qprc_filter | stc_qprc_filter_t |
Structure to configuration QPRC filter. | |
typedef struct stc_qprc_config | stc_qprc_config_t |
Structure to configuration QPRC. | |
typedef struct stc_qprc_intern_data | stc_qprc_intern_data_t |
Structure of QPRC internal data. | |
typedef struct stc_qprc_instance_data | stc_qprc_instance_data_t |
Structure of QPRC instance data. | |
Enumerations | |
enum | en_qprc_instance_index { QprcInstanceIndexQprc0 = 0, QprcInstanceIndexQprc1, QprcInstanceIndexQprc2 } |
Enumeration to define an index for each QPRC instance. More... | |
enum | en_qprc_pcmode { QprcPcMode0 = 0, QprcPcMode1 = 1, QprcPcMode2 = 2, QprcPcMode3 = 3 } |
Enumeration to define position counter mode. More... | |
enum | en_qprc_rcmode { QprcRcMode0 = 0, QprcRcMode1 = 1, QprcRcMode2 = 2, QprcRcMode3 = 3 } |
Enumeration to define revolution counter mode. More... | |
enum | en_qprc_zinedge { QprcZinDisable = 0, QprcZinFallingEdge = 1, QprcZinRisingEdge = 2, QprcZinBothEdges = 3, QprcZinLowLevel = 4, QprcZinHighLevel = 5 } |
Enumeration to define ZIN valid edge. More... | |
enum | en_qprc_binedge { QprcBinDisable = 0, QprcBinFallingEdge = 1, QprcBinRisingEdge = 2, QprcBinBothEdges = 3 } |
Enumeration to define BIN valid edge. More... | |
enum | en_qprc_ainedge { QprcAinDisable = 0, QprcAinFallingEdge = 1, QprcAinRisingEdge = 2, QprcAinBothEdges = 3 } |
Enumeration to define AIN valid edge. More... | |
enum | en_qprc_pcresetmask { QprcResetMaskDisable = 0, QprcResetMask2Times = 1, QprcResetMask4Times = 2, QprcResetMask8Times = 3 } |
Enumeration to define reset mask times of position counter. More... | |
enum | en_qprc_compmode { QprcComapreWithPosition = 0, QprcComapreWithRevolution = 1 } |
Enumeration to define compare object of QPRCR register. More... | |
enum | en_qprc_int { QprcPcOfUfZeroInt = 0, QprcPcMatchInt, QprcPcRcMatchInt, QprcPcMatchRcMatchInt, QprcPcCountInvertInt, QprcRcOutrangeInt } |
Enumeration to define QPRC interrupt type. More... | |
enum | en_qprc_filter_width { QprcNoFilter = 0, QprcFilterWidth4Pclk, QprcFilterWidth8Pclk, QprcFilterWidth16Pclk, QprcFilterWidth32Pclk, QprcFilterWidth64Pclk, QprcFilterWidth128Pclk, QprcFilterWidth256Pclk } |
Enumeration to define QPRC filter width. More... | |
Functions | |
static en_result_t | QprcIsValidQprcnPtr (volatile FM0P_QPRC_TypeDef *pstcQprc) |
A certain QPRC instance is valid? | |
static volatile FM0P_QPRC_NF_TypeDef * | QprcGetNoisFilterPtr (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get the noise filter for a certain QPRC instance. | |
static stc_qprc_intern_data_t * | QprcGetInternDataPtr (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get the internal data for a certain QPRC instance. | |
static void | Qprc_InitNvic (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Set NVIC Interrupt depending on QPRC instance. | |
static void | Qprc_DeInitNvic (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Clear NVIC Interrupt depending on QPRC instance. | |
void | Qprc_IrqHandler (volatile FM0P_QPRC_TypeDef *pstcQprc, stc_qprc_intern_data_t *pstcQprcInternData) |
QPRC instance interrupt service routine. | |
en_result_t | Qprc_Init (volatile FM0P_QPRC_TypeDef *pstcQprc, stc_qprc_config_t *pstcConfig) |
Initialize QPRC. | |
en_result_t | Qprc_StopPcCount (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Stop Position Counter. | |
en_result_t | Qprc_RestartPcCount (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Restart Position Counter from stop status. | |
en_result_t | Qprc_SetPcCount (volatile FM0P_QPRC_TypeDef *pstcQprc, uint16_t u16PcValue) |
Set count value of Position counter. | |
uint16_t | Qprc_GetPcCount (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get count value of Position counter. | |
en_result_t | Qprc_SetRcCount (volatile FM0P_QPRC_TypeDef *pstcQprc, uint16_t u16RcValue) |
Set count value of Revolution Counter. | |
uint16_t | Qprc_GetRcCount (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get count value of Revolution Counter. | |
en_result_t | Qprc_SetPcMaxValue (volatile FM0P_QPRC_TypeDef *pstcQprc, uint16_t u16PcMaxValue) |
Set maximum count value of Position Counter. | |
uint16_t | Qprc_GetPcMaxValue (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get maximum count value of Position Counter. | |
en_result_t | Qprc_SetPcCompareValue (volatile FM0P_QPRC_TypeDef *pstcQprc, uint16_t u16PcValue) |
Set compare value of Position counter. | |
uint16_t | Qprc_GetPcCompareValue (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get compare value of Position counter. | |
en_result_t | Qprc_SetPcRcCompareValue (volatile FM0P_QPRC_TypeDef *pstcQprc, uint16_t u16PcRcValue) |
Set compare value of Position and Revolution Counter. | |
uint16_t | Qprc_GetPcRcCompareValue (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get compare value of Position and Revolution Counter. | |
en_result_t | Qprc_ConfigPcMode (volatile FM0P_QPRC_TypeDef *pstcQprc, en_qprc_pcmode_t enMode) |
Set Position Counter mode. | |
en_result_t | Qprc_ConfigRcMode (volatile FM0P_QPRC_TypeDef *pstcQprc, en_qprc_rcmode_t enMode) |
Set Revolution Counter mode. | |
en_result_t | Qprc_EnableInt (volatile FM0P_QPRC_TypeDef *pstcQprc, stc_qprc_int_sel_t *pstcIntSel, stc_qprc_int_cb_t *pstcIntCallback) |
Enable QPRC interrupts. | |
en_result_t | Qprc_DisableInt (volatile FM0P_QPRC_TypeDef *pstcQprc, stc_qprc_int_sel_t *pstcIntSel) |
Disable PC match interrupt. | |
en_int_flag_t | Qprc_GetIntFlag (volatile FM0P_QPRC_TypeDef *pstcQprc, en_qprc_int_t enIntType) |
Get interrupt flag of QPRC. | |
en_result_t | Qprc_ClrIntFlag (volatile FM0P_QPRC_TypeDef *pstcQprc, en_qprc_int_t enIntType) |
Clear interrupt flag of QPRC. | |
en_stat_flag_t | Qprc_GetPcOfUfDir (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get last position counter flow direction. | |
en_stat_flag_t | Qprc_GetPcDir (volatile FM0P_QPRC_TypeDef *pstcQprc) |
Get last position counter direction. | |
Variables | |
stc_qprc_instance_data_t | m_astcQprcInstanceDataLut [(PDL_PERIPHERAL_ENABLE_QPRC0==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_QPRC1==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_QPRC2==PDL_ON?1:0)] |
Look-up table for all enabled ADC instances and their internal data. | |
stc_qprc_instance_data_t | m_astcQprcInstanceDataLut [(PDL_PERIPHERAL_ENABLE_QPRC0==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_QPRC1==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_QPRC2==PDL_ON?1:0)] |
Look-up table for all enabled MFS instances and their internal data. |
Provided functions of QPRC module:
How to use Position Count (PC) and Revolution Counter (RC)?
Qprc_Init() must be used for configuration of a QPRC channel with a structure of the type stc_qprc_config_t.
A QPRC interrupt can be enabled by the function Qprc_EnableInt(). This function can set callback function for each channel too.
With Qprc_SetPcCompareValue() the PC compare value is set to the value given in the parameter Qprc_SetPcCompareValue::u16PcValue. And PC compare value is read by Qprc_GetPcCompareValue().
With Qprc_SetPcRcCompareValue() the PC and RC compare value is set to the value given in the parameter Qprc_SetPcRcCompareValue::u16PcRcValue. And PC and RC compare value is read by Qprc_GetPcRcCompareValue(). Whether PC and RC compare value compares to PC count and RC count depends on the setting in paramter of the Qprc_Init().
The initial PC count value can be set by Qprc_SetPcCount(). And current PC count can be read by Qprc_GetPcCount()
The initial RC count value can be set by Qprc_SetRcCount(). And current RC count can be read by Qprc_GetRcCount()
The maximum PC count value can be set by Qprc_SetPcMaxValue(). And the maximum PC count value can be read by Qprc_GetPcMaxValue(). If PC count exceeds this value, a PC overflow interrupt flag will be set.
After above setting, Qprc_ConfigPcMode() can start PC with following mode:
Qprc_ConfigRcMode() can start RC with following mode:
With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and run into user interrupt callback function.
With polling mode, user can use Qprc_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Qprc_ClrIntFlag().
Qprc_GetPcOfUfDir() can get the PC direction after a PC overflow or underflow occurs.
Qprc_GetPcDir() can get the current PC direction when PC is counting.
Qprc_StopPcCount() can stop PC when PC is counting. And Qprc_RestartPcCount() will restart PC when PC is in stop status.
When stopping the QPRC, disable PC by using Qprc_ConfigPcMode() to set PC to PC mode0 and disable RC by using Qprc_ConfigRcMode() to set RC to RC mode0. Use QPRC_DisableInt() to disable QPRC interrupt.
#define QPRC0 (*((volatile stc_qprcn_t *) FM0P_QPRC0_BASE)) |
Definition at line 155 of file qprc.h.
Referenced by DT_QPRC_Handler(), Qprc_DeInitNvic(), and Qprc_InitNvic().
#define QPRC1 (*((volatile stc_qprcn_t *) FM0P_QPRC1_BASE)) |
Definition at line 156 of file qprc.h.
Referenced by DT_QPRC_Handler(), Qprc_DeInitNvic(), and Qprc_InitNvic().
#define QPRC2 (*((volatile stc_qprcn_t *) FM0P_QPRC2_BASE)) |
Definition at line 157 of file qprc.h.
Referenced by DT_QPRC_Handler(), Qprc_DeInitNvic(), and Qprc_InitNvic().
#define QPRC3 (*((volatile stc_qprcn_t *) FM0P_QPRC3_BASE)) |
#define QPRC_INSTANCE_COUNT |
(PDL_PERIPHERAL_ENABLE_QPRC0 == PDL_ON ? 1 : 0) + \ (PDL_PERIPHERAL_ENABLE_QPRC1 == PDL_ON ? 1 : 0) + \ (PDL_PERIPHERAL_ENABLE_QPRC2 == PDL_ON ? 1 : 0)
Definition at line 165 of file qprc.h.
Referenced by QprcGetInternDataPtr(), QprcGetNoisFilterPtr(), and QprcIsValidQprcnPtr().
#define QPRC_PC_OVERFLOW_INT 0 |
Definition at line 169 of file qprc.h.
Referenced by Qprc_IrqHandler().
#define QPRC_PC_UNDERFLOW_INT 1 |
Definition at line 170 of file qprc.h.
Referenced by Qprc_IrqHandler().
#define QPRC_PC_ZERO_INDEX_INT 2 |
Definition at line 171 of file qprc.h.
Referenced by Qprc_IrqHandler().
#define QPRCNF0 (*((volatile stc_qprc_nfn_t *) FM0P_QPRC0_NF_BASE)) |
#define QPRCNF1 (*((volatile stc_qprc_nfn_t *) FM0P_QPRC1_NF_BASE)) |
#define QPRCNF2 (*((volatile stc_qprc_nfn_t *) FM0P_QPRC2_NF_BASE)) |
#define QPRCNF3 (*((volatile stc_qprc_nfn_t *) FM0P_QPRC3_NF_BASE)) |
#define stc_qprc_nfn_t FM0P_QPRC_NF_TypeDef |
Definition at line 153 of file qprc.h.
Referenced by Qprc_Init(), and QprcGetNoisFilterPtr().
#define stc_qprcn_t FM0P_QPRC_TypeDef |
Definition at line 152 of file qprc.h.
Referenced by DT_QPRC_Handler(), Qprc_DeInitNvic(), and Qprc_InitNvic().
typedef enum en_qprc_ainedge en_qprc_ainedge_t |
Enumeration to define AIN valid edge.
typedef enum en_qprc_binedge en_qprc_binedge_t |
Enumeration to define BIN valid edge.
typedef enum en_qprc_compmode en_qprc_compmode_t |
Enumeration to define compare object of QPRCR register.
typedef enum en_qprc_filter_width en_qprc_filter_width_t |
Enumeration to define QPRC filter width.
typedef enum en_qprc_instance_index en_qprc_instance_index_t |
Enumeration to define an index for each QPRC instance.
typedef enum en_qprc_int en_qprc_int_t |
Enumeration to define QPRC interrupt type.
typedef enum en_qprc_pcmode en_qprc_pcmode_t |
Enumeration to define position counter mode.
typedef enum en_qprc_pcresetmask en_qprc_pcresetmask_t |
Enumeration to define reset mask times of position counter.
typedef enum en_qprc_rcmode en_qprc_rcmode_t |
Enumeration to define revolution counter mode.
typedef enum en_qprc_zinedge en_qprc_zinedge_t |
Enumeration to define ZIN valid edge.
typedef struct stc_qprc_config stc_qprc_config_t |
Structure to configuration QPRC.
typedef struct stc_qprc_filter stc_qprc_filter_t |
Structure to configuration QPRC filter.
typedef struct stc_qprc_instance_data stc_qprc_instance_data_t |
Structure of QPRC instance data.
typedef struct stc_qprc_int_cb stc_qprc_int_cb_t |
Enumeration to define QPRC interrupt callback function.
typedef struct stc_qprc_int_sel stc_qprc_int_sel_t |
Enumeration to define QPRC interrupt selection.
typedef struct stc_qprc_intern_data stc_qprc_intern_data_t |
Structure of QPRC internal data.
enum en_qprc_ainedge |
enum en_qprc_binedge |
enum en_qprc_compmode |
Enumeration to define compare object of QPRCR register.
enum en_qprc_filter_width |
Enumeration to define QPRC filter width.
enum en_qprc_int |
Enumeration to define QPRC interrupt type.
enum en_qprc_pcmode |
Enumeration to define position counter mode.
enum en_qprc_pcresetmask |
Enumeration to define reset mask times of position counter.
enum en_qprc_rcmode |
Enumeration to define revolution counter mode.
enum en_qprc_zinedge |
Enumeration to define ZIN valid edge.
en_result_t Qprc_ClrIntFlag | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
en_qprc_int_t | enIntType | ||
) |
Clear interrupt flag of QPRC.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | enIntType | Interrupt type |
Ok | Clear interrupt flag successfully |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 1202 of file qprc.c.
References ErrorInvalidParameter, Ok, PdlClr, QprcPcCountInvertInt, QprcPcMatchInt, QprcPcMatchRcMatchInt, QprcPcOfUfZeroInt, QprcPcRcMatchInt, and QprcRcOutrangeInt.
en_result_t Qprc_ConfigPcMode | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
en_qprc_pcmode_t | enMode | ||
) |
Set Position Counter mode.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | enMode | Position Counter mode |
Ok | Position Counter mode has been setup |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 876 of file qprc.c.
References ErrorInvalidParameter, Ok, QprcPcMode0, QprcPcMode1, QprcPcMode2, and QprcPcMode3.
en_result_t Qprc_ConfigRcMode | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
en_qprc_rcmode_t | enMode | ||
) |
Set Revolution Counter mode.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | enMode | Revolution Counter mode |
Ok | Revolution Counter mode has been setup |
ErrorInvalidParameter | If one of following confitions are met:
|
< RC_Mode0: Disable revolution counter
Definition at line 931 of file qprc.c.
References ErrorInvalidParameter, Ok, QprcRcMode0, QprcRcMode1, QprcRcMode2, and QprcRcMode3.
static void Qprc_DeInitNvic | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) | [static] |
Clear NVIC Interrupt depending on QPRC instance.
[in] | pstcQprc | Pointer to QPRC instance |
Definition at line 227 of file qprc.c.
References PDL_DEFAULT_INTERRUPT_LEVEL, QPRC0, QPRC1, QPRC2, and stc_qprcn_t.
Referenced by Qprc_DisableInt().
en_result_t Qprc_DisableInt | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
stc_qprc_int_sel_t * | pstcIntSel | ||
) |
Disable PC match interrupt.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | pstcIntSel | Interrupt selection structure pointer |
Ok | PC match interrupt enable bit has been setup |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 1060 of file qprc.c.
References stc_qprc_int_sel::bQprcPcCountInvertInt, stc_qprc_int_sel::bQprcPcMatchInt, stc_qprc_int_sel::bQprcPcMatchRcMatchInt, stc_qprc_int_sel::bQprcPcOfUfZeroInt, stc_qprc_int_sel::bQprcPcRcMatchInt, stc_qprc_int_sel::bQprcRcOutrangeInt, ErrorInvalidParameter, Ok, stc_qprc_intern_data::pfnPcCountInvertCallback, stc_qprc_intern_data::pfnPcMatchCallback, stc_qprc_intern_data::pfnPcMatchRcMatchCallback, stc_qprc_intern_data::pfnPcRcMatchCallback, stc_qprc_intern_data::pfnPcUfOfZeroCallback, stc_qprc_intern_data::pfnRcOutrangeCallback, Qprc_DeInitNvic(), QprcGetInternDataPtr(), and TRUE.
en_result_t Qprc_EnableInt | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
stc_qprc_int_sel_t * | pstcIntSel, | ||
stc_qprc_int_cb_t * | pstcIntCallback | ||
) |
Enable QPRC interrupts.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | pstcIntSel | Interrupt selection structure pointer |
[in] | pstcIntCallback | Interrupt Callback function pointer |
Ok | QPRC interrupts has been enabled |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 990 of file qprc.c.
References stc_qprc_int_sel::bQprcPcCountInvertInt, stc_qprc_int_sel::bQprcPcMatchInt, stc_qprc_int_sel::bQprcPcMatchRcMatchInt, stc_qprc_int_sel::bQprcPcOfUfZeroInt, stc_qprc_int_sel::bQprcPcRcMatchInt, stc_qprc_int_sel::bQprcRcOutrangeInt, ErrorInvalidParameter, Ok, stc_qprc_intern_data::pfnPcCountInvertCallback, stc_qprc_int_cb::pfnPcCountInvertIntCallback, stc_qprc_intern_data::pfnPcMatchCallback, stc_qprc_int_cb::pfnPcMatchIntCallback, stc_qprc_intern_data::pfnPcMatchRcMatchCallback, stc_qprc_int_cb::pfnPcMatchRcMatchIntCallback, stc_qprc_int_cb::pfnPcOfUfZeroIntCallback, stc_qprc_intern_data::pfnPcRcMatchCallback, stc_qprc_int_cb::pfnPcRcMatchIntCallback, stc_qprc_intern_data::pfnPcUfOfZeroCallback, stc_qprc_intern_data::pfnRcOutrangeCallback, stc_qprc_int_cb::pfnRcOutrangeIntCallback, Qprc_InitNvic(), QprcGetInternDataPtr(), and TRUE.
en_int_flag_t Qprc_GetIntFlag | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
en_qprc_int_t | enIntType | ||
) |
Get interrupt flag of QPRC.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | enIntType | Interrupt type |
PdlClr | Interrupt doesn't occur selected by enIntType |
PdlSet | Interrupt occurs selected by enIntType |
Definition at line 1128 of file qprc.c.
References PdlClr, PdlSet, QprcPcCountInvertInt, QprcPcMatchInt, QprcPcMatchRcMatchInt, QprcPcOfUfZeroInt, QprcPcRcMatchInt, and QprcRcOutrangeInt.
uint16_t Qprc_GetPcCompareValue | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
Get compare value of Position counter.
[in] | pstcQprc | Pointer to QPRC instance |
Count | value |
Definition at line 804 of file qprc.c.
References ErrorInvalidParameter.
uint16_t Qprc_GetPcCount | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
en_stat_flag_t Qprc_GetPcDir | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
uint16_t Qprc_GetPcMaxValue | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
en_stat_flag_t Qprc_GetPcOfUfDir | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
uint16_t Qprc_GetPcRcCompareValue | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
uint16_t Qprc_GetRcCount | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
en_result_t Qprc_Init | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
stc_qprc_config_t * | pstcConfig | ||
) |
Initialize QPRC.
This function initializes an QPRC module and sets up the internal data structures
[in] | pstcQprc | Pointer to QPRC instance |
[in] | pstcConfig | Pointer to QPRC module configuration |
Ok | Internal data has been setup |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 410 of file qprc.c.
References stc_qprc_config::b8KValue, stc_qprc_filter::bInputInvert, stc_qprc_filter::bInputMask, stc_qprc_config::bSwapAinBin, stc_qprc_config::enAinEdge, stc_qprc_config::enBinEdge, stc_qprc_config::enComapreMode, stc_qprc_config::enPcResetMask, stc_qprc_filter::enWidth, stc_qprc_config::enZinEdge, ErrorInvalidParameter, FALSE, Ok, QprcAinBothEdges, QprcBinBothEdges, QprcBinDisable, QprcBinFallingEdge, QprcBinRisingEdge, QprcComapreWithRevolution, QprcFilterWidth256Pclk, QprcGetNoisFilterPtr(), QprcIsValidQprcnPtr(), QprcResetMask2Times, QprcResetMask4Times, QprcResetMask8Times, QprcResetMaskDisable, QprcZinBothEdges, QprcZinDisable, QprcZinFallingEdge, QprcZinHighLevel, QprcZinLowLevel, QprcZinRisingEdge, stc_qprc_nfn_t, stc_qprc_config::stcAinFilter, stc_qprc_config::stcBinFilter, stc_qprc_config::stcCinFilter, and TRUE.
static void Qprc_InitNvic | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) | [static] |
Set NVIC Interrupt depending on QPRC instance.
pstcQprc | Pointer to QPRC instance |
Definition at line 208 of file qprc.c.
References PDL_IRQ_LEVEL_DT_QPRC, QPRC0, QPRC1, QPRC2, and stc_qprcn_t.
Referenced by Qprc_EnableInt().
void Qprc_IrqHandler | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
stc_qprc_intern_data_t * | pstcQprcInternData | ||
) |
QPRC instance interrupt service routine.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | pstcQprcInternData | Pointer to internal data |
Definition at line 308 of file qprc.c.
References PdlClr, PdlSet, stc_qprc_intern_data::pfnPcCountInvertCallback, stc_qprc_intern_data::pfnPcMatchCallback, stc_qprc_intern_data::pfnPcMatchRcMatchCallback, stc_qprc_intern_data::pfnPcRcMatchCallback, stc_qprc_intern_data::pfnPcUfOfZeroCallback, stc_qprc_intern_data::pfnRcOutrangeCallback, QPRC_PC_OVERFLOW_INT, QPRC_PC_UNDERFLOW_INT, and QPRC_PC_ZERO_INDEX_INT.
Referenced by DT_QPRC_Handler().
en_result_t Qprc_RestartPcCount | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
Restart Position Counter from stop status.
[in] | pstcQprc | Pointer to QPRC instance |
Ok | Restart Position Counter successfully |
ErrorInvalidParameter | pstcQprc == NULL |
Definition at line 632 of file qprc.c.
References ErrorInvalidParameter, and Ok.
en_result_t Qprc_SetPcCompareValue | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
uint16_t | u16PcValue | ||
) |
Set compare value of Position counter.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | u16PcValue | Compare value |
Ok | Compare value has been setup |
ErrorInvalidParameter | pstcQprc == NULL |
Definition at line 782 of file qprc.c.
References ErrorInvalidParameter, and Ok.
en_result_t Qprc_SetPcCount | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
uint16_t | u16PcValue | ||
) |
Set count value of Position counter.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | u16PcValue | Count value |
Ok | Count value has been setup |
ErrorInvalidParameter | pstcQprc == NULL |
Definition at line 654 of file qprc.c.
References ErrorInvalidParameter, and Ok.
en_result_t Qprc_SetPcMaxValue | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
uint16_t | u16PcMaxValue | ||
) |
Set maximum count value of Position Counter.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | u16PcMaxValue | Maximum count value |
Ok | Maximum count value has been setup |
ErrorInvalidParameter | pstcQprc == NULL |
Definition at line 739 of file qprc.c.
References ErrorInvalidParameter, and Ok.
en_result_t Qprc_SetPcRcCompareValue | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
uint16_t | u16PcRcValue | ||
) |
Set compare value of Position and Revolution Counter.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | u16PcRcValue | Compare value |
Ok | Compare value has been setup |
ErrorInvalidParameter | pstcQprc == NULL |
Definition at line 829 of file qprc.c.
References ErrorInvalidParameter, and Ok.
en_result_t Qprc_SetRcCount | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc, |
uint16_t | u16RcValue | ||
) |
Set count value of Revolution Counter.
[in] | pstcQprc | Pointer to QPRC instance |
[in] | u16RcValue | Count value |
Ok | Count value has been setup |
ErrorInvalidParameter | pstcQprc == NULL |
Definition at line 696 of file qprc.c.
References ErrorInvalidParameter, and Ok.
en_result_t Qprc_StopPcCount | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) |
Stop Position Counter.
[in] | pstcQprc | Pointer to QPRC instance |
Ok | Stop Position Counter counting successfully |
ErrorInvalidParameter | pstcQprc == NULL |
Definition at line 611 of file qprc.c.
References ErrorInvalidParameter, and Ok.
static stc_qprc_intern_data_t * QprcGetInternDataPtr | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) | [static] |
Get the internal data for a certain QPRC instance.
[in] | pstcQprc | Pointer to QPRC instance |
Definition at line 186 of file qprc.c.
References QPRC_INSTANCE_COUNT, and stc_qprc_instance_data::stcInternData.
Referenced by Qprc_DisableInt(), and Qprc_EnableInt().
static volatile FM0P_QPRC_NF_TypeDef * QprcGetNoisFilterPtr | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) | [static] |
Get the noise filter for a certain QPRC instance.
[in] | pstcQprc | Pointer to QPRC instance |
Definition at line 158 of file qprc.c.
References stc_qprc_instance_data::pstcInstanceNf, QPRC_INSTANCE_COUNT, and stc_qprc_nfn_t.
Referenced by Qprc_Init().
static en_result_t QprcIsValidQprcnPtr | ( | volatile FM0P_QPRC_TypeDef * | pstcQprc | ) | [static] |
A certain QPRC instance is valid?
[in] | pstcQprc | Pointer to QPRC instance |
Ok | QPRC instance is valid |
ErrorInvalidParameter | If instance is not enabled (or not known) |
Definition at line 129 of file qprc.c.
References ErrorInvalidParameter, Ok, and QPRC_INSTANCE_COUNT.
Referenced by Qprc_Init().
stc_qprc_instance_data_t m_astcQprcInstanceDataLut[(PDL_PERIPHERAL_ENABLE_QPRC0==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_QPRC1==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_QPRC2==PDL_ON?1:0)] |
{ { & (*((volatile FM0P_QPRC_TypeDef *) FM0P_QPRC0_BASE)) , & (*((volatile FM0P_QPRC_NF_TypeDef *) FM0P_QPRC0_NF_BASE)) , {NULL,NULL,NULL,NULL,NULL,NULL} }, { & (*((volatile FM0P_QPRC_TypeDef *) FM0P_QPRC1_BASE)) , & (*((volatile FM0P_QPRC_NF_TypeDef *) FM0P_QPRC1_NF_BASE)) , {NULL,NULL,NULL,NULL,NULL,NULL} }, { & (*((volatile FM0P_QPRC_TypeDef *) FM0P_QPRC2_BASE)) , & (*((volatile FM0P_QPRC_NF_TypeDef *) FM0P_QPRC2_NF_BASE)) , {NULL,NULL,NULL,NULL,NULL,NULL} }, }
Look-up table for all enabled ADC instances and their internal data.
Look-up table for all enabled MFS instances and their internal data.
Definition at line 93 of file qprc.c.
Referenced by DT_QPRC_Handler().
stc_qprc_instance_data_t m_astcQprcInstanceDataLut[(PDL_PERIPHERAL_ENABLE_QPRC0==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_QPRC1==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_QPRC2==PDL_ON?1:0)] |
Look-up table for all enabled MFS instances and their internal data.
Definition at line 93 of file qprc.c.
Referenced by DT_QPRC_Handler().