Driverlib ECAP API

Module: Driverlib (AM13E230X) APIs

Structures

Name

struct

DL_ECAP_ApwmModeConfig
ECAP APWM mode configuration structure.

struct

DL_ECAP_CaptureModeConfig
ECAP capture mode configuration structure.

struct

DL_ECAP_SyncConfig
ECAP sync configuration structure.

struct

DL_ECAP_InterruptsConfig
ECAP interrupt configuration structure.

struct

DL_ECAP_Config
ECAP configuration structure.

Types

Name

enum

DL_ECAP_EMULATION_MODE { DL_ECAP_EMULATION_STOP = 0x0U, DL_ECAP_EMULATION_RUN_TO_ZERO = 0x1U, DL_ECAP_EMULATION_FREE_RUN = 0x2U}
ECAP emulation modes.

enum

DL_ECAP_CAPTURE_MODE { DL_ECAP_CONTINUOUS_CAPTURE_MODE = 0U, DL_ECAP_ONE_SHOT_CAPTURE_MODE = 1U}
ECAP capture modes.

enum

DL_ECAP_EVENT { DL_ECAP_EVENT_1 = 0U, DL_ECAP_EVENT_2 = 1U, DL_ECAP_EVENT_3 = 2U, DL_ECAP_EVENT_4 = 3U}
ECAP event numbers.

enum

DL_ECAP_SYNC_OUT_MODE { DL_ECAP_SYNC_OUT_SYNCI = 0U, DL_ECAP_SYNC_OUT_COUNTER_PRD = 1U, DL_ECAP_SYNC_OUT_DISABLED = 2U}
ECAP sync out mode.

enum

DL_ECAP_APWM_POLARITY { DL_ECAP_APWM_ACTIVE_HIGH = 0U, DL_ECAP_APWM_ACTIVE_LOW = 1U}
ECAP APWM polarity.

enum

DL_ECAP_EVENT_POLARITY { DL_ECAP_EVENT_RISING_EDGE = 0U, DL_ECAP_EVENT_FALLING_EDGE = 1U}
ECAP event polarity.

enum

DL_ECAP_INPUT { DL_ECAP_INPUT_INPUTXBAR1 = 0U, DL_ECAP_INPUT_INPUTXBAR2 = 1U, DL_ECAP_INPUT_INPUTXBAR3 = 2U, DL_ECAP_INPUT_INPUTXBAR4 = 3U, DL_ECAP_INPUT_INPUTXBAR5 = 4U, DL_ECAP_INPUT_INPUTXBAR6 = 5U, DL_ECAP_INPUT_INPUTXBAR7 = 6U, DL_ECAP_INPUT_INPUTXBAR8 = 7U, DL_ECAP_INPUT_INPUTXBAR9 = 8U, DL_ECAP_INPUT_INPUTXBAR10 = 9U, DL_ECAP_INPUT_INPUTXBAR11 = 10U, DL_ECAP_INPUT_INPUTXBAR12 = 11U, DL_ECAP_INPUT_INPUTXBAR13 = 12U, DL_ECAP_INPUT_INPUTXBAR14 = 13U, DL_ECAP_INPUT_INPUTXBAR15 = 14U, DL_ECAP_INPUT_INPUTXBAR16 = 15U, DL_ECAP_INPUT_MCAN_INT0 = 16U, DL_ECAP_INPUT_OUTPUTXBAR1 = 17U, DL_ECAP_INPUT_OUTPUTXBAR2 = 18U, DL_ECAP_INPUT_OUTPUTXBAR3 = 19U, DL_ECAP_INPUT_OUTPUTXBAR4 = 20U, DL_ECAP_INPUT_OUTPUTXBAR5 = 21U, DL_ECAP_INPUT_OUTPUTXBAR6 = 22U, DL_ECAP_INPUT_OUTPUTXBAR7 = 23U, DL_ECAP_INPUT_OUTPUTXBAR8 = 24U, DL_ECAP_INPUT_ADC0_EVT1 = 29U, DL_ECAP_INPUT_ADC0_EVT2 = 30U, DL_ECAP_INPUT_ADC0_EVT3 = 31U, DL_ECAP_INPUT_ADC0_EVT4 = 32U, DL_ECAP_INPUT_ADC1_EVT1 = 33U, DL_ECAP_INPUT_ADC1_EVT2 = 34U, DL_ECAP_INPUT_ADC1_EVT3 = 35U, DL_ECAP_INPUT_ADC1_EVT4 = 36U, DL_ECAP_INPUT_ADC2_EVT1 = 37U, DL_ECAP_INPUT_ADC2_EVT2 = 38U, DL_ECAP_INPUT_ADC2_EVT3 = 39U, DL_ECAP_INPUT_ADC2_EVT4 = 40U, DL_ECAP_INPUT_CMPSS0_CTRIPL = 41U, DL_ECAP_INPUT_CMPSS1_CTRIPL = 42U, DL_ECAP_INPUT_CMPSS2_CTRIPL = 43U, DL_ECAP_INPUT_CMPSS3_CTRIPL = 44U, DL_ECAP_INPUT_CMPSS0_CTRIPH = 45U, DL_ECAP_INPUT_CMPSS1_CTRIPH = 46U, DL_ECAP_INPUT_CMPSS2_CTRIPH = 47U, DL_ECAP_INPUT_CMPSS3_CTRIPH = 48U, DL_ECAP_INPUT_CMPSS0_CTRIPH_OR_CTRIPL = 49U, DL_ECAP_INPUT_CMPSS1_CTRIPH_OR_CTRIPL = 50U, DL_ECAP_INPUT_CMPSS2_CTRIPH_OR_CTRIPL = 51U, DL_ECAP_INPUT_CMPSS3_CTRIPH_OR_CTRIPL = 52U, DL_ECAP_INPUT_INPUTXBARX = 53U}
ECAP input capture signal sources.

enum

DL_ECAP_SYNC_IN_PULSE_SRC { DL_ECAP_SYNC_IN_PULSE_SRC_DISABLE = 0U, DL_ECAP_SYNC_IN_PULSE_SRC_INPUTXBAR5 = 1U, DL_ECAP_SYNC_IN_PULSE_SRC_INPUTXBAR6 = 2U, DL_ECAP_SYNC_IN_PULSE_SRC_ECAP0_SYNCOUT = 3U, DL_ECAP_SYNC_IN_PULSE_SRC_ECAP1_SYNCOUT = 4U, DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM0_SYNCOUT = 5U, DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM1_SYNCOUT = 6U, DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM2_SYNCOUT = 7U, DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM3_SYNCOUT = 8U, DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM4_SYNCOUT = 9U}
ECAP sync-in pulse sources.

enum

DL_ECAP_OPERATING_MODE { DL_ECAP_OPERATING_MODE_CAPTURE = 0x0U, DL_ECAP_OPERATING_MODE_APWM = 0x1U}
ECAP operating modes.

Functions

Name

__STATIC_INLINE void

DL_ECAP_setEventPrescaler(ECAP_Regs * ecap, uint16_t prescalerValue)
Sets the input prescaler.

__STATIC_INLINE void

DL_ECAP_setEventPolarity(ECAP_Regs * ecap, DL_ECAP_EVENT event, DL_ECAP_EVENT_POLARITY polarity)
Sets the Capture Event polarity.

__STATIC_INLINE void

DL_ECAP_setCaptureMode(ECAP_Regs * ecap, DL_ECAP_CAPTURE_MODE mode, DL_ECAP_EVENT event)
Sets the capture mode.

__STATIC_INLINE void

DL_ECAP_reArm(ECAP_Regs * ecap)
Re-arms the eCAP module.

__STATIC_INLINE void

DL_ECAP_enableInterrupt(ECAP_Regs * ecap, uint16_t intFlags)
Enables interrupt source.

__STATIC_INLINE void

DL_ECAP_disableInterrupt(ECAP_Regs * ecap, uint16_t intFlags)
Disables interrupt source.

__STATIC_INLINE uint16_t

DL_ECAP_getInterruptSource(ECAP_Regs * ecap)
Returns the interrupt flag.

__STATIC_INLINE bool

DL_ECAP_getGlobalInterruptStatus(ECAP_Regs * ecap)
Returns the global interrupt flag status.

__STATIC_INLINE void

DL_ECAP_clearInterrupt(ECAP_Regs * ecap, uint16_t intFlags)
Clears interrupt flags.

__STATIC_INLINE void

DL_ECAP_clearGlobalInterrupt(ECAP_Regs * ecap)
Clears global interrupt flag.

__STATIC_INLINE void

DL_ECAP_forceInterrupt(ECAP_Regs * ecap, uint16_t intFlags)
Forces interrupt flags.

__STATIC_INLINE void

DL_ECAP_enableCaptureMode(ECAP_Regs * ecap)
Enables capture mode.

__STATIC_INLINE void

DL_ECAP_enableAPWMMode(ECAP_Regs * ecap)
Enables APWM mode.

__STATIC_INLINE void

DL_ECAP_enableCounterResetOnEvent(ECAP_Regs * ecap, DL_ECAP_EVENT event)
Enables counter reset on an event.

__STATIC_INLINE void

DL_ECAP_disableCounterResetOnEvent(ECAP_Regs * ecap, DL_ECAP_EVENT event)
Disables counter reset on an event.

__STATIC_INLINE void

DL_ECAP_enableTimeStampCapture(ECAP_Regs * ecap)
Enables time stamp count capture.

__STATIC_INLINE void

DL_ECAP_disableTimeStampCapture(ECAP_Regs * ecap)
Disables time stamp count capture.

__STATIC_INLINE void

DL_ECAP_setPhaseShiftCount(ECAP_Regs * ecap, uint32_t shiftCount)
Sets the counter phase shift value.

__STATIC_INLINE void

DL_ECAP_setSyncInPulseSource(ECAP_Regs * ecap, DL_ECAP_SYNC_IN_PULSE_SRC source)
Sets the source for sync-in pulse.

__STATIC_INLINE void

DL_ECAP_enableLoadCounter(ECAP_Regs * ecap)
Enables counter loading with phase shift value.

__STATIC_INLINE void

DL_ECAP_disableLoadCounter(ECAP_Regs * ecap)
Disables counter loading with phase shift value.

__STATIC_INLINE void

DL_ECAP_loadCounter(ECAP_Regs * ecap)
Loads timestamp counter.

__STATIC_INLINE void

DL_ECAP_setSyncOutMode(ECAP_Regs * ecap, DL_ECAP_SYNC_OUT_MODE mode)
Configures Sync out signal mode.

__STATIC_INLINE void

DL_ECAP_stopCounter(ECAP_Regs * ecap)
Stops the timestamp counter.

__STATIC_INLINE void

DL_ECAP_startCounter(ECAP_Regs * ecap)
Starts the timestamp counter.

__STATIC_INLINE void

DL_ECAP_setAPWMPolarity(ECAP_Regs * ecap, DL_ECAP_APWM_POLARITY polarity)
Sets eCAP APWM polarity.

__STATIC_INLINE void

DL_ECAP_setAPWMPeriod(ECAP_Regs * ecap, uint32_t periodCount)
Sets eCAP APWM period.

__STATIC_INLINE void

DL_ECAP_setAPWMCompare(ECAP_Regs * ecap, uint32_t compareCount)
Sets eCAP APWM on or off time count.

__STATIC_INLINE void

DL_ECAP_setAPWMShadowPeriod(ECAP_Regs * ecap, uint32_t periodCount)
Sets eCAP APWM shadow period.

__STATIC_INLINE void

DL_ECAP_setAPWMShadowCompare(ECAP_Regs * ecap, uint32_t compareCount)
Sets eCAP APWM shadow on or off time count.

__STATIC_INLINE uint32_t

DL_ECAP_getTimeStampCounter(ECAP_Regs * ecap)
Returns the time-stamp counter value.

__STATIC_INLINE uint32_t

DL_ECAP_getEventTimeStamp(ECAP_Regs * ecap, DL_ECAP_EVENT event)
Returns event time stamp.

__STATIC_INLINE void

DL_ECAP_selectECAPInput(ECAP_Regs * ecap, DL_ECAP_INPUT input)
Select eCAP input.

__STATIC_INLINE void

DL_ECAP_resetCounters(ECAP_Regs * ecap)
Resets eCAP counters and flags.

__STATIC_INLINE void

DL_ECAP_setDMASource(ECAP_Regs * ecap, DL_ECAP_EVENT event)
Sets the eCAP DMA source event.

__STATIC_INLINE DL_ECAP_EVENT

DL_ECAP_getModuloCounterStatus(ECAP_Regs * ecap)
Returns the modulo counter status.

__STATIC_INLINE void

DL_ECAP_setEmulationMode(ECAP_Regs * ecap, DL_ECAP_EMULATION_MODE mode)
Configures the emulation mode.

void

DL_ECAP_initParamsSetDefault(DL_ECAP_Config * config)
Initializes the ECAP configuration parameters.

void

DL_ECAP_init(ECAP_Regs * ecap, DL_ECAP_Config * config)
Initializes the ECAP module.

Defines

Name

DL_ECAP_MAX_PRESCALER_VALUE
eCAP minimum and maximum values

DL_ECAP_ISR_SOURCE_CEVT1
Capture Event 1 ISR source.

DL_ECAP_ISR_SOURCE_CEVT2
Capture Event 2 ISR source.

DL_ECAP_ISR_SOURCE_CEVT3
Capture Event 3 ISR source.

DL_ECAP_ISR_SOURCE_CEVT4
Capture Event 4 ISR source.

DL_ECAP_ISR_SOURCE_CTROVF
Counter Overflow ISR source.

DL_ECAP_ISR_SOURCE_CTR_PRD
Counter Equal Period ISR source.

DL_ECAP_ISR_SOURCE_CTR_CMP
Counter Equal Compare ISR source.

DL_ECAP_INPUT_COUNT
Number of valid DL_ECAP_INPUT enum values.

Types Documentation

enum DL_ECAP_EMULATION_MODE

Enumerator

Value

Description

DL_ECAP_EMULATION_STOP

0x0U

TSCTR is stopped on emulation suspension

DL_ECAP_EMULATION_RUN_TO_ZERO

0x1U

TSCTR runs until 0 before stopping on emulation suspension

DL_ECAP_EMULATION_FREE_RUN

0x2U

TSCTR is not affected by emulation suspension

ECAP emulation modes.

enum DL_ECAP_CAPTURE_MODE

Enumerator

Value

Description

DL_ECAP_CONTINUOUS_CAPTURE_MODE

0U

eCAP operates in continuous capture mode

DL_ECAP_ONE_SHOT_CAPTURE_MODE

1U

eCAP operates in one shot capture mode

ECAP capture modes.

enum DL_ECAP_EVENT

Enumerator

Value

Description

DL_ECAP_EVENT_1

0U

eCAP event 1

DL_ECAP_EVENT_2

1U

eCAP event 2

DL_ECAP_EVENT_3

2U

eCAP event 3

DL_ECAP_EVENT_4

3U

eCAP event 4

ECAP event numbers.

enum DL_ECAP_SYNC_OUT_MODE

Enumerator

Value

Description

DL_ECAP_SYNC_OUT_SYNCI

0U

Sync out on the sync in signal and software force

DL_ECAP_SYNC_OUT_COUNTER_PRD

1U

Sync out on counter equals period

DL_ECAP_SYNC_OUT_DISABLED

2U

Disable sync out signal

ECAP sync out mode.

enum DL_ECAP_APWM_POLARITY

Enumerator

Value

Description

DL_ECAP_APWM_ACTIVE_HIGH

0U

APWM is active high

DL_ECAP_APWM_ACTIVE_LOW

1U

APWM is active low

ECAP APWM polarity.

enum DL_ECAP_EVENT_POLARITY

Enumerator

Value

Description

DL_ECAP_EVENT_RISING_EDGE

0U

Rising edge polarity

DL_ECAP_EVENT_FALLING_EDGE

1U

Falling edge polarity

ECAP event polarity.

enum DL_ECAP_INPUT

Enumerator

Value

Description

DL_ECAP_INPUT_INPUTXBAR1

0U

Input signal from INPUTXBAR1

DL_ECAP_INPUT_INPUTXBAR2

1U

Input signal from INPUTXBAR2

DL_ECAP_INPUT_INPUTXBAR3

2U

Input signal from INPUTXBAR3

DL_ECAP_INPUT_INPUTXBAR4

3U

Input signal from INPUTXBAR4

DL_ECAP_INPUT_INPUTXBAR5

4U

Input signal from INPUTXBAR5

DL_ECAP_INPUT_INPUTXBAR6

5U

Input signal from INPUTXBAR6

DL_ECAP_INPUT_INPUTXBAR7

6U

Input signal from INPUTXBAR7

DL_ECAP_INPUT_INPUTXBAR8

7U

Input signal from INPUTXBAR8

DL_ECAP_INPUT_INPUTXBAR9

8U

Input signal from INPUTXBAR9

DL_ECAP_INPUT_INPUTXBAR10

9U

Input signal from INPUTXBAR10

DL_ECAP_INPUT_INPUTXBAR11

10U

Input signal from INPUTXBAR11

DL_ECAP_INPUT_INPUTXBAR12

11U

Input signal from INPUTXBAR12

DL_ECAP_INPUT_INPUTXBAR13

12U

Input signal from INPUTXBAR13

DL_ECAP_INPUT_INPUTXBAR14

13U

Input signal from INPUTXBAR14

DL_ECAP_INPUT_INPUTXBAR15

14U

Input signal from INPUTXBAR15

DL_ECAP_INPUT_INPUTXBAR16

15U

Input signal from INPUTXBAR16

DL_ECAP_INPUT_MCAN_INT0

16U

Input signal from MCAN_INT0

DL_ECAP_INPUT_OUTPUTXBAR1

17U

Input signal from OUTPUTXBAR1

DL_ECAP_INPUT_OUTPUTXBAR2

18U

Input signal from OUTPUTXBAR2

DL_ECAP_INPUT_OUTPUTXBAR3

19U

Input signal from OUTPUTXBAR3

DL_ECAP_INPUT_OUTPUTXBAR4

20U

Input signal from OUTPUTXBAR4

DL_ECAP_INPUT_OUTPUTXBAR5

21U

Input signal from OUTPUTXBAR5

DL_ECAP_INPUT_OUTPUTXBAR6

22U

Input signal from OUTPUTXBAR6

DL_ECAP_INPUT_OUTPUTXBAR7

23U

Input signal from OUTPUTXBAR7

DL_ECAP_INPUT_OUTPUTXBAR8

24U

Input signal from OUTPUTXBAR8

DL_ECAP_INPUT_ADC0_EVT1

29U

Input signal from ADC0_EVT1

DL_ECAP_INPUT_ADC0_EVT2

30U

Input signal from ADC0_EVT2

DL_ECAP_INPUT_ADC0_EVT3

31U

Input signal from ADC0_EVT3

DL_ECAP_INPUT_ADC0_EVT4

32U

Input signal from ADC0_EVT4

DL_ECAP_INPUT_ADC1_EVT1

33U

Input signal from ADC1_EVT1

DL_ECAP_INPUT_ADC1_EVT2

34U

Input signal from ADC1_EVT2

DL_ECAP_INPUT_ADC1_EVT3

35U

Input signal from ADC1_EVT3

DL_ECAP_INPUT_ADC1_EVT4

36U

Input signal from ADC1_EVT4

DL_ECAP_INPUT_ADC2_EVT1

37U

Input signal from ADC2_EVT1

DL_ECAP_INPUT_ADC2_EVT2

38U

Input signal from ADC2_EVT2

DL_ECAP_INPUT_ADC2_EVT3

39U

Input signal from ADC2_EVT3

DL_ECAP_INPUT_ADC2_EVT4

40U

Input signal from ADC2_EVT4

DL_ECAP_INPUT_CMPSS0_CTRIPL

41U

Input signal from CMPSS0_CTRIPL

DL_ECAP_INPUT_CMPSS1_CTRIPL

42U

Input signal from CMPSS1_CTRIPL

DL_ECAP_INPUT_CMPSS2_CTRIPL

43U

Input signal from CMPSS2_CTRIPL

DL_ECAP_INPUT_CMPSS3_CTRIPL

44U

Input signal from CMPSS3_CTRIPL

DL_ECAP_INPUT_CMPSS0_CTRIPH

45U

Input signal from CMPSS0_CTRIPH

DL_ECAP_INPUT_CMPSS1_CTRIPH

46U

Input signal from CMPSS1_CTRIPH

DL_ECAP_INPUT_CMPSS2_CTRIPH

47U

Input signal from CMPSS2_CTRIPH

DL_ECAP_INPUT_CMPSS3_CTRIPH

48U

Input signal from CMPSS3_CTRIPH

DL_ECAP_INPUT_CMPSS0_CTRIPH_OR_CTRIPL

49U

Input signal from CMPSS0_CTRIPH_OR_CTRIPL

DL_ECAP_INPUT_CMPSS1_CTRIPH_OR_CTRIPL

50U

Input signal from CMPSS1_CTRIPH_OR_CTRIPL

DL_ECAP_INPUT_CMPSS2_CTRIPH_OR_CTRIPL

51U

Input signal from CMPSS2_CTRIPH_OR_CTRIPL

DL_ECAP_INPUT_CMPSS3_CTRIPH_OR_CTRIPL

52U

Input signal from CMPSS3_CTRIPH_OR_CTRIPL

DL_ECAP_INPUT_INPUTXBARX

53U

Input signal from INPUTXBARX

ECAP input capture signal sources.

enum DL_ECAP_SYNC_IN_PULSE_SRC

Enumerator

Value

Description

DL_ECAP_SYNC_IN_PULSE_SRC_DISABLE

0U

Sync-in source is DISABLE

DL_ECAP_SYNC_IN_PULSE_SRC_INPUTXBAR5

1U

Sync-in source is INPUTXBAR5

DL_ECAP_SYNC_IN_PULSE_SRC_INPUTXBAR6

2U

Sync-in source is INPUTXBAR6

DL_ECAP_SYNC_IN_PULSE_SRC_ECAP0_SYNCOUT

3U

Sync-in source is ECAP0_SYNCOUT

DL_ECAP_SYNC_IN_PULSE_SRC_ECAP1_SYNCOUT

4U

Sync-in source is ECAP1_SYNCOUT

DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM0_SYNCOUT

5U

Sync-in source is MCPWM0_SYNCOUT

DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM1_SYNCOUT

6U

Sync-in source is MCPWM1_SYNCOUT

DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM2_SYNCOUT

7U

Sync-in source is MCPWM2_SYNCOUT

DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM3_SYNCOUT

8U

Sync-in source is MCPWM3_SYNCOUT

DL_ECAP_SYNC_IN_PULSE_SRC_MCPWM4_SYNCOUT

9U

Sync-in source is MCPWM4_SYNCOUT

ECAP sync-in pulse sources.

enum DL_ECAP_OPERATING_MODE

Enumerator

Value

Description

DL_ECAP_OPERATING_MODE_CAPTURE

0x0U

Capture mode

DL_ECAP_OPERATING_MODE_APWM

0x1U

APWM mode

ECAP operating modes.

Functions Documentation

function DL_ECAP_setEventPrescaler

__STATIC_INLINE void DL_ECAP_setEventPrescaler(
    ECAP_Regs * ecap,
    uint16_t prescalerValue
)

Sets the input prescaler.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • prescalerValue is the prescaler value for ECAP input

This API divides the ECAP input scaler. The input capture signal (pulse train) can be prescaled in multiples of 2 or can bypass the prescaler.

Valid range of prescalerValue 0 = Divide by 1 (i.e,. no prescale, by-pass the prescaler) 1 = Divide by 2 2 = Divide by 4 3 = Divide by 6 4 = Divide by 8 5 = Divide by 10 … 0x1E (30) = Divide by 60 0x1F (31) = Divide by 62 Must be less than DL_ECAP_MAX_PRESCALER_VALUE

function DL_ECAP_setEventPolarity

__STATIC_INLINE void DL_ECAP_setEventPolarity(
    ECAP_Regs * ecap,
    DL_ECAP_EVENT event,
    DL_ECAP_EVENT_POLARITY polarity
)

Sets the Capture Event polarity.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • event The event number to be used

  • polarity is polarity of the event

For each event the Capture event polarity value determines the edge on which the capture is activated.

function DL_ECAP_setCaptureMode

__STATIC_INLINE void DL_ECAP_setCaptureMode(
    ECAP_Regs * ecap,
    DL_ECAP_CAPTURE_MODE mode,
    DL_ECAP_EVENT event
)

Sets the capture mode.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • mode is the capture mode

  • event is the event number at which the counter stops or wraps

This API sets the eCAP module to a continuous or one-shot mode. The value of event determines the event number at which the counter stops (in one-shot mode) or the counter wraps (in continuous mode).

function DL_ECAP_reArm

__STATIC_INLINE void DL_ECAP_reArm(
    ECAP_Regs * ecap
)

Re-arms the eCAP module.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

function DL_ECAP_enableInterrupt

__STATIC_INLINE void DL_ECAP_enableInterrupt(
    ECAP_Regs * ecap,
    uint16_t intFlags
)

Enables interrupt source.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • intFlags Bit mask of the interrupt sources to be enabled [DL_ECAP_ISR_SOURCE]

This API sets and enables eCAP interrupt source. The following are valid interrupt sources.

  • DL_ECAP_ISR_SOURCE_CEVT1 - Event 1 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT2 - Event 2 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT3 - Event 3 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT4 - Event 4 generates interrupt

  • DL_ECAP_ISR_SOURCE_CTROVF - Counter overflow generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_PRD - Counter equal period generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_CMP - Counter equal compare generates interrupt

function DL_ECAP_disableInterrupt

__STATIC_INLINE void DL_ECAP_disableInterrupt(
    ECAP_Regs * ecap,
    uint16_t intFlags
)

Disables interrupt source.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • intFlags Bit mask of the interrupt sources to be disabled [DL_ECAP_ISR_SOURCE]

This API disables eCAP interrupt source. The following are valid interrupt sources.

  • DL_ECAP_ISR_SOURCE_CEVT1 - Event 1 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT2 - Event 2 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT3 - Event 3 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT4 - Event 4 generates interrupt

  • DL_ECAP_ISR_SOURCE_CTROVF - Counter overflow generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_PRD - Counter equal period generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_CMP - Counter equal compare generates interrupt

function DL_ECAP_getInterruptSource

__STATIC_INLINE uint16_t DL_ECAP_getInterruptSource(
    ECAP_Regs * ecap
)

Returns the interrupt flag.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

Return: Returns the eCAP interrupt that has occurred. The following are valid return values:

  • DL_ECAP_ISR_SOURCE_CEVT1 - Event 1 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT2 - Event 2 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT3 - Event 3 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT4 - Event 4 generates interrupt

  • DL_ECAP_ISR_SOURCE_CTROVF - Counter overflow generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_PRD - Counter equal period generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_CMP - Counter equal compare generates interrupt

Note: - User can check if a combination of various interrupts have occurred by ORing the above return values.

function DL_ECAP_getGlobalInterruptStatus

__STATIC_INLINE bool DL_ECAP_getGlobalInterruptStatus(
    ECAP_Regs * ecap
)

Returns the global interrupt flag status.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

Return:

  • true if there is a global eCAP interrupt occured

  • false if there is no global eCAP interrupt occured

function DL_ECAP_clearInterrupt

__STATIC_INLINE void DL_ECAP_clearInterrupt(
    ECAP_Regs * ecap,
    uint16_t intFlags
)

Clears interrupt flags.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • intFlags Bit mask of the interrupt sources to be cleared [DL_ECAP_ISR_SOURCE]

This API clears eCAP interrupt flags. The following are valid interrupt sources.

  • DL_ECAP_ISR_SOURCE_CEVT1 - Event 1 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT2 - Event 2 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT3 - Event 3 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT4 - Event 4 generates interrupt

  • DL_ECAP_ISR_SOURCE_CTROVF - Counter overflow generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_PRD - Counter equal period generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_CMP - Counter equal compare generates interrupt

function DL_ECAP_clearGlobalInterrupt

__STATIC_INLINE void DL_ECAP_clearGlobalInterrupt(
    ECAP_Regs * ecap
)

Clears global interrupt flag.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This API clears the global interrupt bit, allowing further interrupts to be generated if any of the event flags are set.

function DL_ECAP_forceInterrupt

__STATIC_INLINE void DL_ECAP_forceInterrupt(
    ECAP_Regs * ecap,
    uint16_t intFlags
)

Forces interrupt flags.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • intFlags Bit mask of the interrupt sources to be forced [DL_ECAP_ISR_SOURCE]

This API forces eCAP interrupt flags. The following are valid interrupt sources.

  • DL_ECAP_ISR_SOURCE_CEVT1 - Event 1 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT2 - Event 2 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT3 - Event 3 generates interrupt

  • DL_ECAP_ISR_SOURCE_CEVT4 - Event 4 generates interrupt

  • DL_ECAP_ISR_SOURCE_CTROVF - Counter overflow generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_PRD - Counter equal period generates interrupt

  • DL_ECAP_ISR_SOURCE_CTR_CMP - Counter equal compare generates interrupt

function DL_ECAP_enableCaptureMode

__STATIC_INLINE void DL_ECAP_enableCaptureMode(
    ECAP_Regs * ecap
)

Enables capture mode.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This API sets the eCAP module to operate in Capture mode.

function DL_ECAP_enableAPWMMode

__STATIC_INLINE void DL_ECAP_enableAPWMMode(
    ECAP_Regs * ecap
)

Enables APWM mode.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This API sets the eCAP module to operate in APWM mode.

function DL_ECAP_enableCounterResetOnEvent

__STATIC_INLINE void DL_ECAP_enableCounterResetOnEvent(
    ECAP_Regs * ecap,
    DL_ECAP_EVENT event
)

Enables counter reset on an event.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • event The event number on which the counter should reset

This API enables the base timer (TSCTR) to be reset when the specified capture event occurs.

function DL_ECAP_disableCounterResetOnEvent

__STATIC_INLINE void DL_ECAP_disableCounterResetOnEvent(
    ECAP_Regs * ecap,
    DL_ECAP_EVENT event
)

Disables counter reset on an event.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • event The event number for which counter reset should be disabled

This API disables the base timer (TSCTR) reset on the specified capture event.

function DL_ECAP_enableTimeStampCapture

__STATIC_INLINE void DL_ECAP_enableTimeStampCapture(
    ECAP_Regs * ecap
)

Enables time stamp count capture.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

function DL_ECAP_disableTimeStampCapture

__STATIC_INLINE void DL_ECAP_disableTimeStampCapture(
    ECAP_Regs * ecap
)

Disables time stamp count capture.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

function DL_ECAP_setPhaseShiftCount

__STATIC_INLINE void DL_ECAP_setPhaseShiftCount(
    ECAP_Regs * ecap,
    uint32_t shiftCount
)

Sets the counter phase shift value.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • shiftCount The phase shift value to be loaded

This function configures the counter phase shift value to be loaded into the main timestamp counter when a sync-in event occurs.

function DL_ECAP_setSyncInPulseSource

__STATIC_INLINE void DL_ECAP_setSyncInPulseSource(
    ECAP_Regs * ecap,
    DL_ECAP_SYNC_IN_PULSE_SRC source
)

Sets the source for sync-in pulse.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • source The source for the sync-in pulse

This API configures the source for the sync-in pulse to the eCAP module.

function DL_ECAP_enableLoadCounter

__STATIC_INLINE void DL_ECAP_enableLoadCounter(
    ECAP_Regs * ecap
)

Enables counter loading with phase shift value.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This API enables loading of the counter with the value present in the phase shift counter as defined by the DL_ECAP_setPhaseShiftCount() API.

function DL_ECAP_disableLoadCounter

__STATIC_INLINE void DL_ECAP_disableLoadCounter(
    ECAP_Regs * ecap
)

Disables counter loading with phase shift value.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This function disables loading of the counter with the phase shift value as defined by the DL_ECAP_setPhaseShiftCount() API.

function DL_ECAP_loadCounter

__STATIC_INLINE void DL_ECAP_loadCounter(
    ECAP_Regs * ecap
)

Loads timestamp counter.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This API forces the value in the phase shift counter register to be loaded into the timestamp counter register. Make sure to enable loading of timestamp counter by calling DL_ECAP_enableLoadCounter() API before calling this API.

function DL_ECAP_setSyncOutMode

__STATIC_INLINE void DL_ECAP_setSyncOutMode(
    ECAP_Regs * ecap,
    DL_ECAP_SYNC_OUT_MODE mode
)

Configures Sync out signal mode.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • mode isthe sync-out mode to set

This function sets the sync-out mode for the eCAP module. Valid values for mode are:

  • DL_ECAP_SYNC_OUT_SYNCI - Trigger sync out on sync-in event and software force.

  • DL_ECAP_SYNC_OUT_COUNTER_PRD - Trigger sync out when counter equals period.

  • DL_ECAP_SYNC_OUT_DISABLED - Disable sync out.

function DL_ECAP_stopCounter

__STATIC_INLINE void DL_ECAP_stopCounter(
    ECAP_Regs * ecap
)

Stops the timestamp counter.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This API stops the ECAP timestamp counter (TSCTR) from running.

function DL_ECAP_startCounter

__STATIC_INLINE void DL_ECAP_startCounter(
    ECAP_Regs * ecap
)

Starts the timestamp counter.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This API starts the ECAP timestamp counter (TSCTR) running.

function DL_ECAP_setAPWMPolarity

__STATIC_INLINE void DL_ECAP_setAPWMPolarity(
    ECAP_Regs * ecap,
    DL_ECAP_APWM_POLARITY polarity
)

Sets eCAP APWM polarity.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • polarity is the polarity to set (active high or active low)

This API sets the polarity of the eCAP in APWM mode.

function DL_ECAP_setAPWMPeriod

__STATIC_INLINE void DL_ECAP_setAPWMPeriod(
    ECAP_Regs * ecap,
    uint32_t periodCount
)

Sets eCAP APWM period.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • periodCount is the period count to set for APWM

This function sets the period count of the APWM waveform. periodCount takes the actual count which is written to the register. The user is responsible for converting the desired frequency or time into the period count.

function DL_ECAP_setAPWMCompare

__STATIC_INLINE void DL_ECAP_setAPWMCompare(
    ECAP_Regs * ecap,
    uint32_t compareCount
)

Sets eCAP APWM on or off time count.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • compareCount is the compare count for APWM

This function sets the on or off time count of the APWM waveform depending on the polarity of the output. If the output , as set by DL_ECAP_setAPWMPolarity(), is active high then compareCount determines the on time. If the output is active low then compareCount determines the off time. compareCount takes the actual count which is written to the register. The user is responsible for converting the desired frequency or time into the appropriate count value.

function DL_ECAP_setAPWMShadowPeriod

__STATIC_INLINE void DL_ECAP_setAPWMShadowPeriod(
    ECAP_Regs * ecap,
    uint32_t periodCount
)

Sets eCAP APWM shadow period.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • periodCount is the shadow period count to set for APWM

This API sets the shadow period count of the APWM waveform. periodCount takes the actual count which is written to the register. The user is responsible for converting the desired frequency or time into the period count.

function DL_ECAP_setAPWMShadowCompare

__STATIC_INLINE void DL_ECAP_setAPWMShadowCompare(
    ECAP_Regs * ecap,
    uint32_t compareCount
)

Sets eCAP APWM shadow on or off time count.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • compareCount is the shadow on or off time count for APWM

This function sets the shadow on or off time count of the APWM waveform depending on the polarity of the output. If the output, as set by DL_ECAP_setAPWMPolarity(), is active high then compareCount determines the on time. If the output is active low then compareCount determines the off time. compareCount takes the actual count which is written to the register. The user is responsible for converting the desired frequency or time into the appropriate count value.

function DL_ECAP_getTimeStampCounter

__STATIC_INLINE uint32_t DL_ECAP_getTimeStampCounter(
    ECAP_Regs * ecap
)

Returns the time-stamp counter value.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

Return: The current timestamp counter value

function DL_ECAP_getEventTimeStamp

__STATIC_INLINE uint32_t DL_ECAP_getEventTimeStamp(
    ECAP_Regs * ecap,
    DL_ECAP_EVENT event
)

Returns event time stamp.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • event is the event number

Return: Event time stamp value

This function returns the current time stamp count of the given event.

function DL_ECAP_selectECAPInput

__STATIC_INLINE void DL_ECAP_selectECAPInput(
    ECAP_Regs * ecap,
    DL_ECAP_INPUT input
)

Select eCAP input.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • input is the eCAP input signal source to select

This function selects the eCAP input signal.

function DL_ECAP_resetCounters

__STATIC_INLINE void DL_ECAP_resetCounters(
    ECAP_Regs * ecap
)

Resets eCAP counters and flags.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

This function resets the main counter (TSCTR), event filter, modulo counter, and interrupt flags.

function DL_ECAP_setDMASource

__STATIC_INLINE void DL_ECAP_setDMASource(
    ECAP_Regs * ecap,
    DL_ECAP_EVENT event
)

Sets the eCAP DMA source event.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • event is the event number to be used as DMA source

This function sets the eCAP event source for the DMA trigger.

function DL_ECAP_getModuloCounterStatus

__STATIC_INLINE DL_ECAP_EVENT DL_ECAP_getModuloCounterStatus(
    ECAP_Regs * ecap
)

Returns the modulo counter status.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

Return: DL_ECAP_EVENT value indicating which CAPn register will be loaded on the next event

This API returns the modulo counter status, indicating which register gets loaded on the next capture event.

function DL_ECAP_setEmulationMode

__STATIC_INLINE void DL_ECAP_setEmulationMode(
    ECAP_Regs * ecap,
    DL_ECAP_EMULATION_MODE mode
)

Configures the emulation mode.

Parameters:

  • ecap Pointer to the register overlay for the peripheral

  • mode is the emulation mode to set

This function configures the eCAP counter (TSCTR) to the desired emulation mode when emulation suspension occurs. Valid values for modes are:

  • DL_ECAP_EMULATION_STOP - Counter stops immediately on emulation suspension

  • DL_ECAP_EMULATION_RUN_TO_ZERO - Counter runs until 0 on emulation suspension

  • DL_ECAP_EMULATION_FREE_RUN - Counter is unaffected by emulation suspension

function DL_ECAP_initParamsSetDefault

void DL_ECAP_initParamsSetDefault(
    DL_ECAP_Config * config
)

Initializes the ECAP configuration parameters.

Parameters:

  • config Pointer to the ECAP configuration structure.

This function initializes all the parameters of the ECAP configuration structure to their default values.

function DL_ECAP_init

void DL_ECAP_init(
    ECAP_Regs * ecap,
    DL_ECAP_Config * config
)

Initializes the ECAP module.

Parameters:

  • ecap Pointer to the ECAP register overlay

  • config Pointer to the ECAP configuration structure

This function configures the ECAP module according to the provided configuration.

Macros Documentation

define DL_ECAP_MAX_PRESCALER_VALUE

#define DL_ECAP_MAX_PRESCALER_VALUE 32U

eCAP minimum and maximum values

define DL_ECAP_ISR_SOURCE_CEVT1

#define DL_ECAP_ISR_SOURCE_CEVT1 0x2U

Capture Event 1 ISR source.

define DL_ECAP_ISR_SOURCE_CEVT2

#define DL_ECAP_ISR_SOURCE_CEVT2 0x4U

Capture Event 2 ISR source.

define DL_ECAP_ISR_SOURCE_CEVT3

#define DL_ECAP_ISR_SOURCE_CEVT3 0x8U

Capture Event 3 ISR source.

define DL_ECAP_ISR_SOURCE_CEVT4

#define DL_ECAP_ISR_SOURCE_CEVT4 0x10U

Capture Event 4 ISR source.

define DL_ECAP_ISR_SOURCE_CTROVF

#define DL_ECAP_ISR_SOURCE_CTROVF 0x20U

Counter Overflow ISR source.

define DL_ECAP_ISR_SOURCE_CTR_PRD

#define DL_ECAP_ISR_SOURCE_CTR_PRD 0x40U

Counter Equal Period ISR source.

define DL_ECAP_ISR_SOURCE_CTR_CMP

#define DL_ECAP_ISR_SOURCE_CTR_CMP 0x80U

Counter Equal Compare ISR source.

define DL_ECAP_INPUT_COUNT

#define DL_ECAP_INPUT_COUNT (50U)

Number of valid DL_ECAP_INPUT enum values.