Driver API for TC (plib_tc0_timer8bit.h) More...
Data Structures | |
| struct | TC0_8TIMER_OBJECT |
| TC0 8-bit Timer object structure. More... | |
Typedefs | |
| typedef void(* | TC0_8TIMER_CALLBACK_HANDLER) (TC_INTERRUPT int_cause) |
| TC0 8-bit Timer callback handler type. | |
Enumerations | |
| enum | TC_GCLK_PRESCALER { TC_GCLK_PRESCALER_DIV_1 = TC_CTRLA_PRESCALER_DIV1 , TC_GCLK_PRESCALER_DIV_2 = TC_CTRLA_PRESCALER_DIV2 , TC_GCLK_PRESCALER_DIV_4 = TC_CTRLA_PRESCALER_DIV4 , TC_GCLK_PRESCALER_DIV_8 = TC_CTRLA_PRESCALER_DIV8 , TC_GCLK_PRESCALER_DIV_16 = TC_CTRLA_PRESCALER_DIV16 , TC_GCLK_PRESCALER_DIV_64 = TC_CTRLA_PRESCALER_DIV64 , TC_GCLK_PRESCALER_DIV_256 = TC_CTRLA_PRESCALER_DIV256 , TC_GCLK_PRESCALER_DIV_1024 = TC_CTRLA_PRESCALER_DIV1024 } |
| TC0 clock prescaler options. More... | |
| enum | TC_PRESCALER_SYNC_MODE { TC_PRESCSYNC_GCLK = TC_CTRLA_PRESCSYNC_GCLK , TC_PRESCSYNC_PRESC = TC_CTRLA_PRESCSYNC_PRESC , TC_PRESCSYNC_RESYNC = TC_CTRLA_PRESCSYNC_RESYNC } |
| TC0 prescaler synchronization mode. More... | |
| enum | TC_WAVE_GEN_MODE { TC_WAVE_GEN_NFRQ = TC_WAVE_WAVEGEN_NFRQ , TC_WAVE_GEN_MFRQ = TC_WAVE_WAVEGEN_MFRQ , TC_WAVE_GEN_NPWM = TC_WAVE_WAVEGEN_NPWM , TC_WAVE_GEN_MPWM = TC_WAVE_WAVEGEN_MPWM } |
| TC0 waveform generation mode. More... | |
| enum | TC_COUNT_DIRECTION { TC_COUNT_DIRECTION_UP = 1 , TC_COUNT_DIRECTION_DOWN = 2 } |
| TC0 counter direction. More... | |
| enum | TC_INTERRUPT { TC_INTERRUPT_OVERFLOW = TC_INTENSET_OVF_Msk , TC_INTERRUPT_ERROR = TC_INTENSET_ERR_Msk , TC_INTERRUPT_MATCH_CAPTURE_0 = TC_INTENSET_MC0_Msk , TC_INTERRUPT_MATCH_CAPTURE_1 = TC_INTENSET_MC1_Msk } |
| TC0 interrupt sources. More... | |
| enum | TC_CAPTURE_CHANNEL { TC_CAPTURE_CHANNEL_0 = 0 , TC_CAPTURE_CHANNEL_1 } |
| TC Capture Channel Selection. More... | |
| enum | TC_COMPARE_CHANNEL { TC_COMPARE_CHANNEL_0 = 0 , TC_COMPARE_CHANNEL_1 } |
| TC Compare Channel Selection. More... | |
| enum | TC_EVENT_ACTION { TC_EVENT_ACTION_OFF = ((0x0 << TC_EVCTRL_EVACT_Pos) & TC_EVCTRL_EVACT_Msk) , TC_EVENT_ACTION_RETRIGGER = ((0x01 << TC_EVCTRL_EVACT_Pos) & TC_EVCTRL_EVACT_Msk) , TC_EVENT_ACTION_COUNT = ((0x02 << TC_EVCTRL_EVACT_Pos) & TC_EVCTRL_EVACT_Msk) , TC_EVENT_ACTION_START = ((0x03 << TC_EVCTRL_EVACT_Pos) & TC_EVCTRL_EVACT_Msk) , TC_EVENT_ACTION_STAMP = ((0x04 << TC_EVCTRL_EVACT_Pos) & TC_EVCTRL_EVACT_Msk) , TC_EVENT_ACTION_PPW = ((0x05 << TC_EVCTRL_EVACT_Pos) & TC_EVCTRL_EVACT_Msk) , TC_EVENT_ACTION_PWP = ((0x06 << TC_EVCTRL_EVACT_Pos) & TC_EVCTRL_EVACT_Msk) , TC_EVENT_ACTION_PW = ((0x07 << TC_EVCTRL_EVACT_Pos) & TC_EVCTRL_EVACT_Msk) } |
| TC Event Action Selection. More... | |
| enum | TC_SIGNAL_POLARITY { TC_SIGNAL_POLARITY_NON_INVERTED = 0 , TC_SIGNAL_POLARITY_INVERTED } |
| TC Signal Polarity Selection. More... | |
| enum | TC_CAPTURE_TRIGGER_SOURCE { TC_CAPTURE_TRIGGER_SOURCE_EVENT =0 , TC_CAPTURE_TRIGGER_SOURCE_IO } |
| TC Capture Trigger Source Selection. More... | |
Functions | |
| void | TC0_SetInterruptHandler (void(*callback)(void)) |
| Registers the TC0 interrupt callback function. The callback function can be called from main.c for direct callback registration. | |
| void | TC0_TIMER_8BIT_Initialize (void) |
| Initialize the TC0 8BIT timer. | |
| void | TC0_TIMER_8BIT_SetClockPrescaler (TC_GCLK_PRESCALER prescaler, TC_PRESCALER_SYNC_MODE presc_sync_mode) |
| Set the prescaler and prescaler synchronization for TC0 8BIT. | |
| void | TC0_TIMER_8BIT_Enable (void) |
| Enable the TC0 8BIT timer. | |
| void | TC0_TIMER_8BIT_Disable (void) |
| Disable the TC0 8BIT timer. | |
| void | TC0_TIMER_8BIT_ResetSoftware (void) |
| Perform a software reset of the TC0 8BIT timer. | |
| void | TC0_TIMER_8BIT_SetCounter (uint8_t value) |
| Set the counter value. | |
| uint8_t | TC0_TIMER_8BIT_GetCounter (void) |
| Get the current counter value. | |
| void | TC0_TIMER_8BIT_SetPeriod (uint8_t period) |
| Set the period value. | |
| uint8_t | TC0_TIMER_8BIT_GetPeriod (void) |
| Get the current period value. | |
| void | TC0_TIMER_8BIT_EnableOneShotOperation (void) |
| Enable one-shot mode. | |
| void | TC0_TIMER_8BIT_DisableOneShotOperation (void) |
| Disable one-shot mode. | |
| void | TC0_TIMER_8BIT_SetCounterDirection (TC_COUNT_DIRECTION direction) |
| Set the counting direction for TC0. | |
| void | TC0_TIMER_8BIT_EnableRunOnStandby (void) |
| Enable running in standby mode. | |
| void | TC0_TIMER_8BIT_DisableRunOnStandby (void) |
| Disable running in standby mode. | |
| void | TC0_TIMER_8BIT_EnableClockOnDemand (void) |
| Enable clock on demand. | |
| void | TC0_TIMER_8BIT_DisableClockOnDemand (void) |
| Disable clock on demand. | |
| void | TC0_TIMER_8BIT_EnableInterrupt (TC_INTERRUPT source) |
| Enable specific TC0 interrupts. | |
| void | TC0_TIMER_8BIT_DisableInterrupt (TC_INTERRUPT source) |
| Disable specific TC0 interrupts. | |
| void | TC0_TIMER_8BIT_ClearInterruptFlag (TC_INTERRUPT flag) |
| Clear specific TC0 interrupt flags. | |
| void | TC0_TIMER_8BIT_StopCounter (void) |
| Stop the counter of the 8BIT timer. | |
| void | TC0_TIMER_8BIT_RetriggerCounter (void) |
| Retrigger the counter of the 8BIT timer. | |
| uint32_t | TC0_TIMER_8BIT_GetInterruptFlag (void) |
| Get the current TC0 interrupt flags. | |
| void | TC0_TIMER_8BIT_SetCallbackHandler (TC0_8TIMER_CALLBACK_HANDLER callback) |
| Register a callback for timer interrupts. | |
| bool | TC0_TIMER_8BIT_CounterIsStopped (void) |
| Check if the counter of the 8BIT timer is stopped. | |
| void | TC0_TIMER_8BIT_EnableEventOutput (void) |
| Enable event output for the timer channel. | |
| void | TC0_TIMER_8BIT_DisableEventOutput (void) |
| Disable event output for the timer channel. | |
| void | TC0_TIMER_8BIT_EnableInputEvent (void) |
| Enable input event for the timer. | |
| void | TC0_TIMER_8BIT_DisableInputEvent (void) |
| Disable input event for the timer. | |
| void | TC0_TIMER_8BIT_SetEventInputPolarity (TC_SIGNAL_POLARITY polarity) |
| Set event input polarity for the timer. | |
| void | TC0_TIMER_8BIT_SetEventAction (TC_EVENT_ACTION action) |
| Set event input action for the timer. | |
Driver API for TC (plib_tc0_timer8bit.h)
| typedef void(* TC0_8TIMER_CALLBACK_HANDLER) (TC_INTERRUPT int_cause) |
TC0 8-bit Timer callback handler type.
This typedef defines the function pointer type for a callback handler that is invoked when a TC0 8-bit timer interrupt occurs.
The callback function receives the interrupt cause as a parameter, allowing the application to handle specific timer events such as overflow, error, or match/compare interrupts.
| int_cause | The interrupt source mask of type TC_INTERRUPT. |
| enum TC_CAPTURE_CHANNEL |
| enum TC_COMPARE_CHANNEL |
| enum TC_COUNT_DIRECTION |
| enum TC_EVENT_ACTION |
TC Event Action Selection.
Enumerates the available event actions for TC0 event system.
| enum TC_GCLK_PRESCALER |
TC0 clock prescaler options.
Enumerates the available clock division factors for the TC0 peripheral. Used to configure the timer/counter clock rate.
| enum TC_INTERRUPT |
TC0 interrupt sources.
Enumerates the available interrupt sources for the TC0 peripheral.
TC0 prescaler synchronization mode.
Enumerates the available synchronization modes for the TC0 prescaler. Determines how the prescaler synchronizes with the clock source.
| Enumerator | |
|---|---|
| TC_PRESCSYNC_GCLK | Synchronize with GCLK |
| TC_PRESCSYNC_PRESC | Synchronize with prescaler |
| TC_PRESCSYNC_RESYNC | Resynchronize |
| enum TC_SIGNAL_POLARITY |
| enum TC_WAVE_GEN_MODE |
| void TC0_SetInterruptHandler | ( | void(*)(void) | callback | ) |
Registers the TC0 interrupt callback function. The callback function can be called from main.c for direct callback registration.
| [in] | callback | Pointer to user-defined TC0 interrupt handler function. Pass NULL to unregister any existing callback. |
| void TC0_TIMER_8BIT_ClearInterruptFlag | ( | TC_INTERRUPT | flag | ) |
Clear specific TC0 interrupt flags.
| flag | Interrupt flag mask. |
| bool TC0_TIMER_8BIT_CounterIsStopped | ( | void | ) |
Check if the counter of the 8BIT timer is stopped.
| None |
| void TC0_TIMER_8BIT_Disable | ( | void | ) |
Disable the TC0 8BIT timer.
| None |
| void TC0_TIMER_8BIT_DisableClockOnDemand | ( | void | ) |
Disable clock on demand.
| None |
| void TC0_TIMER_8BIT_DisableEventOutput | ( | void | ) |
Disable event output for the timer channel.
| channel | Timer channel. |
| void TC0_TIMER_8BIT_DisableInputEvent | ( | void | ) |
Disable input event for the timer.
| None |
| void TC0_TIMER_8BIT_DisableInterrupt | ( | TC_INTERRUPT | source | ) |
Disable specific TC0 interrupts.
| source | Interrupt source mask of type TC_INTERRUPT. |
| void TC0_TIMER_8BIT_DisableOneShotOperation | ( | void | ) |
Disable one-shot mode.
| None |
| void TC0_TIMER_8BIT_DisableRunOnStandby | ( | void | ) |
Disable running in standby mode.
| None |
| void TC0_TIMER_8BIT_Enable | ( | void | ) |
Enable the TC0 8BIT timer.
| None |
| void TC0_TIMER_8BIT_EnableClockOnDemand | ( | void | ) |
Enable clock on demand.
| None |
| void TC0_TIMER_8BIT_EnableEventOutput | ( | void | ) |
Enable event output for the timer channel.
| channel | Timer channel (typically 0 for overflow event). |
| void TC0_TIMER_8BIT_EnableInputEvent | ( | void | ) |
Enable input event for the timer.
| None |
| void TC0_TIMER_8BIT_EnableInterrupt | ( | TC_INTERRUPT | source | ) |
Enable specific TC0 interrupts.
| source | Interrupt source mask of type TC_INTERRUPT. |
| void TC0_TIMER_8BIT_EnableOneShotOperation | ( | void | ) |
Enable one-shot mode.
| None |
| void TC0_TIMER_8BIT_EnableRunOnStandby | ( | void | ) |
Enable running in standby mode.
| None |
| uint8_t TC0_TIMER_8BIT_GetCounter | ( | void | ) |
Get the current counter value.
| None |
| uint32_t TC0_TIMER_8BIT_GetInterruptFlag | ( | void | ) |
Get the current TC0 interrupt flags.
| None |
| uint8_t TC0_TIMER_8BIT_GetPeriod | ( | void | ) |
Get the current period value.
| None |
| void TC0_TIMER_8BIT_Initialize | ( | void | ) |
Initialize the TC0 8BIT timer.
| None |
| void TC0_TIMER_8BIT_ResetSoftware | ( | void | ) |
Perform a software reset of the TC0 8BIT timer.
| None |
| void TC0_TIMER_8BIT_RetriggerCounter | ( | void | ) |
Retrigger the counter of the 8BIT timer.
| None |
| void TC0_TIMER_8BIT_SetCallbackHandler | ( | TC0_8TIMER_CALLBACK_HANDLER | callback | ) |
Register a callback for timer interrupts.
| callback | Function pointer to callback. |
| void TC0_TIMER_8BIT_SetClockPrescaler | ( | TC_GCLK_PRESCALER | prescaler, |
| TC_PRESCALER_SYNC_MODE | presc_sync_mode ) |
Set the prescaler and prescaler synchronization for TC0 8BIT.
| prescaler | Prescaler value. |
| prescsync | Prescaler synchronization value. |
| void TC0_TIMER_8BIT_SetCounter | ( | uint8_t | value | ) |
Set the counter value.
| value | Counter value to set. |
| void TC0_TIMER_8BIT_SetCounterDirection | ( | TC_COUNT_DIRECTION | direction | ) |
Set the counting direction for TC0.
| direction | TC_COUNT_DIRECTION_UP or TC_COUNT_DIRECTION_DOWN. |
| void TC0_TIMER_8BIT_SetEventAction | ( | TC_EVENT_ACTION | action | ) |
Set event input action for the timer.
| action | Event action (e.g., retrigger, start). |
| void TC0_TIMER_8BIT_SetEventInputPolarity | ( | TC_SIGNAL_POLARITY | polarity | ) |
Set event input polarity for the timer.
| polarity | Signal polarity (normal or inverted). |
| void TC0_TIMER_8BIT_SetPeriod | ( | uint8_t | period | ) |
Set the period value.
| period | Period value to set. |
| void TC0_TIMER_8BIT_StopCounter | ( | void | ) |
Stop the counter of the 8BIT timer.
| None |