![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
Functions | |
en_result_t | Mft_Adcmp_Init (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8Ch, stc_mft_adcmp_config_t *pstcConfig) |
Device dependent initialization of Mft adcmp module. | |
en_result_t | Mft_Adcmp_EnableOperation (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8Ch, stc_mft_adcmp_func_t *pstcFunc) |
Enable Mft Adcmp operations. | |
en_result_t | Mft_Adcmp_DisableOperation (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8Ch, stc_mft_adcmp_func_t *pstcFunc) |
Disable Mft Adcmp operations. | |
en_result_t | Mft_Adcmp_WriteAcmp (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8Ch, uint16_t u16AdcmpVal) |
Write compare or offset value to ADCMP. | |
uint16_t | Mft_Adcmp_ReadAcmp (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8Ch) |
Read compare and offset value of ACMP. | |
en_result_t | Mft_Adcmp_Fm3_Init (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8CoupleCh, stc_mft_adcmp_fm3_config_t *pstcConfig) |
Mft Adcmp fm3 compatible initialization. | |
en_result_t | Mft_Adcmp_Fm3_EnableOperation (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8CoupleCh) |
Mft Adcmp fm3 compatible mode configuration and enable operation. | |
en_result_t | Mft_Adcmp_Fm3_DisableOperation (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8CoupleCh) |
De-configurate Mft Adcmp fm3 compatible function and disable operation. | |
en_result_t | Mft_Adcmp_Fm3_WriteAccp (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8CoupleCh, uint16_t u16AccpVal) |
Mft Adcmp fm3 compatible mode, write Accp register. | |
uint16_t | Mft_Adcmp_Fm3_ReadAccp (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8CoupleCh) |
Mft Adcmp fm3 compatible mode, read Accp register stored value. | |
en_result_t | Mft_Adcmp_Fm3_WriteAccpdn (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8CoupleCh, uint16_t u16AccpdnVal) |
Mft Adcmp fm3 compatible mode, write Accpdn register. | |
uint16_t | Mft_Adcmp_Fm3_ReadAccpdn (volatile FM0P_MFT_ADCMP_TypeDef *pstcMftAdcmp, uint8_t u8CoupleCh) |
Mft Adcmp fm3 compatible mode, read Accpdn register stored value. |
Provided functions of ADCMP module:
How to use ADCMP module?
Two modes including normal mode and offset mode can be configured for ADCMP. This module should be used with ADC.
Before using ADCMP, a FRT used to connect with applying ADCMP must be initialed. For how to configure FRT, see the description in the mft_frt.h. In the offset mode, a OCU should also be used and initialed. For how to configure OCU, see the description in the mft_ocu.h
Mft_Adcmp_Init() must be used for configuration of a ADCMP channel with a structure of the type stc_mft_adcmp_config_t.
With Mft_Adcmp_WriteAcmp() the ADC start compare value is set to the value given in the parameter Mft_Adcmp_WriteAcmp::u16AcmpVal. Whether the compare value is modified directly depends on buffer function.
After above setting, calling Mft_Adcmp_EnableOperation() will start ADCMP.
When stopping the OCU, use Mft_Adcmp_DisableOperation() to disable ADCMP.
In addition, the module is also compatible with FM3 usage.
How to use ADCMP module with FM3 compatibility function?
Before using ADCMP, a FRT used to connect with applying ADCMP must be initialed. For how to configure FRT, see the description in the mft_frt.h.
Mft_Adcmp_Fm3_Init() must be used for configuration of a ADCMP channel with a structure of the type stc_mft_adcmp_fm3_config_t.
With Mft_Adcmp_Fm3_WriteAccp() the ADC start up compare value is set to the value given in the parameter Mft_Adcmp_WriteAcmp::u16AccpVal. With Mft_Adcmp_Fm3_ReadAccp() the ADC start up compare value is read.
With Mft_Adcmp_Fm3_WriteAccpdn() the ADC start down compare value is set to the value given in the parameter Mft_Adcmp_WriteAcmp::u16AccpVal. With Mft_Adcmp_Fm3_ReadAccpdn() the ADC start down compare value is read.
Mft_Adcmp_Fm3_EnableOperation() enables ADCMP operation and Mft_Adcmp_Fm3_DisableOperation() disables ADCMP operation.
en_result_t Mft_Adcmp_DisableOperation | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8Ch, | ||
stc_mft_adcmp_func_t * | pstcFunc | ||
) |
Disable Mft Adcmp operations.
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8Ch | Mft Adcmp channel
|
[in] | pstcFunc | Pointer to Mft Adcmp function structure |
Ok | Mft Adcmp operations disabled |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 253 of file mft_adcmp.c.
References stc_mft_adcmp_func::bDownEn, stc_mft_adcmp_func::bPeakEn, stc_mft_adcmp_func::bUpEn, stc_mft_adcmp_func::bZeroEn, ErrorInvalidParameter, MFT_ADCMP_CH_MAX, and Ok.
en_result_t Mft_Adcmp_EnableOperation | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8Ch, | ||
stc_mft_adcmp_func_t * | pstcFunc | ||
) |
Enable Mft Adcmp operations.
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8Ch | Mft Adcmp channel
|
[in] | pstcFunc | Pointer to Mft Adcmp function structure |
Ok | Functions enabled |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 213 of file mft_adcmp.c.
References stc_mft_adcmp_func::bDownEn, stc_mft_adcmp_func::bPeakEn, stc_mft_adcmp_func::bUpEn, stc_mft_adcmp_func::bZeroEn, ErrorInvalidParameter, MFT_ADCMP_CH_MAX, and Ok.
en_result_t Mft_Adcmp_Fm3_DisableOperation | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8CoupleCh | ||
) |
De-configurate Mft Adcmp fm3 compatible function and disable operation.
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8CoupleCh | Mft Adcmp channel
|
Ok | ADCMP FM3 operation disabled |
ErrorInvalidParameter | If one of followings conditions are met:
|
Definition at line 486 of file mft_adcmp.c.
References ErrorInvalidParameter, MFT_ADCMP_CH10, MFT_ADCMP_CH32, MFT_ADCMP_CH54, MFT_ADCMP_CPCH_MAX, and Ok.
en_result_t Mft_Adcmp_Fm3_EnableOperation | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8CoupleCh | ||
) |
Mft Adcmp fm3 compatible mode configuration and enable operation.
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8CoupleCh | Mft Adcmp channel
|
Ok | ADCMP FM3 mode funcitons enabled |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 441 of file mft_adcmp.c.
References ErrorInvalidParameter, MFT_ADCMP_CH10, MFT_ADCMP_CH32, MFT_ADCMP_CH54, MFT_ADCMP_CPCH_MAX, and Ok.
en_result_t Mft_Adcmp_Fm3_Init | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8CoupleCh, | ||
stc_mft_adcmp_fm3_config_t * | pstcConfig | ||
) |
Mft Adcmp fm3 compatible initialization.
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8CoupleCh | Mft Adcmp couple channel
|
[in] | pstcConfig | Mft Adcmp configuration parameter |
Ok | Mft Adcmp fm3 compatible mode initialized |
ErrorInvalidParameter | Invalid setting of pstcConfig elements |
Definition at line 355 of file mft_adcmp.c.
References AdcmpBufFrtZeroPeak, AdcmpTrigAdc2Prio, stc_mft_adcmp_fm3_config::enBuf, stc_mft_adcmp_fm3_config::enFrt, stc_mft_adcmp_fm3_config::enMode, stc_mft_adcmp_fm3_config::enTrigSel, ErrorInvalidParameter, MFT_ADCMP_CH10, MFT_ADCMP_CH32, MFT_ADCMP_CH54, and Ok.
uint16_t Mft_Adcmp_Fm3_ReadAccp | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8CoupleCh | ||
) |
Mft Adcmp fm3 compatible mode, read Accp register stored value.
[in] | pstcMftAdcmp | Pointer to Mft instance
|
[in] | u8CoupleCh | Mft Adcmp channel
|
Definition at line 558 of file mft_adcmp.c.
References ErrorInvalidParameter, and MFT_ADCMP_CPCH_MAX.
uint16_t Mft_Adcmp_Fm3_ReadAccpdn | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8CoupleCh | ||
) |
Mft Adcmp fm3 compatible mode, read Accpdn register stored value.
[in] | pstcMftAdcmp | Pointer to Mft instance
|
[in] | u8CoupleCh | Mft Adcmp channel
|
Definition at line 620 of file mft_adcmp.c.
References ErrorInvalidParameter, and MFT_ADCMP_CPCH_MAX.
en_result_t Mft_Adcmp_Fm3_WriteAccp | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8CoupleCh, | ||
uint16_t | u16AccpVal | ||
) |
Mft Adcmp fm3 compatible mode, write Accp register.
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8CoupleCh | Mft Adcmp channel
|
[in] | u16AccpVal | Mft Adcmp configuration parameter |
Ok | Accp is written |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 530 of file mft_adcmp.c.
References ErrorInvalidParameter, MFT_ADCMP_CPCH_MAX, and Ok.
en_result_t Mft_Adcmp_Fm3_WriteAccpdn | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8CoupleCh, | ||
uint16_t | u16AccpdnVal | ||
) |
Mft Adcmp fm3 compatible mode, write Accpdn register.
[in] | pstcMftAdcmp | Pointer to Mft instance
|
[in] | u8CoupleCh | Mft Adcmp channel
|
[in] | u16AccpdnVal | data value of Accpdn |
Ok | Accpdn is written |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 591 of file mft_adcmp.c.
References ErrorInvalidParameter, MFT_ADCMP_CPCH_MAX, and Ok.
en_result_t Mft_Adcmp_Init | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8Ch, | ||
stc_mft_adcmp_config_t * | pstcConfig | ||
) |
Device dependent initialization of Mft adcmp module.
Global function prototypes (definition in C source)
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8Ch | Mft adcmp channel
|
[in] | pstcConfig | Pointer to Mft adcmp config
|
Ok | Adcmp initialized |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 104 of file mft_adcmp.c.
References AdcmpBufFrtZeroPeak, AdcmpOffsetMode, AdcmpSelOccp1, AdcmpTrigAdc2Prio, stc_mft_adcmp_config::enBuf, stc_mft_adcmp_config::enFrt, stc_mft_adcmp_config::enMode, stc_mft_adcmp_config::enOccpSel, stc_mft_adcmp_config::enTrigSel, ErrorInvalidParameter, MFT_ADCMP_CH_MAX, and Ok.
uint16_t Mft_Adcmp_ReadAcmp | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8Ch | ||
) |
Read compare and offset value of ACMP.
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8Ch | Mft Adcmp channel
|
Definition at line 324 of file mft_adcmp.c.
References ErrorInvalidParameter, and MFT_ADCMP_CH_MAX.
en_result_t Mft_Adcmp_WriteAcmp | ( | volatile FM0P_MFT_ADCMP_TypeDef * | pstcMftAdcmp, |
uint8_t | u8Ch, | ||
uint16_t | u16AdcmpVal | ||
) |
Write compare or offset value to ADCMP.
[in] | pstcMftAdcmp | Pointer to Mft instance |
[in] | u8Ch | Mft Adcmp channel
|
[in] | u16AdcmpVal | ADCMP compare value |
Ok | Compare or offset value to ADCMP is set |
ErrorInvalidParameter | If one of following condiitons are met:
|
Definition at line 293 of file mft_adcmp.c.
References ErrorInvalidParameter, MFT_ADCMP_CH_MAX, and Ok.