Driver API for TCC (plib_tcc0_capture.h) More...
Data Structures | |
| struct | TCC0_CAPTURE_OBJECT |
| TCC0 Capture object structure. More... | |
Macros | |
| #define | TCC_CAPTURE_SOURCE_POLARITY_NON_INVERTED 0U |
| Signal polarity for TCC0 capture input sources. | |
| #define | TCC_CAPTURE_SOURCE_POLARITY_INVERTED 1U |
| #define | TCC_CAPTURE_EVENT_INV_TC_0 0 |
| Timer counter channel for event inversion. | |
| #define | TCC_CAPTURE_EVENT_INV_TC_1 1 |
| #define | TCC_CAPTURE_CHANNEL_0 0 |
| Channels for TCC0 capture mode. | |
| #define | TCC_CAPTURE_CHANNEL_1 1 |
| #define | TCC_CAPTURE_CHANNEL_2 2 |
| #define | TCC_CAPTURE_CHANNEL_3 3 |
| #define | TCC_COUNT_DIRECTION_UP 1U |
| Counter direction for TCC0. | |
| #define | TCC_COUNT_DIRECTION_DOWN 2U |
Typedefs | |
| typedef void(* | TCC0_CAPTURE_CALLBACK_HANDLER) (TCC_INTERRUPT int_cause) |
| Callback handler type for TCC0 capture interrupts. | |
| typedef uint32_t | TCC_CAPTURE_EVENT_OUTPUT |
| Event output selection for TCC0 capture (bitmask values). | |
| typedef uint32_t | TCC_CAPTURE_INPUT_SOURCE_POLARITY |
| TCC0 signal polarity selection. | |
| typedef uint32_t | TCC_CAPTURE_INPUT_EVACT0 |
| TCC0 event action selection for input event 0. | |
| typedef uint32_t | TCC_CAPTURE_INPUT_EVENT_ACTION_1 |
| TCC0 event action selection for input event 1. | |
| typedef uint32_t | TCC_CAPTURE_EVENT_INV_CHANNEL |
| TCC0 INVERT_TIMER event inversion selection. | |
| typedef uint32_t | TCC_CAPTURE_EVENT_INPUT_CHANNEL |
| TCC0 event channel selection. | |
| typedef uint32_t | TCC_CAPTURE_CHANNEL |
| TCC0 compare channel selection. | |
| typedef uint32_t | TCC_GCLK_PRESCALER |
| TCC0 clock prescaler options. | |
| typedef uint32_t | TCC_PRESCALER_SYNC_MODE |
| TCC0 prescaler synchronization mode. | |
| typedef uint32_t | TCC_WAVE_GEN_MODE |
| TCC0 waveform generation mode. | |
| typedef uint8_t | TCC_COUNT_DIRECTION |
| TCC0 counter direction. | |
| typedef uint32_t | TCC_EVENT_OUTPUT_CNTSEL_PHASE |
| TCC0 event output phase. | |
| typedef uint32_t | TCC_INTERRUPT |
| TCC0 interrupt sources. | |
| typedef uint32_t | TCC_WAVE_RAMP_OPERATION |
| TCC0 capture ramp operation selection. | |
Functions | |
| void | TCC0_CAPTURE_Initialize (void) |
| Initialize the TCC0 capture module. | |
| void | TCC0_CAPTURE_SetClockPrescaler (TCC_GCLK_PRESCALER prescaler, TCC_PRESCALER_SYNC_MODE presc_sync_mode) |
| Set the prescaler and prescaler synchronization for TCC0 capture. | |
| void | TCC0_CAPTURE_Enable (void) |
| Enable the TCC0 capture module. | |
| void | TCC0_CAPTURE_Disable (void) |
| Disable the TCC0 capture module. | |
| void | TCC0_CAPTURE_ResetSoftware (void) |
| Perform a software reset of the TCC0 capture module. | |
| void | TCC0_CAPTURE_StopCapture (void) |
| Stop the capture operation. | |
| bool | TCC0_CAPTURE_CaptureIsStopped (void) |
| Check if the capture operation is stopped. | |
| void | TCC0_CAPTURE_RetriggerCapture (void) |
| Retrigger the capture operation. | |
| void | TCC0_CAPTURE_EnableCaptureChannel (TCC_CAPTURE_CHANNEL channel) |
| Enable a capture channel. | |
| void | TCC0_CAPTURE_DisableCaptureChannel (TCC_CAPTURE_CHANNEL channel) |
| Disable a capture channel. | |
| uint32_t | TCC0_CAPTURE_GetPrescaler (void) |
| Get the current prescaler value. | |
| uint32_t | TCC0_CAPTURE_GetCaptureValue (TCC_CAPTURE_CHANNEL channel) |
| Get the captured value for a channel. | |
| void | TCC0_CAPTURE_EnableEventOutput (TCC_CAPTURE_EVENT_OUTPUT event) |
| Enable event output for a specific event type. | |
| void | TCC0_CAPTURE_DisableEventOutput (TCC_CAPTURE_EVENT_OUTPUT event) |
| Disable event output for a specific event type. | |
| void | TCC0_CAPTURE_EnableInputEvent (TCC_CAPTURE_EVENT_INPUT_CHANNEL event_channel) |
| Enable input event for the capture module. | |
| void | TCC0_CAPTURE_DisableInputEvent (TCC_CAPTURE_EVENT_INPUT_CHANNEL event_channel) |
| Disable input event for the capture module. | |
| void | TCC0_CAPTURE_SetEventInputPolarity (TCC_CAPTURE_EVENT_INV_CHANNEL event_channel, TCC_CAPTURE_INPUT_SOURCE_POLARITY polarity) |
| Set event input polarity for the capture module. | |
| void | TCC0_CAPTURE_SetEvent0InputAction (TCC_CAPTURE_INPUT_EVACT0 action) |
| Set event input action 0 for the timer. | |
| void | TCC0_CAPTURE_SetEvent1InputAction (TCC_CAPTURE_INPUT_EVENT_ACTION_1 action) |
| Set event input action 1 for the timer. | |
| void | TCC0_CAPTURE_EnableInterrupt (TCC_INTERRUPT source) |
| Enable specific TCC0 capture interrupts. | |
| void | TCC0_CAPTURE_DisableInterrupt (TCC_INTERRUPT source) |
| Disable specific TCC0 capture interrupts. | |
| void | TCC0_CAPTURE_ClearInterruptFlag (TCC_INTERRUPT flag) |
| Clear specific TCC0 capture interrupt flags. | |
| uint32_t | TCC0_CAPTURE_GetInterruptFlag (void) |
| Get the current TCC0 capture interrupt flags. | |
| void | TCC0_CAPTURE_SetCallbackHandler (TCC0_CAPTURE_CALLBACK_HANDLER callback) |
| Register a callback for capture interrupts. | |
| void | TCC0_CAPTURE_EnableFullCycleStop (void) |
| Enable full cycle stop (wait for end of cycle before stopping). | |
| void | TCC0_CAPTURE_DisableFullCycleStop (void) |
| Disable full cycle stop (stop immediately). | |
| bool | TCC0_CAPTURE_FullCycleStopIsEnabled (void) |
| Check if full cycle stop is enabled. | |
| void | TCC0_CAPTURE_EnableRunOnStandby (void) |
| Enable run in standby mode. | |
| void | TCC0_CAPTURE_DisableRunOnStandby (void) |
| Disable run in standby mode. | |
| void | TCC0_CAPTURE_EnableDMAOneShot (void) |
| Enable DMA one-shot mode. | |
| void | TCC0_CAPTURE_DisableDMAOneShot (void) |
| Disable DMA one-shot mode. | |
| void | TCC0_SetInterruptHandler (void(*handler)(void)) |
| Registers the TCC0 interrupt callback function. The callback function can be called from main.c for direct callback registration. | |
Driver API for TCC (plib_tcc0_capture.h)
The following example demonstrates typical usage of the TCC peripheral:
| #define TCC_CAPTURE_CHANNEL_0 0 |
Channels for TCC0 capture mode.
| #define TCC_CAPTURE_CHANNEL_1 1 |
| #define TCC_CAPTURE_CHANNEL_2 2 |
| #define TCC_CAPTURE_CHANNEL_3 3 |
| #define TCC_CAPTURE_EVENT_INV_TC_0 0 |
Timer counter channel for event inversion.
| #define TCC_CAPTURE_EVENT_INV_TC_1 1 |
| #define TCC_CAPTURE_SOURCE_POLARITY_INVERTED 1U |
| #define TCC_CAPTURE_SOURCE_POLARITY_NON_INVERTED 0U |
Signal polarity for TCC0 capture input sources.
| #define TCC_COUNT_DIRECTION_DOWN 2U |
| #define TCC_COUNT_DIRECTION_UP 1U |
Counter direction for TCC0.
| TCC0_CAPTURE_CALLBACK_HANDLER |
Callback handler type for TCC0 capture interrupts.
| int_cause | Interrupt source mask of type TCC_INTERRUPT. |
| typedef uint32_t TCC_CAPTURE_CHANNEL |
TCC0 compare channel selection.
Selects the compare channel for TCC0 capture.
| typedef uint32_t TCC_CAPTURE_EVENT_INPUT_CHANNEL |
TCC0 event channel selection.
Selects the event input channel for TCC0 capture.
| typedef uint32_t TCC_CAPTURE_EVENT_INV_CHANNEL |
TCC0 INVERT_TIMER event inversion selection.
Selects the timer counter channel for event inversion.
| typedef uint32_t TCC_CAPTURE_EVENT_OUTPUT |
Event output selection for TCC0 capture (bitmask values).
| typedef uint32_t TCC_CAPTURE_INPUT_EVACT0 |
TCC0 event action selection for input event 0.
Selects the event action for TCC0 input event 0.
| typedef uint32_t TCC_CAPTURE_INPUT_EVENT_ACTION_1 |
TCC0 event action selection for input event 1.
Selects the event action for TCC0 input event 1.
| typedef uint32_t TCC_CAPTURE_INPUT_SOURCE_POLARITY |
TCC0 signal polarity selection.
Selects the signal polarity for TCC0 capture input sources.
| typedef uint8_t TCC_COUNT_DIRECTION |
TCC0 counter direction.
Selects the counter direction for TCC0.
| typedef uint32_t TCC_EVENT_OUTPUT_CNTSEL_PHASE |
TCC0 event output phase.
Selects the event output phase TCC0.
| typedef uint32_t TCC_GCLK_PRESCALER |
TCC0 clock prescaler options.
Selects the clock prescaler for TCC0.
| typedef uint32_t TCC_INTERRUPT |
TCC0 interrupt sources.
| typedef uint32_t TCC_PRESCALER_SYNC_MODE |
TCC0 prescaler synchronization mode.
Selects the prescaler synchronization mode for TCC0.
| typedef uint32_t TCC_WAVE_GEN_MODE |
TCC0 waveform generation mode.
Selects the waveform generation mode for TCC0.
| typedef uint32_t TCC_WAVE_RAMP_OPERATION |
TCC0 capture ramp operation selection.
Selects the ramp operation for TCC0 capture mode.
| bool TCC0_CAPTURE_CaptureIsStopped | ( | void | ) |
Check if the capture operation is stopped.
| None |
| void TCC0_CAPTURE_ClearInterruptFlag | ( | TCC_INTERRUPT | flag | ) |
Clear specific TCC0 capture interrupt flags.
| flag | Interrupt flag mask. |
| void TCC0_CAPTURE_Disable | ( | void | ) |
Disable the TCC0 capture module.
| None |
| void TCC0_CAPTURE_DisableCaptureChannel | ( | TCC_CAPTURE_CHANNEL | channel | ) |
Disable a capture channel.
| channel | Capture channel number. |
| void TCC0_CAPTURE_DisableDMAOneShot | ( | void | ) |
Disable DMA one-shot mode.
| None |
| void TCC0_CAPTURE_DisableEventOutput | ( | TCC_CAPTURE_EVENT_OUTPUT | event | ) |
Disable event output for a specific event type.
| event | Event output type (see TCC_CAPTURE_EVENT_OUTPUT). |
| void TCC0_CAPTURE_DisableFullCycleStop | ( | void | ) |
Disable full cycle stop (stop immediately).
| None |
| void TCC0_CAPTURE_DisableInputEvent | ( | TCC_CAPTURE_EVENT_INPUT_CHANNEL | event_channel | ) |
Disable input event for the capture module.
| event_channel | Event input channel (see TCC_CAPTURE_EVENT_INPUT_CHANNEL). |
| void TCC0_CAPTURE_DisableInterrupt | ( | TCC_INTERRUPT | source | ) |
Disable specific TCC0 capture interrupts.
| source | Interrupt source mask of type TCC_INTERRUPT. |
| void TCC0_CAPTURE_DisableRunOnStandby | ( | void | ) |
Disable run in standby mode.
| None |
| void TCC0_CAPTURE_Enable | ( | void | ) |
Enable the TCC0 capture module.
| None |
| void TCC0_CAPTURE_EnableCaptureChannel | ( | TCC_CAPTURE_CHANNEL | channel | ) |
Enable a capture channel.
| channel | Capture channel number. |
| void TCC0_CAPTURE_EnableDMAOneShot | ( | void | ) |
Enable DMA one-shot mode.
| None |
| void TCC0_CAPTURE_EnableEventOutput | ( | TCC_CAPTURE_EVENT_OUTPUT | event | ) |
Enable event output for a specific event type.
| event | Event output type (see TCC_CAPTURE_EVENT_OUTPUT). |
| void TCC0_CAPTURE_EnableFullCycleStop | ( | void | ) |
Enable full cycle stop (wait for end of cycle before stopping).
| None |
| void TCC0_CAPTURE_EnableInputEvent | ( | TCC_CAPTURE_EVENT_INPUT_CHANNEL | event_channel | ) |
Enable input event for the capture module.
| event_channel | Event input channel (see TCC_CAPTURE_EVENT_INPUT_CHANNEL). |
| void TCC0_CAPTURE_EnableInterrupt | ( | TCC_INTERRUPT | source | ) |
Enable specific TCC0 capture interrupts.
| source | Interrupt source mask of type TCC_INTERRUPT. |
| void TCC0_CAPTURE_EnableRunOnStandby | ( | void | ) |
Enable run in standby mode.
| None |
| bool TCC0_CAPTURE_FullCycleStopIsEnabled | ( | void | ) |
Check if full cycle stop is enabled.
| None |
| uint32_t TCC0_CAPTURE_GetCaptureValue | ( | TCC_CAPTURE_CHANNEL | channel | ) |
Get the captured value for a channel.
| channel | Capture channel number. |
| uint32_t TCC0_CAPTURE_GetInterruptFlag | ( | void | ) |
Get the current TCC0 capture interrupt flags.
| None |
| uint32_t TCC0_CAPTURE_GetPrescaler | ( | void | ) |
Get the current prescaler value.
| None |
| void TCC0_CAPTURE_Initialize | ( | void | ) |
Initialize the TCC0 capture module.
| None |
| void TCC0_CAPTURE_ResetSoftware | ( | void | ) |
Perform a software reset of the TCC0 capture module.
| None |
| void TCC0_CAPTURE_RetriggerCapture | ( | void | ) |
Retrigger the capture operation.
| None |
| void TCC0_CAPTURE_SetCallbackHandler | ( | TCC0_CAPTURE_CALLBACK_HANDLER | callback | ) |
Register a callback for capture interrupts.
| callback | Function pointer to callback. |
| void TCC0_CAPTURE_SetClockPrescaler | ( | TCC_GCLK_PRESCALER | prescaler, |
| TCC_PRESCALER_SYNC_MODE | presc_sync_mode ) |
Set the prescaler and prescaler synchronization for TCC0 capture.
| prescaler | Prescaler value. |
| presc_sync_mode | Prescaler synchronization value. |
| void TCC0_CAPTURE_SetEvent0InputAction | ( | TCC_CAPTURE_INPUT_EVACT0 | action | ) |
Set event input action 0 for the timer.
| action | Event action (see TCC_CAPTURE_INPUT_EVACT0). |
| void TCC0_CAPTURE_SetEvent1InputAction | ( | TCC_CAPTURE_INPUT_EVENT_ACTION_1 | action | ) |
Set event input action 1 for the timer.
| action | Event action (see TCC_CAPTURE_INPUT_EVENT_ACTION_1). |
| void TCC0_CAPTURE_SetEventInputPolarity | ( | TCC_CAPTURE_EVENT_INV_CHANNEL | event_channel, |
| TCC_CAPTURE_INPUT_SOURCE_POLARITY | polarity ) |
Set event input polarity for the capture module.
| event_channel | Event input channel (see TCC_CAPTURE_EVENT_INPUT_CHANNEL). |
| polarity | Signal polarity (normal or inverted). |
| void TCC0_CAPTURE_StopCapture | ( | void | ) |
Stop the capture operation.
| None |
| void TCC0_SetInterruptHandler | ( | void(*)(void) | handler | ) |
Registers the TCC0 interrupt callback function. The callback function can be called from main.c for direct callback registration.
| [in] | callback | Pointer to user-defined TCC0 interrupt handler function. Pass NULL to unregister any existing callback. |