12#include "fsl_common.h"
21#define FSL_ENC_DRIVER_VERSION (MAKE_VERSION(2, 1, 0))
32#if !(defined(FSL_FEATURE_ENC_HAS_NO_CTRL2_SAB_INT) && FSL_FEATURE_ENC_HAS_NO_CTRL2_SAB_INT)
51#if !(defined(FSL_FEATURE_ENC_HAS_NO_CTRL2_SAB_INT) && FSL_FEATURE_ENC_HAS_NO_CTRL2_SAB_INT)
144#if (defined(FSL_FEATURE_ENC_HAS_CTRL3) && FSL_FEATURE_ENC_HAS_CTRL3)
151typedef enum _enc_prescaler
160 kENC_ClockDiv128 = 7,
161 kENC_ClockDiv256 = 8,
162 kENC_ClockDiv512 = 9,
163 kENC_ClockDiv1024 = 10,
164 kENC_ClockDiv2048 = 11,
165 kENC_ClockDiv4096 = 12,
166 kENC_ClockDiv8192 = 13,
167 kENC_ClockDiv16384 = 14,
168 kENC_ClockDiv32768 = 15,
216#if (defined(FSL_FEATURE_ENC_HAS_CTRL3) && FSL_FEATURE_ENC_HAS_CTRL3)
218 bool enablePeriodMeasurementFunction;
219 enc_prescaler_t prescalerValue;
237#if defined(__cplusplus)
370static inline uint16_t ENC_GetSignalStatusFlags(
ENC_Type *base)
442static inline uint16_t ENC_GetPositionDifferenceValue(
ENC_Type *base)
458static inline uint16_t ENC_GetHoldPositionDifferenceValue(
ENC_Type *base)
470static inline uint16_t ENC_GetRevolutionValue(
ENC_Type *base)
486static inline uint16_t ENC_GetHoldRevolutionValue(
ENC_Type *base)
491#if (defined(FSL_FEATURE_ENC_HAS_LASTEDGE) && FSL_FEATURE_ENC_HAS_LASTEDGE)
499static inline uint16_t ENC_GetLastEdgeTimeValue(
ENC_Type *base)
501 return base->LASTEDGE;
511static inline uint16_t ENC_GetHoldLastEdgeTimeValue(
ENC_Type *base)
513 return base->LASTEDGEH;
517#if (defined(FSL_FEATURE_ENC_HAS_POSDPER) && FSL_FEATURE_ENC_HAS_POSDPER)
525static inline uint16_t ENC_GetPositionDifferencePeriodValue(
ENC_Type *base)
527 return base->POSDPER;
537static inline uint16_t ENC_GetPositionDifferencePeriodBufferValue(
ENC_Type *base)
539 return base->POSDPERBFR;
549static inline uint16_t ENC_GetHoldPositionDifferencePeriodValue(
ENC_Type *base)
551 return base->POSDPERH;
556#if defined(__cplusplus)
_enc_interrupt_enable
Interrupt enable/disable mask.
Definition: fsl_enc.h:27
void ENC_EnableWatchdog(ENC_Type *base, bool enable)
Enable watchdog for ENC module.
Definition: fsl_enc.c:306
bool enableWatchdog
Definition: fsl_enc.h:189
enc_position_match_mode_t positionMatchMode
Definition: fsl_enc.h:206
_enc_status_flags
Status flag mask.
Definition: fsl_enc.h:46
uint32_t ENC_GetPositionValue(ENC_Type *base)
Get the current position counter's value.
Definition: fsl_enc.c:594
uint16_t signalPeriod
Definition: fsl_enc.h:233
enc_index_trigger_mode_t INDEXTriggerMode
Definition: fsl_enc.h:183
uint16_t filterSamplePeriod
Definition: fsl_enc.h:200
_enc_index_trigger_mode
Define INDEX signal's trigger mode.
Definition: fsl_enc.h:94
enum _enc_position_match_mode enc_position_match_mode_t
Define type for the condition of POSMATCH pulses.
enum _enc_self_test_direction enc_self_test_direction_t
Define type for direction of self test generated signal.
uint32_t ENC_GetEnabledInterrupts(ENC_Type *base)
Get the enabled interrupts' flags.
Definition: fsl_enc.c:536
void ENC_Init(ENC_Type *base, const enc_config_t *config)
Initialization for the ENC module.
Definition: fsl_enc.c:80
void ENC_ClearStatusFlags(ENC_Type *base, uint32_t mask)
Clear the status flags.
Definition: fsl_enc.c:375
enum _enc_revolution_count_condition enc_revolution_count_condition_t
Define type for determining how the revolution counter (REV) is incremented/decremented.
void ENC_EnableInterrupts(ENC_Type *base, uint32_t mask)
Enable the interrupts.
Definition: fsl_enc.c:429
_enc_home_trigger_mode
Define HOME signal's trigger mode.
Definition: fsl_enc.h:82
void ENC_SetInitialPositionValue(ENC_Type *base, uint32_t value)
Set initial position value for ENC module.
Definition: fsl_enc.c:581
enum _enc_decoder_work_mode enc_decoder_work_mode_t
Define type for decoder work mode.
enc_home_trigger_mode_t HOMETriggerMode
Definition: fsl_enc.h:182
uint16_t filterCount
Definition: fsl_enc.h:195
_enc_self_test_direction
Define type for direction of self test generated signal.
Definition: fsl_enc.h:139
enc_revolution_count_condition_t revolutionCountCondition
Definition: fsl_enc.h:210
bool enableTRIGGERClearPositionCounter
Definition: fsl_enc.h:184
void ENC_GetDefaultConfig(enc_config_t *config)
Get an available pre-defined settings for ENC's configuration.
Definition: fsl_enc.c:224
void ENC_DoSoftwareLoadInitialPositionValue(ENC_Type *base)
Load the initial position value to position counter.
Definition: fsl_enc.c:261
bool enableTRIGGERClearHoldPositionCounter
Definition: fsl_enc.h:185
uint16_t signalCount
Definition: fsl_enc.h:232
uint16_t watchdogTimeoutValue
Definition: fsl_enc.h:190
bool enableModuloCountMode
Definition: fsl_enc.h:211
struct _enc_self_test_config enc_self_test_config_t
Define configuration structure for self test module.
enum _enc_home_trigger_mode enc_home_trigger_mode_t
Define HOME signal's trigger mode.
uint32_t positionCompareValue
Definition: fsl_enc.h:207
_enc_decoder_work_mode
Define type for decoder work mode.
Definition: fsl_enc.h:109
void ENC_SetSelfTestConfig(ENC_Type *base, const enc_self_test_config_t *config)
Enable and configure the self test function.
Definition: fsl_enc.c:279
uint32_t ENC_GetHoldPositionValue(ENC_Type *base)
Get the hold position counter's value.
Definition: fsl_enc.c:616
_enc_signal_status_flags
Signal status flag mask.
Definition: fsl_enc.h:65
enc_decoder_work_mode_t decoderWorkMode
Definition: fsl_enc.h:179
uint32_t ENC_GetStatusFlags(ENC_Type *base)
Get the status flags.
Definition: fsl_enc.c:324
struct _enc_config enc_config_t
Define user configuration structure for ENC module.
uint32_t positionModulusValue
Definition: fsl_enc.h:212
bool enableReverseDirection
Definition: fsl_enc.h:178
uint32_t positionInitialValue
Definition: fsl_enc.h:214
enum _enc_index_trigger_mode enc_index_trigger_mode_t
Define INDEX signal's trigger mode.
_enc_position_match_mode
Define type for the condition of POSMATCH pulses.
Definition: fsl_enc.h:119
_enc_revolution_count_condition
Define type for determining how the revolution counter (REV) is incremented/decremented.
Definition: fsl_enc.h:129
void ENC_Deinit(ENC_Type *base)
De-initialization for the ENC module.
Definition: fsl_enc.c:190
enc_self_test_direction_t signalDirection
Definition: fsl_enc.h:231
void ENC_DisableInterrupts(ENC_Type *base, uint32_t mask)
Disable the interrupts.
Definition: fsl_enc.c:482
@ kENC_PositionCompareInerruptEnable
Definition: fsl_enc.h:31
@ kENC_INDEXPulseInterruptEnable
Definition: fsl_enc.h:29
@ kENC_SimultBothPhaseChangeInterruptEnable
Definition: fsl_enc.h:33
@ kENC_HOMETransitionInterruptEnable
Definition: fsl_enc.h:28
@ kENC_PositionRollOverInterruptEnable
Definition: fsl_enc.h:36
@ kENC_PositionRollUnderInterruptEnable
Definition: fsl_enc.h:37
@ kENC_WatchdogTimeoutInterruptEnable
Definition: fsl_enc.h:30
@ kENC_INDEXPulseFlag
Definition: fsl_enc.h:48
@ kENC_SimultBothPhaseChangeFlag
Definition: fsl_enc.h:52
@ kENC_PositionRollOverFlag
Definition: fsl_enc.h:54
@ kENC_PositionRollUnderFlag
Definition: fsl_enc.h:55
@ kENC_WatchdogTimeoutFlag
Definition: fsl_enc.h:49
@ kENC_PositionCompareFlag
Definition: fsl_enc.h:50
@ kENC_HOMETransitionFlag
Definition: fsl_enc.h:47
@ kENC_LastCountDirectionFlag
Definition: fsl_enc.h:56
@ kENC_INDEXTriggerOnFallingEdge
Definition: fsl_enc.h:97
@ kENC_INDEXTriggerOnRisingEdge
Definition: fsl_enc.h:96
@ kENC_INDEXTriggerDisabled
Definition: fsl_enc.h:95
@ kENC_HOMETriggerDisabled
Definition: fsl_enc.h:83
@ kENC_HOMETriggerOnRisingEdge
Definition: fsl_enc.h:84
@ kENC_HOMETriggerOnFallingEdge
Definition: fsl_enc.h:85
@ kENC_SelfTestDirectionNegative
Definition: fsl_enc.h:141
@ kENC_SelfTestDirectionPositive
Definition: fsl_enc.h:140
@ kENC_DecoderWorkAsSignalPhaseCountMode
Definition: fsl_enc.h:111
@ kENC_DecoderWorkAsNormalMode
Definition: fsl_enc.h:110
@ kENC_RawPHBStatusFlag
Definition: fsl_enc.h:68
@ kENC_FilteredPHBStatusFlag
Definition: fsl_enc.h:72
@ kENC_RawINDEXStatusFlag
Definition: fsl_enc.h:67
@ kENC_RawHOMEStatusFlag
Definition: fsl_enc.h:66
@ kENC_FilteredPHAStatusFlag
Definition: fsl_enc.h:73
@ kENC_RawPHAEXStatusFlag
Definition: fsl_enc.h:69
@ kENC_FilteredINDEXStatusFlag
Definition: fsl_enc.h:71
@ kENC_FilteredHOMEStatusFlag
Definition: fsl_enc.h:70
@ kENC_POSMATCHOnPositionCounterEqualToComapreValue
Definition: fsl_enc.h:120
@ kENC_POSMATCHOnReadingAnyPositionCounter
Definition: fsl_enc.h:122
@ kENC_RevolutionCountOnRollOverModulus
Definition: fsl_enc.h:131
@ kENC_RevolutionCountOnINDEXPulse
Definition: fsl_enc.h:130
Definition: MIMXRT1052.h:17946
Define user configuration structure for ENC module.
Definition: fsl_enc.h:176
Define configuration structure for self test module.
Definition: fsl_enc.h:230
Definition: deflate.c:114