4.14.7 16-bit Timer/Counter E with PWM
16-bit PWM Timer/Counter type E (TCE) with scale hardware accelerator
4.14.7.1 Introduction
The flexible 16-Bit PWM Timer/Counter type E (TCE) provides accurate program execution timing, frequency and waveform generation, and command execution. The Timer/Counter consists of a base counter and compare channels. The compare channels can be used with the base counter for compare match control, frequency generation, and pulse width waveform modulation.
4.14.7.2 Supported Device Families
AVR® EB |
4.14.7.3 Required header files:
#include "mcc_generated_files/timer/tce[X].h"
4.14.7.4 Module Documentation
4.14.7.4.1 TCE0
This document contains API prototypes and data types for the Timer Counter E module.
Module description
This document contains API prototypes and data types for the Timer Counter E module.
Typedefs
typedef void(* TCE0_cb_t) (void)
Pointer to a function to be used as a callback handler when an overflow interrupt event occurs.
Definitions
#define TCE0_PER_US_TO_TICKS(US, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from us(microseconds) to clock increments for setting the period.
#define TCE0_PER_MS_TO_TICKS(MS, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from ms(milliseconds) to clock increments for setting the period.
#define TCE0_PER_S_TO_TICKS(S, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from s(seconds) to clock increments for setting the period.
#define TCE0_CMP_US_TO_TICKS(US, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from us(microseconds) to clock increments for setting the compare registers.
#define TCE0_CMP_MS_TO_TICKS(MS, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from ms(milliseconds) to clock increments for setting the compare registers.
#define TCE0_CMP_S_TO_TICKS(S, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from s(seconds) to clock increments for setting the compare registers.
#define TCE0_HZ_TO_CLOCKS_FREQUENCYMODE(HZ, F_CLOCK, TCE0_PRESCALER) (uint16_t)((float)(F_CLOCK) / (2 * (float)(HZ) * (float)(TCE0_PRESCALER)) - 1)
Defines the macro associated with the conversion from Hz(Hertz) to clock increments. Used in Frequency mode.
Enumerations
enum TCE0_status_t { TCE_STATUS_IDLE = 0, TCE_STATUS_RUNNING = 1 }
Lists the possible states of the TCE0.
Functions
ISR (TCE0_OVF_vect)
Interrupt Service Routine (ISR) for the overflow (OVF) interrupt.
ISR (TCE0_CMP0_vect)
ISR for the CMP0 interrupt.
ISR (TCE0_CMP1_vect)
ISR for the CMP1 interrupt.
ISR (TCE0_CMP2_vect)
ISR for the CMP2 interrupt.
ISR (TCE0_CMP3_vect)
ISR for the CMP3 interrupt.
void TCE0_OverflowCallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 overflow callback.
void TCE0_Compare0CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare0 callback.
void TCE0_Compare1CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare1 callback.
void TCE0_Compare2CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare2 callback.
void TCE0_Compare3CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare3 callback.
void TCE0_Initialize (void)
Initializes the TCE0 module. This routine must be called before other TCE0 APIs.
void TCE0_Deinitialize (void)
Deinitializes the TCE0 module.
void TCE0_Start (void)
Starts the TCE0.
void TCE0_Stop (void)
Stops the TCE0.
TCE0_status_t TCE0_StatusGet (void)
Returns the status of the TCE0 module.
void TCE0_ModeSet (TCE_WGMODE_t mode)
Sets the Wave mode for the TCE0.
void TCE0_Interrupts_Enable (uint8_t value)
Enables the TCE0 OVF, CMP0, CMP1, CMP2 or, CMP3 interrupts.
void TCE0_Interrupts_FlagsClear (uint8_t value)
Clears the interrupt flags for the TCE0.
uint8_t TCE0_Interrupts_FlagsGet (void)
Retrieves the interrupt flag status.
void TCE0_Interrupts_Disable (uint8_t value)
Disables the TCE0 OVF, CMP0, CMP1, CMP2 or, CMP3 interrupts.
void TCE0_Event_OutputMode (uint8_t value)
Controls the Waveform mode on the event output line for the TCE0.
void TCE0_Event_InputConfig (uint8_t value)
Enables the input event for the TCE0.
void TCE0_SoftwareCommand (TCE_CMD_t com)
Enables software control of the Update, Restart and Reset states of the TCE0.
void TCE0_StandBySleep (bool state)
Enables/disables the Run-in-Standby mode (RUNSTBY register) for the TCE0.
void TCE0_DebugRun (bool state)
Enables Debug mode for the TCE0.
uint16_t TCE0_CounterGet (void)
Returns the Count (CNT) register value for the TCE0.
void TCE0_CounterSet (uint16_t value)
Sets the Count (CNT) register value for the TCE0.
void TCE0_PrescalerSet (TCE_CLKSEL_t prescaler)
Selects the prescaler for the TCE0.
void TCE0_Compare0Set (uint16_t value)
Sets the Compare 0 (CMP0) register value for the TCE0.
void TCE0_Compare1Set (uint16_t value)
Sets the Compare 1 (CMP1) register value for the TCE0.
void TCE0_Compare2Set (uint16_t value)
Sets the Compare 2 (CMP2) register value for the TCE0.
void TCE0_Compare3Set (uint16_t value)
Sets the Compare 3 (CMP3) register value for the TCE0.
void TCE0_CompareAllChannelsSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all four CMP registers for the TCE0.
void TCE0_CompareChannels012Set (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the CMP0, CMP1 and, CMP2 registers for the TCE0.
void TCE0_CompareChannels123Set (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the CMP1, CMP2, and CMP3 registers for the TCE.
void TCE0_CompareAllChannelsBufferedSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all four Compare Buffer (CMPBUF) registers for the TCE0.
void TCE0_CompareChannels012BufferedSet (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare 0 Buffer (CMP0BUF), Compare 1 Buffer (CMP1BUF) and, Compare 2 Buffer (CMP2BUF) registers for the TCE0.
void TCE0_CompareChannels123BufferedSet (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare 1 Buffer (CMP1BUF), Compare 2 Buffer (CMP2BUF) and, Compare 3 Buffer (CMP3BUF) registers for the TCE0.
void TCE0_OutputsEnable (uint8_t value)
Enables the Waveform outputs for the four TCE0 channels.
void TCE0_OutputsValueSet (uint8_t value)
Sets the output values for the four TCE0 channels.
uint8_t TCE0_OutputsValueGet (void)
Returns the values of the polarities and outputs for the four TCE0 channels.
void TCE0_HighResSet (TCE_HREN_t resolution)
Sets the high resolution used for the TCE0.
void TCE0_ScaleModeSet (TCE_SCALEMODE_t mode)
Sets the Scaling mode used for the TCE0.
void TCE0_ScaleEnable (bool state)
Allows for fractional values to be written to the Compare (CMP), Amplitude (AMP) and, Compare Buffer (CMPBUF) registers for TCE0.
void TCE0_AmplitudeControlEnable (bool state)
Allows the use of the AMP and OFFSET registers for the TCE0.
void TCE0_AmplitudeSet (uint16_t value)
Sets the AMP register of the TCE0.
uint16_t TCE0_AmplitudeGet (void)
Returns the value of the AMP register of the TCE0.
void TCE0_OffsetSet (uint16_t value)
Sets the OFFSET register of the TCE0.
uint16_t TCE0_OffsetGet (void)
Returns the value of the OFFSET register of the TCE0.
void TCE0_PeriodSet (uint16_t period)
Sets the Period (PER) register for the TCE0.
void TCE0_CountDirectionSet (void)
Sets the TCE0 to count UP.
void TCE0_CountDirectionClear (void)
Sets the TCE0 to count DOWN.
void TCE0_LockUpdateSet (void)
Sets the Lock Update (LUPD) bit for the TCE0 to 1. This ensures there will be no update on the buffered registers.
void TCE0_LockUpdateClear (void)
Clears the Lock Update bit for the TCE0. This ensures that the buffered registers are updated when an UPDATE condition has occurred.
void TCE0_AutoLockUpdateSet (void)
Sets the Auto-Lock Update (ALUPD) bit for the TCE0 to 1. This ensures that the Lock Update (LUPD) bit in the TCEn.CTRLE register is set and cleared automatically.
void TCE0_AutoLockUpdateClear (void)
Clears the Auto-Lock Update bit for the TCE0. This ensures that the LUPD bit in the TCEn.CTRLE register is not altered by the system.
void TCE0_PWM_BufferedDutyCycle0Set (uint16_t value)
Sets the value of the CMP0BUF register used in the Pulse-Width Modulation (PWM) mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle1Set (uint16_t value)
Sets the value of the CMP1BUF register used in PWM mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle2Set (uint16_t value)
Sets the value of the CMP2BUF register used in PWM mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle3Set (uint16_t value)
Sets the value of the CMP3BUF register used in PWM mode by the TCE0.
void TCE0_PeriodBufferSet (uint16_t value)
Sets the value of the Period Buffer (PERBUF) register that serves as the buffer for the period register TCE0.PER.
Variables
static TCE0_cb_t TCE0_OVF_isr_cb = NULL
Function pointers that store the callback addresses.
static volatile bool timerActive = false
Boolean that is true when timer is active.
static volatile uint8_t timerMode = TCE_WGMODE_FRQ_gc
8-bit variable that replicates TCE_WGMODE_t enum to reflect the active mode.
Definition Documentation
TCE0_CMP_MS_TO_TICKS
#define TCE0_CMP_MS_TO_TICKS( MS, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from ms(milliseconds) to clock increments for setting the compare registers.
TCE0_CMP_S_TO_TICKS
#define TCE0_CMP_S_TO_TICKS( S, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from s(seconds) to clock increments for setting the compare registers.
TCE0_CMP_US_TO_TICKS
#define TCE0_CMP_US_TO_TICKS( US, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from us(microseconds) to clock increments for setting the compare registers.
TCE0_HZ_TO_CLOCKS_FREQUENCYMODE
#define TCE0_HZ_TO_CLOCKS_FREQUENCYMODE( HZ, F_CLOCK, TCE0_PRESCALER) (uint16_t)((float)(F_CLOCK) / (2 * (float)(HZ) * (float)(TCE0_PRESCALER)) - 1)
Defines the macro associated with the conversion from Hz(Hertz) to clock increments. Used in Frequency mode.
TCE0_PER_MS_TO_TICKS
#define TCE0_PER_MS_TO_TICKS( MS, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from ms(milliseconds) to clock increments for setting the period.
TCE0_PER_S_TO_TICKS
#define TCE0_PER_S_TO_TICKS( S, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from s(seconds) to clock increments for setting the period.
TCE0_PER_US_TO_TICKS
#define TCE0_PER_US_TO_TICKS( US, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from us(microseconds) to clock increments for setting the period.
Typedef Documentation
TCE0_cb_t
typedef void(* TCE0_cb_t) (void)
Pointer to a function to be used as a callback handler when an overflow interrupt event occurs.
None. |
None. |
Function Documentation
ISR()[1/5]
ISR (TCE0_CMP0_vect )
ISR for the CMP0 interrupt.
None. |
None. |
ISR()[2/5]
ISR (TCE0_CMP1_vect )
ISR for the CMP1 interrupt.
None. |
None. |
ISR()[3/5]
ISR (TCE0_CMP2_vect )
ISR for the CMP2 interrupt.
None. |
None. |
ISR()[4/5]
ISR (TCE0_CMP3_vect )
ISR for the CMP3 interrupt.
None. |
None. |
ISR()[5/5]
ISR (TCE0_OVF_vect )
Interrupt Service Routine (ISR) for the overflow (OVF) interrupt.
None. |
None. |
TCE0_AmplitudeControlEnable()
void TCE0_AmplitudeControlEnable (bool state)
Allows the use of the AMP and OFFSET registers for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. The SCALE bit needs to be set to "1". |
bool |
state:
|
None. |
TCE0_AmplitudeGet()
uint16_t TCE0_AmplitudeGet (void )
Returns the value of the AMP register of the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
uint16_t, represents the value in the AMP register. NOTE: the value read may be different from the one that was previously written in the AMP register. |
TCE0_AmplitudeSet()
void TCE0_AmplitudeSet (uint16_t value)
Sets the AMP register of the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value, represents the value to be written in the AMP register. |
None. |
TCE0_AutoLockUpdateClear()
void TCE0_AutoLockUpdateClear (void )
Clears the Auto-Lock Update bit for the TCE0. This ensures that the LUPD bit in the TCEn.CTRLE register is not altered by the system.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_AutoLockUpdateSet()
void TCE0_AutoLockUpdateSet (void )
Sets the Auto-Lock Update (ALUPD) bit for the TCE0 to 1. This ensures that the Lock Update (LUPD) bit in the TCEn.CTRLE register is set and cleared automatically.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_Compare0CallbackRegister()
void TCE0_Compare0CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare0 callback.
None. |
CallbackHandler |
- Pointer to custom callback. |
None. |
TCE0_Compare0Set()
void TCE0_Compare0Set (uint16_t value)
Sets the Compare 0 (CMP0) register value for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
- TCE0 value to be written to the CMP0 register. |
None. |
TCE0_Compare1CallbackRegister()
void TCE0_Compare1CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare1 callback.
None. |
CallbackHandler |
- Pointer to custom callback. |
None. |
TCE0_Compare1Set()
void TCE0_Compare1Set (uint16_t value)
Sets the Compare 1 (CMP1) register value for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
- TCE0 value to be written to the CMP1 register. |
None. |
TCE0_Compare2CallbackRegister()
void TCE0_Compare2CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare2 callback.
None. |
CallbackHandler |
- Pointer to custom callback. |
None. |
TCE0_Compare2Set()
void TCE0_Compare2Set (uint16_t value)
Sets the Compare 2 (CMP2) register value for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
- TCE0 value to be written to the CMP2 register. |
None. |
TCE0_Compare3CallbackRegister()
void TCE0_Compare3CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare3 callback.
None. |
CallbackHandler |
- Pointer to custom callback. |
None. |
TCE0_Compare3Set()
void TCE0_Compare3Set (uint16_t value)
Sets the Compare 3 (CMP3) register value for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
- TCE0 value to be written to the CMP3 register. |
None. |
TCE0_CompareAllChannelsBufferedSet()
void TCE0_CompareAllChannelsBufferedSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all four Compare Buffer (CMPBUF) registers for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value0, uint16_t value1, uint16_t value2, uint16_t value3, represents values to be written to the registers CMP0, CMP1, CMP2 and, CMP3 |
None. |
TCE0_CompareAllChannelsSet()
void TCE0_CompareAllChannelsSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all four CMP registers for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value0, uint16_t value1, uint16_t value2, uint16_t value3, represents values to be written to the registers CMP0, CMP1, CMP2 and, CMP3 |
None. |
TCE0_CompareChannels012BufferedSet()
void TCE0_CompareChannels012BufferedSet (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare 0 Buffer (CMP0BUF), Compare 1 Buffer (CMP1BUF) and, Compare 2 Buffer (CMP2BUF) registers for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value0, uint16_t value1, uint16_t value2, represents values to be written to the registers CMP0BUF, CMP1BUF and, CMP2BUF |
None. |
TCE0_CompareChannels012Set()
void TCE0_CompareChannels012Set (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the CMP0, CMP1 and, CMP2 registers for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value0, uint16_t value1, uint16_t value2, represents values to be written to the registers CMP0, CMP1 and, CMP2 |
None. |
TCE0_CompareChannels123BufferedSet()
void TCE0_CompareChannels123BufferedSet (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare 1 Buffer (CMP1BUF), Compare 2 Buffer (CMP2BUF) and, Compare 3 Buffer (CMP3BUF) registers for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value0, uint16_t value1, uint16_t value2, represents values to be written to the registers CMP1BUF, CMP2BUF and, CMP3BUF |
None. |
TCE0_CompareChannels123Set()
void TCE0_CompareChannels123Set (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the CMP1, CMP2, and CMP3 registers for the TCE.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value1, uint16_t value2, uint16_t value3, represents values to be written to the registers CMP1, CMP2 and, CMP3 |
None. |
TCE0_CountDirectionClear()
void TCE0_CountDirectionClear (void )
Sets the TCE0 to count DOWN.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_CountDirectionSet()
void TCE0_CountDirectionSet (void )
Sets the TCE0 to count UP.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_CounterGet()
uint16_t TCE0_CounterGet (void )
Returns the Count (CNT) register value for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
uint16_t - CNT register value for the TCE0. |
TCE0_CounterSet()
void TCE0_CounterSet (uint16_t value)
Sets the Count (CNT) register value for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t- |
TCE0 value to be written to the CNT register. |
None. |
TCE0_DebugRun()
void TCE0_DebugRun (bool state)
Enables Debug mode for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
bool |
state:
|
None. |
TCE0_Deinitialize()
void TCE0_Deinitialize (void )
Deinitializes the TCE0 module.
None. |
None. |
None. |
TCE0_Event_InputConfig()
void TCE0_Event_InputConfig (uint8_t value)
Enables the input event for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint8_t |
value. |
None. |
TCE0_Event_OutputMode()
void TCE0_Event_OutputMode (uint8_t value)
Controls the Waveform mode on the event output line for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint8_t |
state. |
None. |
TCE0_HighResSet()
void TCE0_HighResSet (TCE_HREN_t resolution)
Sets the high resolution used for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
TCE_HREN_t |
resolution:
|
None. |
TCE0_Initialize()
void TCE0_Initialize (void )
Initializes the TCE0 module. This routine must be called before other TCE0 APIs.
None. |
None. |
None. |
TCE0_Interrupts_Disable()
void TCE0_Interrupts_Disable (uint8_t value)
Disables the TCE0 OVF, CMP0, CMP1, CMP2 or, CMP3 interrupts.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_Interrupts_Enable()
void TCE0_Interrupts_Enable (uint8_t value)
Enables the TCE0 OVF, CMP0, CMP1, CMP2 or, CMP3 interrupts.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_Interrupts_FlagsClear()
void TCE0_Interrupts_FlagsClear (uint8_t value)
Clears the interrupt flags for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint8_t |
value. |
None. |
TCE0_Interrupts_FlagsGet()
uint8_t TCE0_Interrupts_FlagsGet (void )
Retrieves the interrupt flag status.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
uint8_t:
|
TCE0_LockUpdateClear()
void TCE0_LockUpdateClear (void )
Clears the Lock Update bit for the TCE0. This ensures that the buffered registers are updated when an UPDATE condition has occurred.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_LockUpdateSet()
void TCE0_LockUpdateSet (void )
Sets the Lock Update (LUPD) bit for the TCE0 to 1. This ensures there will be no update on the buffered registers.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_ModeSet()
void TCE0_ModeSet (TCE_WGMODE_t mode)
Sets the Wave mode for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
TCE_WGMODE_t |
mode:
|
None. |
TCE0_OffsetGet()
uint16_t TCE0_OffsetGet (void )
Returns the value of the OFFSET register of the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
uint16_t - Value in the OFFSET register. |
TCE0_OffsetSet()
void TCE0_OffsetSet (uint16_t value)
Sets the OFFSET register of the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
- Value to be written in the OFFSET register. |
None. |
TCE0_OutputsEnable()
void TCE0_OutputsEnable (uint8_t value)
Enables the Waveform outputs for the four TCE0 channels.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint8_t |
- Bitmask value to enable the corresponding Compare Enable (CMPEN) bits in the Control B (CTRLB) register. |
None. |
TCE0_OutputsValueGet()
uint8_t TCE0_OutputsValueGet (void )
Returns the values of the polarities and outputs for the four TCE0 channels.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
uint8_t - The bits from 7 to 4 indicate the normal/inverted status of the polarities for channels 3 to 0. The bits from 0 to 3 indicate the set/clear status of the waveform output value for the channels from 3 to 0. |
TCE0_OutputsValueSet()
void TCE0_OutputsValueSet (uint8_t value)
Sets the output values for the four TCE0 channels.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint8_t |
- Bitmask corresponding to the channel that requires enabling or polarity inversion. |
None. |
TCE0_OverflowCallbackRegister()
void TCE0_OverflowCallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 overflow callback.
None. |
CallbackHandler |
- Pointer to custom callback. |
None. |
TCE0_PeriodBufferSet()
void TCE0_PeriodBufferSet (uint16_t value)
Sets the value of the Period Buffer (PERBUF) register that serves as the buffer for the period register TCE0.PER.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
- Value to be written in the PERBUF register. |
None. |
TCE0_PeriodSet()
void TCE0_PeriodSet (uint16_t period)
Sets the Period (PER) register for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
- Value to be written in the PER register. |
None. |
TCE0_PrescalerSet()
void TCE0_PrescalerSet (TCE_CLKSEL_t prescaler)
Selects the prescaler for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
TCE_CLKSEL_t |
prescaler
|
None. |
TCE0_PWM_BufferedDutyCycle0Set()
void TCE0_PWM_BufferedDutyCycle0Set (uint16_t value)
Sets the value of the CMP0BUF register used in the Pulse-Width Modulation (PWM) mode by the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value - Value to be written in the CMP0BUF register. |
None. |
TCE0_PWM_BufferedDutyCycle1Set()
void TCE0_PWM_BufferedDutyCycle1Set (uint16_t value)
Sets the value of the CMP1BUF register used in PWM mode by the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value - Value to be written in the CMP1BUF register. |
None. |
TCE0_PWM_BufferedDutyCycle2Set()
void TCE0_PWM_BufferedDutyCycle2Set (uint16_t value)
Sets the value of the CMP2BUF register used in PWM mode by the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value - Value to be written in the CMP2BUF register. |
None. |
TCE0_PWM_BufferedDutyCycle3Set()
void TCE0_PWM_BufferedDutyCycle3Set (uint16_t value)
Sets the value of the CMP3BUF register used in PWM mode by the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
uint16_t |
value - Value to be written in the CMP3BUF register. |
None. |
TCE0_ScaleEnable()
void TCE0_ScaleEnable (bool state)
Allows for fractional values to be written to the Compare (CMP), Amplitude (AMP) and, Compare Buffer (CMPBUF) registers for TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
bool |
state:
|
None. |
TCE0_ScaleModeSet()
void TCE0_ScaleModeSet (TCE_SCALEMODE_t mode)
Sets the Scaling mode used for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
TCE_SCALEMODE_t |
mode:
|
None. |
TCE0_SoftwareCommand()
void TCE0_SoftwareCommand (TCE_CMD_t com)
Enables software control of the Update, Restart and Reset states of the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
TCE_CMD_t |
enum:
|
None. |
TCE0_StandBySleep()
void TCE0_StandBySleep (bool state)
Enables/disables the Run-in-Standby mode (RUNSTBY register) for the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
bool |
state:
|
None. |
TCE0_Start()
void TCE0_Start (void )
Starts the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
TCE0_StatusGet()
TCE0_status_t TCE0_StatusGet (void )
Returns the status of the TCE0 module.
None. |
enum TCE_status_t:
|
TCE0_Stop()
void TCE0_Stop (void )
Stops the TCE0.
Initialize the TCE0 with TCE0_Initialize() before calling this API. |
None. |
None. |
Enumeration Type Documentation
TCE0_status_t
enum TCE0_status_t
Lists the possible states of the TCE0.
-
TCE_STATUS_IDLE = 0 - The timer is not running
-
TCE_STATUS_RUNNING = 1 - The timer is running
TCE_STATUS_IDLE | |
TCE_STATUS_RUNNING |
Variable Documentation
TCE0_OVF_isr_cb
TCE0_cb_t TCE0_OVF_isr_cb = NULL[static]
Function pointers that store the callback addresses.
Section: Included files Section: TCE0 Private data
timerActive
volatile bool timerActive = false[static]
Boolean that is true when timer is active.
timerMode
volatile uint8_t timerMode = TCE_WGMODE_FRQ_gc[static]
8-bit variable that replicates TCE_WGMODE_t enum to reflect the active mode.
4.14.7.5 File Documentation
4.14.7.5.1 source/tce0.c File Reference
#include <avr/io.h> #include <avr/interrupt.h> #include <util/atomic.h> #include <stddef.h> #include "tce0.h"
Functions
ISR (TCE0_OVF_vect)
Interrupt Service Routine (ISR) for the overflow (OVF) interrupt.
ISR (TCE0_CMP0_vect)
ISR for the CMP0 interrupt.
ISR (TCE0_CMP1_vect)
ISR for the CMP1 interrupt.
ISR (TCE0_CMP2_vect)
ISR for the CMP2 interrupt.
ISR (TCE0_CMP3_vect)
ISR for the CMP3 interrupt.
void TCE0_OverflowCallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 overflow callback.
void TCE0_Compare0CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare0 callback.
void TCE0_Compare1CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare1 callback.
void TCE0_Compare2CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare2 callback.
void TCE0_Compare3CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare3 callback.
void TCE0_Initialize (void)
Initializes the TCE0 module. This routine must be called before other TCE0 APIs.
void TCE0_Deinitialize (void)
Deinitializes the TCE0 module.
void TCE0_Start (void)
Starts the TCE0.
void TCE0_Stop (void)
Stops the TCE0.
TCE0_status_t TCE0_StatusGet (void)
Returns the status of the TCE0 module.
void TCE0_ModeSet (TCE_WGMODE_t mode)
Sets the Wave mode for the TCE0.
void TCE0_Interrupts_Enable (uint8_t value)
Enables the TCE0 OVF, CMP0, CMP1, CMP2 or, CMP3 interrupts.
void TCE0_Interrupts_FlagsClear (uint8_t value)
Clears the interrupt flags for the TCE0.
uint8_t TCE0_Interrupts_FlagsGet (void)
Retrieves the interrupt flag status.
void TCE0_Interrupts_Disable (uint8_t value)
Disables the TCE0 OVF, CMP0, CMP1, CMP2 or, CMP3 interrupts.
void TCE0_Event_OutputMode (uint8_t value)
Controls the Waveform mode on the event output line for the TCE0.
void TCE0_Event_InputConfig (uint8_t value)
Enables the input event for the TCE0.
void TCE0_SoftwareCommand (TCE_CMD_t com)
Enables software control of the Update, Restart and Reset states of the TCE0.
void TCE0_StandBySleep (bool state)
Enables/disables the Run-in-Standby mode (RUNSTBY register) for the TCE0.
void TCE0_DebugRun (bool state)
Enables Debug mode for the TCE0.
uint16_t TCE0_CounterGet (void)
Returns the Count (CNT) register value for the TCE0.
void TCE0_CounterSet (uint16_t value)
Sets the Count (CNT) register value for the TCE0.
void TCE0_PrescalerSet (TCE_CLKSEL_t prescaler)
Selects the prescaler for the TCE0.
void TCE0_Compare0Set (uint16_t value)
Sets the Compare 0 (CMP0) register value for the TCE0.
void TCE0_Compare1Set (uint16_t value)
Sets the Compare 1 (CMP1) register value for the TCE0.
void TCE0_Compare2Set (uint16_t value)
Sets the Compare 2 (CMP2) register value for the TCE0.
void TCE0_Compare3Set (uint16_t value)
Sets the Compare 3 (CMP3) register value for the TCE0.
void TCE0_CompareAllChannelsSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all four CMP registers for the TCE0.
void TCE0_CompareChannels012Set (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the CMP0, CMP1 and, CMP2 registers for the TCE0.
void TCE0_CompareChannels123Set (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the CMP1, CMP2, and CMP3 registers for the TCE.
void TCE0_CompareAllChannelsBufferedSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all four Compare Buffer (CMPBUF) registers for the TCE0.
void TCE0_CompareChannels012BufferedSet (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare 0 Buffer (CMP0BUF), Compare 1 Buffer (CMP1BUF) and, Compare 2 Buffer (CMP2BUF) registers for the TCE0.
void TCE0_CompareChannels123BufferedSet (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare 1 Buffer (CMP1BUF), Compare 2 Buffer (CMP2BUF) and, Compare 3 Buffer (CMP3BUF) registers for the TCE0.
void TCE0_OutputsEnable (uint8_t value)
Enables the Waveform outputs for the four TCE0 channels.
void TCE0_OutputsValueSet (uint8_t value)
Sets the output values for the four TCE0 channels.
uint8_t TCE0_OutputsValueGet (void)
Returns the values of the polarities and outputs for the four TCE0 channels.
void TCE0_HighResSet (TCE_HREN_t res)
Sets the high resolution used for the TCE0.
void TCE0_ScaleModeSet (TCE_SCALEMODE_t mode)
Sets the Scaling mode used for the TCE0.
void TCE0_ScaleEnable (bool state)
Allows for fractional values to be written to the Compare (CMP), Amplitude (AMP) and, Compare Buffer (CMPBUF) registers for TCE0.
void TCE0_AmplitudeControlEnable (bool state)
Allows the use of the AMP and OFFSET registers for the TCE0.
void TCE0_AmplitudeSet (uint16_t value)
Sets the AMP register of the TCE0.
uint16_t TCE0_AmplitudeGet (void)
Returns the value of the AMP register of the TCE0.
void TCE0_OffsetSet (uint16_t value)
Sets the OFFSET register of the TCE0.
uint16_t TCE0_OffsetGet (void)
Returns the value of the OFFSET register of the TCE0.
void TCE0_PeriodSet (uint16_t period)
Sets the Period (PER) register for the TCE0.
void TCE0_CountDirectionSet (void)
Sets the TCE0 to count UP.
void TCE0_CountDirectionClear (void)
Sets the TCE0 to count DOWN.
void TCE0_LockUpdateSet (void)
Sets the Lock Update (LUPD) bit for the TCE0 to 1. This ensures there will be no update on the buffered registers.
void TCE0_LockUpdateClear (void)
Clears the Lock Update bit for the TCE0. This ensures that the buffered registers are updated when an UPDATE condition has occurred.
void TCE0_AutoLockUpdateSet (void)
Sets the Auto-Lock Update (ALUPD) bit for the TCE0 to 1. This ensures that the Lock Update (LUPD) bit in the TCEn.CTRLE register is set and cleared automatically.
void TCE0_AutoLockUpdateClear (void)
Clears the Auto-Lock Update bit for the TCE0. This ensures that the LUPD bit in the TCEn.CTRLE register is not altered by the system.
void TCE0_PWM_BufferedDutyCycle0Set (uint16_t value)
Sets the value of the CMP0BUF register used in the Pulse-Width Modulation (PWM) mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle1Set (uint16_t value)
Sets the value of the CMP1BUF register used in PWM mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle2Set (uint16_t value)
Sets the value of the CMP2BUF register used in PWM mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle3Set (uint16_t value)
Sets the value of the CMP3BUF register used in PWM mode by the TCE0.
void TCE0_PeriodBufferSet (uint16_t value)
Sets the value of the Period Buffer (PERBUF) register that serves as the buffer for the period register TCE0.PER.
Variables
static TCE0_cb_t TCE0_OVF_isr_cb = NULL
Function pointers that store the callback addresses.
static TCE0_cb_t TCE0_CMP0_isr_cb = NULL
static TCE0_cb_t TCE0_CMP1_isr_cb = NULL
static TCE0_cb_t TCE0_CMP2_isr_cb = NULL
static TCE0_cb_t TCE0_CMP3_isr_cb = NULL
static volatile bool timerActive = false
Boolean that is true when timer is active.
static volatile uint8_t timerMode = TCE_WGMODE_FRQ_gc
8-bit variable that replicates TCE_WGMODE_t enum to reflect the active mode.
Variable Documentation
TCE0_CMP0_isr_cb
TCE0_cb_t TCE0_CMP0_isr_cb = NULL[static]
TCE0_CMP1_isr_cb
TCE0_cb_t TCE0_CMP1_isr_cb = NULL[static]
TCE0_CMP2_isr_cb
TCE0_cb_t TCE0_CMP2_isr_cb = NULL[static]
TCE0_CMP3_isr_cb
TCE0_cb_t TCE0_CMP3_isr_cb = NULL[static]
4.14.7.5.2 source/tce0.h File Reference
#include <stdbool.h> #include <stdint.h> #include <avr/io.h>
Functions
void TCE0_OverflowCallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 overflow callback.
void TCE0_Compare0CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare0 callback.
void TCE0_Compare1CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare1 callback.
void TCE0_Compare2CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare2 callback.
void TCE0_Compare3CallbackRegister (TCE0_cb_t cb)
Setter function for the TCE0 Capture-Compare3 callback.
void TCE0_Initialize (void)
Initializes the TCE0 module. This routine must be called before other TCE0 APIs.
void TCE0_Deinitialize (void)
Deinitializes the TCE0 module.
void TCE0_Start (void)
Starts the TCE0.
void TCE0_Stop (void)
Stops the TCE0.
TCE0_status_t TCE0_StatusGet (void)
Returns the status of the TCE0 module.
void TCE0_ModeSet (TCE_WGMODE_t mode)
Sets the Wave mode for the TCE0.
void TCE0_Interrupts_Enable (uint8_t value)
Enables the TCE0 OVF, CMP0, CMP1, CMP2 or, CMP3 interrupts.
void TCE0_Interrupts_FlagsClear (uint8_t value)
Clears the interrupt flags for the TCE0.
uint8_t TCE0_Interrupts_FlagsGet (void)
Retrieves the interrupt flag status.
void TCE0_Interrupts_Disable (uint8_t value)
Disables the TCE0 OVF, CMP0, CMP1, CMP2 or, CMP3 interrupts.
void TCE0_Event_OutputMode (uint8_t value)
Controls the Waveform mode on the event output line for the TCE0.
void TCE0_Event_InputConfig (uint8_t value)
Enables the input event for the TCE0.
void TCE0_SoftwareCommand (TCE_CMD_t com)
Enables software control of the Update, Restart and Reset states of the TCE0.
void TCE0_StandBySleep (bool state)
Enables/disables the Run-in-Standby mode (RUNSTBY register) for the TCE0.
void TCE0_DebugRun (bool state)
Enables Debug mode for the TCE0.
uint16_t TCE0_CounterGet (void)
Returns the Count (CNT) register value for the TCE0.
void TCE0_CounterSet (uint16_t value)
Sets the Count (CNT) register value for the TCE0.
void TCE0_PrescalerSet (TCE_CLKSEL_t prescaler)
Selects the prescaler for the TCE0.
void TCE0_Compare0Set (uint16_t value)
Sets the Compare 0 (CMP0) register value for the TCE0.
void TCE0_Compare1Set (uint16_t value)
Sets the Compare 1 (CMP1) register value for the TCE0.
void TCE0_Compare2Set (uint16_t value)
Sets the Compare 2 (CMP2) register value for the TCE0.
void TCE0_Compare3Set (uint16_t value)
Sets the Compare 3 (CMP3) register value for the TCE0.
void TCE0_CompareAllChannelsSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all four CMP registers for the TCE0.
void TCE0_CompareChannels012Set (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the CMP0, CMP1 and, CMP2 registers for the TCE0.
void TCE0_CompareChannels123Set (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the CMP1, CMP2, and CMP3 registers for the TCE.
void TCE0_CompareAllChannelsBufferedSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all four Compare Buffer (CMPBUF) registers for the TCE0.
void TCE0_CompareChannels012BufferedSet (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare 0 Buffer (CMP0BUF), Compare 1 Buffer (CMP1BUF) and, Compare 2 Buffer (CMP2BUF) registers for the TCE0.
void TCE0_CompareChannels123BufferedSet (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare 1 Buffer (CMP1BUF), Compare 2 Buffer (CMP2BUF) and, Compare 3 Buffer (CMP3BUF) registers for the TCE0.
void TCE0_OutputsEnable (uint8_t value)
Enables the Waveform outputs for the four TCE0 channels.
void TCE0_OutputsValueSet (uint8_t value)
Sets the output values for the four TCE0 channels.
uint8_t TCE0_OutputsValueGet (void)
Returns the values of the polarities and outputs for the four TCE0 channels.
void TCE0_HighResSet (TCE_HREN_t resolution)
Sets the high resolution used for the TCE0.
void TCE0_ScaleModeSet (TCE_SCALEMODE_t mode)
Sets the Scaling mode used for the TCE0.
void TCE0_ScaleEnable (bool state)
Allows for fractional values to be written to the Compare (CMP), Amplitude (AMP) and, Compare Buffer (CMPBUF) registers for TCE0.
void TCE0_AmplitudeControlEnable (bool state)
Allows the use of the AMP and OFFSET registers for the TCE0.
void TCE0_AmplitudeSet (uint16_t value)
Sets the AMP register of the TCE0.
uint16_t TCE0_AmplitudeGet (void)
Returns the value of the AMP register of the TCE0.
void TCE0_OffsetSet (uint16_t value)
Sets the OFFSET register of the TCE0.
uint16_t TCE0_OffsetGet (void)
Returns the value of the OFFSET register of the TCE0.
void TCE0_PeriodSet (uint16_t period)
Sets the Period (PER) register for the TCE0.
void TCE0_CountDirectionSet (void)
Sets the TCE0 to count UP.
void TCE0_CountDirectionClear (void)
Sets the TCE0 to count DOWN.
void TCE0_LockUpdateSet (void)
Sets the Lock Update (LUPD) bit for the TCE0 to 1. This ensures there will be no update on the buffered registers.
void TCE0_LockUpdateClear (void)
Clears the Lock Update bit for the TCE0. This ensures that the buffered registers are updated when an UPDATE condition has occurred.
void TCE0_AutoLockUpdateSet (void)
Sets the Auto-Lock Update (ALUPD) bit for the TCE0 to 1. This ensures that the Lock Update (LUPD) bit in the TCEn.CTRLE register is set and cleared automatically.
void TCE0_AutoLockUpdateClear (void)
Clears the Auto-Lock Update bit for the TCE0. This ensures that the LUPD bit in the TCEn.CTRLE register is not altered by the system.
void TCE0_PWM_BufferedDutyCycle0Set (uint16_t value)
Sets the value of the CMP0BUF register used in the Pulse-Width Modulation (PWM) mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle1Set (uint16_t value)
Sets the value of the CMP1BUF register used in PWM mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle2Set (uint16_t value)
Sets the value of the CMP2BUF register used in PWM mode by the TCE0.
void TCE0_PWM_BufferedDutyCycle3Set (uint16_t value)
Sets the value of the CMP3BUF register used in PWM mode by the TCE0.
void TCE0_PeriodBufferSet (uint16_t value)
Sets the value of the Period Buffer (PERBUF) register that serves as the buffer for the period register TCE0.PER.
Macros
#define TCE0_PER_US_TO_TICKS(US, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from us(microseconds) to clock increments for setting the period.
#define TCE0_PER_MS_TO_TICKS(MS, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from ms(milliseconds) to clock increments for setting the period.
#define TCE0_PER_S_TO_TICKS(S, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE0_PRESCALER)) + 0.5) - 1
Defines the macro associated with the conversion from s(seconds) to clock increments for setting the period.
#define TCE0_CMP_US_TO_TICKS(US, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from us(microseconds) to clock increments for setting the compare registers.
#define TCE0_CMP_MS_TO_TICKS(MS, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from ms(milliseconds) to clock increments for setting the compare registers.
#define TCE0_CMP_S_TO_TICKS(S, F_CLOCK, TCE0_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE0_PRESCALER)) + 0.5)
Defines the macro associated with the conversion from s(seconds) to clock increments for setting the compare registers.
#define TCE0_HZ_TO_CLOCKS_FREQUENCYMODE(HZ, F_CLOCK, TCE0_PRESCALER) (uint16_t)((float)(F_CLOCK) / (2 * (float)(HZ) * (float)(TCE0_PRESCALER)) - 1)
Defines the macro associated with the conversion from Hz(Hertz) to clock increments. Used in Frequency mode.
Typedefs
typedef void(* TCE0_cb_t) (void)
Pointer to a function to be used as a callback handler when an overflow interrupt event occurs.
Enumerations
enum TCE0_status_t { TCE_STATUS_IDLE = 0, TCE_STATUS_RUNNING = 1 }
Lists the possible states of the TCE0.
Detailed Description
Timer/Counter E Embedded Driver API Header File