3.14.7 16-bit Timer/Counter E with PWM
16-bit PWM Timer/Counter type E (TCE) with scale hardware accelerator
3.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.
3.14.7.2 Supported Device Families
AVR® EB |
3.14.7.3 Required header files:
#include "mcc_generated_files/timer/tce[X].h"
3.14.7.4 Module Documentation
3.14.7.4.1 Timer/Counter Type E (TCE)
Module description
TCE0 Driver Version 1.0.1 |
© 2024 Microchip Technology Inc. and its subsidiaries. |
Subject to your compliance with these terms, you may use Microchip software and any derivatives exclusively with Microchip products. You're responsible for complying with 3rd party license terms applicable to your use of 3rd party software (including open source software) that may accompany Microchip software.
SOFTWARE IS "AS IS." NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
Typedefs
typedef void(* TCE0_cb_t) (void)
Pointer to a function to be used as a callback handler when an interrupt event occurs.
Definitions
#define TCE0_PER_US_TO_TICKS(US, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from microseconds to clock increments for setting the period.
#define TCE0_PER_MS_TO_TICKS(MS, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from milliseconds to clock increments for setting the period.
#define TCE0_PER_S_TO_TICKS(S, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from seconds to clock increments for setting the period.
#define TCE0_CMP_US_TO_TICKS(US, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from microseconds to clock increments for setting the compare registers.
#define TCE0_CMP_MS_TO_TICKS(MS, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from milliseconds to clock increments for setting the compare registers.
#define TCE0_CMP_S_TO_TICKS(S, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from seconds to clock increments for setting the compare registers.
#define TCE0_HZ_TO_CLOCKS_FREQUENCYMODE(HZ, F_CLOCK, TCE_PRESCALER) (uint16_t)((float)(F_CLOCK) / (2 * (float)(HZ) * (float)(TCE_PRESCALER)) - 1)
Converts from hertz to clock increments.
Enumerations
enum TCE0_status_t { TCE_STATUS_IDLE = 0, TCE_STATUS_RUNNING = 1 }
Lists the possible states of the TCE0 module.
Functions
-
Interrupt Service Routine (ISR) for the Overflow (OVF) interrupt.
-
Interrupt Service Routine (ISR) for the Compare Channel 0 (CMP0) interrupt.
-
Interrupt Service Routine (ISR) for the Compare Channel 1 (CMP1) interrupt.
-
Interrupt Service Routine (ISR) for the Compare Channel 2 (CMP2) interrupt.
-
Interrupt Service Routine (ISR) for the Compare Channel 3 (CMP3) interrupt.
void TCE0_OverflowCallbackRegister (TCE0_cb_t callback)
Sets the Overflow (OVF) interrupt callback for the TCE0 module.
void TCE0_Compare0CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 0 (CMP0) interrupt callback for the TCE0 module.
void TCE0_Compare1CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 1 (CMP1) interrupt callback for the TCE0 module.
void TCE0_Compare2CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 2 (CMP2) interrupt callback for the TCE0 module.
void TCE0_Compare3CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 3 (CMP3) interrupt callback for the TCE0 module.
void TCE0_Initialize (void)
Initializes the TCE0 module.
void TCE0_Deinitialize (void)
Deinitializes the TCE0 module.
void TCE0_Start (void)
Starts the TCE0 module.
void TCE0_Stop (void)
Stops the TCE0 module.
TCE0_status_t TCE0_StatusGet (void)
Returns the status of the TCE0 module.
void TCE0_ModeSet (TCE_WGMODE_t mode)
Sets the Waveform Generation mode for the TCE0 module.
void TCE0_Interrupts_Enable (uint8_t interrupts)
Enables the OVF, CMP0, CMP1, CMP2, or CMP3 interrupts of the TCE0 module.
void TCE0_Interrupts_FlagsClear (uint8_t interrupts)
Clears the OVF, CMP0, CMP1, CMP2, or CMP3 interrupt flags of the TCE0 module.
uint8_t TCE0_Interrupts_FlagsGet (void)
Returns the OVF, CMP0, CMP1, CMP2, or CMP3 interrupt flags of the TCE0 module.
void TCE0_Interrupts_Disable (uint8_t interrupts)
Disables the OVF, CMP0, CMP1, CMP2, or CMP3 interrupts of the TCE0 module.
void TCE0_Event_OutputMode (uint8_t mode)
Sets the event output mode to Pulse or Waveform.
void TCE0_Event_InputConfig (uint8_t value)
Configures the input events for the TCE0 module.
void TCE0_SoftwareCommand (TCE_CMD_t command)
Sends a software command to the TCE0 module.
void TCE0_StandBySleep (bool state)
Enables or disables the Run in Standby mode for the TCE0 module.
void TCE0_DebugRun (bool state)
Enables or disables the Run in Debug mode for the TCE0 module.
uint16_t TCE0_CounterGet (void)
Returns the Counter register value for the TCE0 module.
void TCE0_CounterSet (uint16_t value)
Sets the Counter register value for the TCE0 module.
void TCE0_PrescalerSet (TCE_CLKSEL_t prescaler)
Sets the clock prescaler for the TCE0 module.
void TCE0_Compare0Set (uint16_t value)
Sets the Compare Channel 0 (CMP0) register value for the TCE0 module.
void TCE0_Compare1Set (uint16_t value)
Sets the Compare Channel 1 (CMP1) register value for the TCE0 module.
void TCE0_Compare2Set (uint16_t value)
Sets the Compare Channel 2 (CMP2) register value for the TCE0 module.
void TCE0_Compare3Set (uint16_t value)
Sets the Compare Channel 3 (CMP3) register value for the TCE0 module.
void TCE0_CompareAllChannelsSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all the Compare (CMPn) registers for the TCE0 module.
void TCE0_CompareChannels012Set (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare Channel 0 (CMP0), Compare Channel 1 (CMP1), and Compare Channel 2 (CMP2) registers for the TCE0 module.
void TCE0_CompareChannels123Set (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare Channel 1 (CMP1), Compare Channel 2 (CMP2), and Compare Channel 3 (CMP3) registers for the TCE0 module.
void TCE0_CompareAllChannelsBufferedSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all the Compare Buffer (CMPBUF) registers for the TCE0 module.
void TCE0_CompareChannels012BufferedSet (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare Buffer Channel 0 (CMP0BUF), Compare Buffer Channel 1 (CMP1BUF), and Compare Buffer Channel 2 (CMP2BUF) registers for the TCE0 module.
void TCE0_CompareChannels123BufferedSet (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare Buffer Channel 1 (CMP1BUF), Compare Buffer Channel 2 (CMP2BUF), and Compare Buffer Channel 3 (CMP3BUF) registers for the TCE0 module.
void TCE0_OutputsEnable (uint8_t value)
Enable the Waveform Outputs for the TCE0 module.
void TCE0_OutputsValueSet (uint8_t value)
Sets the Waveform Outputs for the TCE0 module.
uint8_t TCE0_OutputsValueGet (void)
Returns the Waveform Outputs value for the TCE0 module.
void TCE0_OutputPolaritySet (uint8_t value)
Sets the Waveform Outputs Polarity for the TCE0 module.
uint8_t TCE0_OutputPolarityGet (void)
Returns the Waveform Outputs Polarity for the TCE0 module.
void TCE0_HighResSet (TCE_HREN_t resolution)
Sets the High Resolution mode for the TCE0 module.
void TCE0_ScaleModeSet (TCE_SCALEMODE_t mode)
Sets the Scaling mode used for the TCE0 module.
void TCE0_ScaleEnable (bool state)
Enables or disables the Scaling for the TCE0 module.
void TCE0_AmplitudeControlEnable (bool state)
Enables or disables the Amplitude Control for the TCE0 module.
void TCE0_AmplitudeSet (uint16_t value)
Sets the Amplitude (AMP) register of the TCE0 module.
uint16_t TCE0_AmplitudeGet (void)
Returns the value of the Amplitude (AMP) register of the TCE0 module.
void TCE0_OffsetSet (uint16_t value)
Sets the Offset (OFFSET) register for the TCE0 module.
uint16_t TCE0_OffsetGet (void)
Returns the value of the Offset (OFFSET) register for the TCE0 module.
void TCE0_PeriodSet (uint16_t period)
Sets the Period (PER) register for the TCE0 module.
uint16_t TCE0_PeriodGet (void)
Returns the value of the Period (PER) register for the TCE0 module.
void TCE0_CountDirectionSet (void)
Sets the counting direction to UP for the TCE0 module.
void TCE0_CountDirectionClear (void)
Sets the counting direction to DOWN for the TCE0 module.
void TCE0_LockUpdateSet (void)
Sets the Lock Update (LUPD) bit for the TCE0 module.
void TCE0_LockUpdateClear (void)
Clears the Lock Update (LUPD) bit for the TCE0 module.
void TCE0_AutoLockUpdateSet (void)
Sets the Auto-Lock Update (ALUPD) bit for the TCE0 module.
void TCE0_AutoLockUpdateClear (void)
Clears the Auto-Lock Update (ALUPD) bit for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle0Set (uint16_t value)
Sets the Compare Buffer Channel 0 (CMP0BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle1Set (uint16_t value)
Sets the Compare Buffer Channel 1 (CMP1BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle2Set (uint16_t value)
Sets the Compare Buffer Channel 2 (CMP2BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle3Set (uint16_t value)
Sets the Compare Buffer Channel 3 (CMP3BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PeriodBufferSet (uint16_t value)
Sets the Persiod Buffer (PERBUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
uint16_t TCE0_MaxCountGet (void)
Returns the maximum counter value for the TCE0 module.
void TCE0_Tasks (void)
Runs the callback functions in Polling mode.
Variables
static TCE0_cb_t TCE0_OVF_isr_cb = NULL
Function pointer to the Overflow (OVF) interrupt callback function.
static TCE0_cb_t TCE0_CMP0_isr_cb = NULL
Function pointer to the Compare Channel 0 (CMP0) interrupt callback function.
static TCE0_cb_t TCE0_CMP1_isr_cb = NULL
Function pointer to the Compare Channel 1 (CMP1) interrupt callback function.
static TCE0_cb_t TCE0_CMP2_isr_cb = NULL
Function pointer to the Compare Channel 2 (CMP2) interrupt callback function.
static TCE0_cb_t TCE0_CMP3_isr_cb = NULL
Function pointer to the Compare Channel 3 (CMP3) interrupt callback function.
static volatile bool timerActive = false
Mirrors the CTRLA.ENABLE bit of the TCE0 module.
static volatile uint8_t timerMode = TCE_WGMODE_FRQ_gc
Mirrors the CTRLB.WGMODE bits of the TCE0 module.
Definition Documentation
TCE0_CMP_MS_TO_TICKS
#define TCE0_CMP_MS_TO_TICKS( MS, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from milliseconds to clock increments for setting the compare registers.
TCE0_CMP_S_TO_TICKS
#define TCE0_CMP_S_TO_TICKS( S, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from seconds to clock increments for setting the compare registers.
TCE0_CMP_US_TO_TICKS
#define TCE0_CMP_US_TO_TICKS( US, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from microseconds to clock increments for setting the compare registers.
TCE0_HZ_TO_CLOCKS_FREQUENCYMODE
#define TCE0_HZ_TO_CLOCKS_FREQUENCYMODE( HZ, F_CLOCK, TCE_PRESCALER) (uint16_t)((float)(F_CLOCK) / (2 * (float)(HZ) * (float)(TCE_PRESCALER)) - 1)
Converts from hertz to clock increments.
Used in Frequency mode.
TCE0_PER_MS_TO_TICKS
#define TCE0_PER_MS_TO_TICKS( MS, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from milliseconds to clock increments for setting the period.
TCE0_PER_S_TO_TICKS
#define TCE0_PER_S_TO_TICKS( S, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from seconds to clock increments for setting the period.
TCE0_PER_US_TO_TICKS
#define TCE0_PER_US_TO_TICKS( US, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from 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 interrupt event occurs.
Function Documentation
ISR(TCE0_CMP0_vect)
ISR(TCE0_CMP0_vect)
Interrupt Service Routine (ISR) for the Compare Channel 0 (CMP0) interrupt.
None. |
None. |
ISR(TCE0_CMP1_vect)
ISR(TCE0_CMP1_vect)
Interrupt Service Routine (ISR) for the Compare Channel 1 (CMP1) interrupt.
None. |
None. |
ISR(TCE0_CMP2_vect)
ISR(TCE0_CMP2_vect)
Interrupt Service Routine (ISR) for the Compare Channel 2 (CMP2) interrupt.
None. |
None. |
ISR(TCE0_CMP3_vect)
ISR(TCE0_CMP3_vect)
Interrupt Service Routine (ISR) for the Compare Channel 3 (CMP3) interrupt.
None. |
None. |
ISR(TCE0_OVF_vect)
ISR(TCE0_OVF_vect)
Interrupt Service Routine (ISR) for the Overflow (OVF) interrupt.
None. |
None. |
TCE0_AmplitudeControlEnable()
void TCE0_AmplitudeControlEnable (bool state)
Enables or disables the Amplitude Control for the TCE0 module.
in | state |
Enable or disable:
|
None. |
TCE0_AmplitudeGet()
uint16_t TCE0_AmplitudeGet (void )
Returns the value of the Amplitude (AMP) register of the TCE0 module.
None. |
Amplitude value |
TCE0_AmplitudeSet()
void TCE0_AmplitudeSet (uint16_t value)
Sets the Amplitude (AMP) register of the TCE0 module.
in | value |
Amplitude value |
None. |
TCE0_AutoLockUpdateClear()
void TCE0_AutoLockUpdateClear (void )
Clears the Auto-Lock Update (ALUPD) bit for the TCE0 module.
None. |
None. |
TCE0_AutoLockUpdateSet()
void TCE0_AutoLockUpdateSet (void )
Sets the Auto-Lock Update (ALUPD) bit for the TCE0 module.
None. |
None. |
TCE0_Compare0CallbackRegister()
void TCE0_Compare0CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 0 (CMP0) interrupt callback for the TCE0 module.
in | callback |
Pointer to custom callback |
None. |
TCE0_Compare0Set()
void TCE0_Compare0Set (uint16_t value)
Sets the Compare Channel 0 (CMP0) register value for the TCE0 module.
in | value |
Compare Channel 0 value |
None. |
TCE0_Compare1CallbackRegister()
void TCE0_Compare1CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 1 (CMP1) interrupt callback for the TCE0 module.
in | callback |
Pointer to custom callback |
None. |
TCE0_Compare1Set()
void TCE0_Compare1Set (uint16_t value)
Sets the Compare Channel 1 (CMP1) register value for the TCE0 module.
in | value |
Compare Channel 1 value |
None. |
TCE0_Compare2CallbackRegister()
void TCE0_Compare2CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 2 (CMP2) interrupt callback for the TCE0 module.
in | callback |
Pointer to custom callback |
None. |
TCE0_Compare2Set()
void TCE0_Compare2Set (uint16_t value)
Sets the Compare Channel 2 (CMP2) register value for the TCE0 module.
in | value |
Compare Channel 2 value |
None. |
TCE0_Compare3CallbackRegister()
void TCE0_Compare3CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 3 (CMP3) interrupt callback for the TCE0 module.
in | callback |
Pointer to custom callback |
None. |
TCE0_Compare3Set()
void TCE0_Compare3Set (uint16_t value)
Sets the Compare Channel 3 (CMP3) register value for the TCE0 module.
in | value |
Compare Channel 3 value |
None. |
TCE0_CompareAllChannelsBufferedSet()
void TCE0_CompareAllChannelsBufferedSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all the Compare Buffer (CMPBUF) registers for the TCE0 module.
in | value0 |
Compare Buffer Channel 0 value |
in | value1 |
Compare Buffer Channel 1 value |
in | value2 |
Compare Buffer Channel 2 value |
in | value3 |
Compare Buffer Channel 3 value |
None. |
TCE0_CompareAllChannelsSet()
void TCE0_CompareAllChannelsSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all the Compare (CMPn) registers for the TCE0 module.
in | value0 |
Compare Channel 0 value |
in | value1 |
Compare Channel 1 value |
in | value2 |
Compare Channel 2 value |
in | value3 |
Compare Channel 3 value |
None. |
TCE0_CompareChannels012BufferedSet()
void TCE0_CompareChannels012BufferedSet (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare Buffer Channel 0 (CMP0BUF), Compare Buffer Channel 1 (CMP1BUF), and Compare Buffer Channel 2 (CMP2BUF) registers for the TCE0 module.
in | value0 |
Compare Buffer Channel 0 value |
in | value1 |
Compare Buffer Channel 1 value |
in | value2 |
Compare Buffer Channel 2 value |
None. |
TCE0_CompareChannels012Set()
void TCE0_CompareChannels012Set (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare Channel 0 (CMP0), Compare Channel 1 (CMP1), and Compare Channel 2 (CMP2) registers for the TCE0 module.
in | value0 |
Compare Channel 0 value |
in | value1 |
Compare Channel 1 value |
in | value2 |
Compare Channel 2 value |
None. |
TCE0_CompareChannels123BufferedSet()
void TCE0_CompareChannels123BufferedSet (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare Buffer Channel 1 (CMP1BUF), Compare Buffer Channel 2 (CMP2BUF), and Compare Buffer Channel 3 (CMP3BUF) registers for the TCE0 module.
in | value1 |
Compare Buffer Channel 1 value |
in | value2 |
Compare Buffer Channel 2 value |
in | value3 |
Compare Buffer Channel 3 value |
None. |
TCE0_CompareChannels123Set()
void TCE0_CompareChannels123Set (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare Channel 1 (CMP1), Compare Channel 2 (CMP2), and Compare Channel 3 (CMP3) registers for the TCE0 module.
in | value1 |
Compare Channel 1 value |
in | value2 |
Compare Channel 2 value |
in | value3 |
Compare Channel 3 value |
None. |
TCE0_CountDirectionClear()
void TCE0_CountDirectionClear (void )
Sets the counting direction to DOWN for the TCE0 module.
None. |
None. |
TCE0_CountDirectionSet()
void TCE0_CountDirectionSet (void )
Sets the counting direction to UP for the TCE0 module.
None. |
None. |
TCE0_CounterGet()
uint16_t TCE0_CounterGet (void )
Returns the Counter register value for the TCE0 module.
None. |
Counter value |
TCE0_CounterSet()
void TCE0_CounterSet (uint16_t value)
Sets the Counter register value for the TCE0 module.
in | value |
Counter value |
None. |
TCE0_DebugRun()
void TCE0_DebugRun (bool state)
Enables or disables the Run in Debug mode for the TCE0 module.
in | state |
Enable or disable:
|
None. |
TCE0_Deinitialize()
void TCE0_Deinitialize (void )
Deinitializes the TCE0 module.
None. |
None. |
TCE0_Event_InputConfig()
void TCE0_Event_InputConfig (uint8_t value)
Configures the input events for the TCE0 module.
in | value |
Input events configuration |
None. |
TCE0_Event_OutputMode()
void TCE0_Event_OutputMode (uint8_t mode)
Sets the event output mode to Pulse or Waveform.
in | mode |
Output mode |
None. |
TCE0_HighResSet()
void TCE0_HighResSet (TCE_HREN_t resolution)
Sets the High Resolution mode for the TCE0 module.
in | resolution |
Resolution:
|
None. |
TCE0_Initialize()
void TCE0_Initialize (void )
Initializes the TCE0 module.
This routine must be called before any other TCE0 APIs.
None. |
None. |
TCE0_Interrupts_Disable()
void TCE0_Interrupts_Disable (uint8_t interrupts)
Disables the OVF, CMP0, CMP1, CMP2, or CMP3 interrupts of the TCE0 module.
in | interrupts |
Interrupt(s) to be disabled. |
None. |
TCE0_Interrupts_Enable()
void TCE0_Interrupts_Enable (uint8_t interrupts)
Enables the OVF, CMP0, CMP1, CMP2, or CMP3 interrupts of the TCE0 module.
in | interrupts |
Interrupt(s) to be enabled |
None. |
TCE0_Interrupts_FlagsClear()
void TCE0_Interrupts_FlagsClear (uint8_t interrupts)
Clears the OVF, CMP0, CMP1, CMP2, or CMP3 interrupt flags of the TCE0 module.
in | interrupts |
Interrupt(s) flags to be cleared |
None. |
TCE0_Interrupts_FlagsGet()
uint8_t TCE0_Interrupts_FlagsGet (void )
Returns the OVF, CMP0, CMP1, CMP2, or CMP3 interrupt flags of the TCE0 module.
None. |
Interrupt flag status:
|
TCE0_LockUpdateClear()
void TCE0_LockUpdateClear (void )
Clears the Lock Update (LUPD) bit for the TCE0 module.
None. |
None. |
TCE0_LockUpdateSet()
void TCE0_LockUpdateSet (void )
Sets the Lock Update (LUPD) bit for the TCE0 module.
None. |
None. |
TCE0_MaxCountGet()
uint16_t TCE0_MaxCountGet (void )
Returns the maximum counter value for the TCE0 module.
None. |
Maximum counter value |
TCE0_ModeSet()
void TCE0_ModeSet (TCE_WGMODE_t mode)
Sets the Waveform Generation mode for the TCE0 module.
in | mode |
Operation mode:
|
None. |
TCE0_OffsetGet()
uint16_t TCE0_OffsetGet (void )
Returns the value of the Offset (OFFSET) register for the TCE0 module.
None. |
Offset value |
TCE0_OffsetSet()
void TCE0_OffsetSet (uint16_t value)
Sets the Offset (OFFSET) register for the TCE0 module.
in | value |
Offset value |
None. |
TCE0_OutputPolarityGet()
uint8_t TCE0_OutputPolarityGet (void )
Returns the Waveform Outputs Polarity for the TCE0 module.
None. |
Waveform Outputs Polarity:
|
TCE0_OutputPolaritySet()
void TCE0_OutputPolaritySet (uint8_t value)
Sets the Waveform Outputs Polarity for the TCE0 module.
in | value |
Bitmask value for the channels |
None. |
TCE0_OutputsEnable()
void TCE0_OutputsEnable (uint8_t value)
Enable the Waveform Outputs for the TCE0 module.
in | value |
Bitmask value for the channels |
None. |
TCE0_OutputsValueGet()
uint8_t TCE0_OutputsValueGet (void )
Returns the Waveform Outputs value for the TCE0 module.
None. |
Waveform Outputs Value:
|
TCE0_OutputsValueSet()
void TCE0_OutputsValueSet (uint8_t value)
Sets the Waveform Outputs for the TCE0 module.
in | value |
Bitmask value for the channels |
None. |
TCE0_OverflowCallbackRegister()
void TCE0_OverflowCallbackRegister (TCE0_cb_t callback)
Sets the Overflow (OVF) interrupt callback for the TCE0 module.
in | callback |
Pointer to custom callback |
None. |
TCE0_PeriodBufferSet()
void TCE0_PeriodBufferSet (uint16_t value)
Sets the Persiod Buffer (PERBUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
in | value |
Period buffer value |
None. |
TCE0_PeriodGet()
uint16_t TCE0_PeriodGet (void )
Returns the value of the Period (PER) register for the TCE0 module.
None. |
Period value |
TCE0_PeriodSet()
void TCE0_PeriodSet (uint16_t period)
Sets the Period (PER) register for the TCE0 module.
in | period |
Period value |
None. |
TCE0_PrescalerSet()
void TCE0_PrescalerSet (TCE_CLKSEL_t prescaler)
Sets the clock prescaler for the TCE0 module.
in | prescaler |
Clock prescaler
|
None. |
TCE0_PWM_BufferedDutyCycle0Set()
void TCE0_PWM_BufferedDutyCycle0Set (uint16_t value)
Sets the Compare Buffer Channel 0 (CMP0BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
in | value |
Compare Buffer Channel 0 value |
None. |
TCE0_PWM_BufferedDutyCycle1Set()
void TCE0_PWM_BufferedDutyCycle1Set (uint16_t value)
Sets the Compare Buffer Channel 1 (CMP1BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
in | value |
Compare Buffer Channel 1 value |
None. |
TCE0_PWM_BufferedDutyCycle2Set()
void TCE0_PWM_BufferedDutyCycle2Set (uint16_t value)
Sets the Compare Buffer Channel 2 (CMP2BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
in | value |
Compare Buffer Channel 2 value |
None. |
TCE0_PWM_BufferedDutyCycle3Set()
void TCE0_PWM_BufferedDutyCycle3Set (uint16_t value)
Sets the Compare Buffer Channel 3 (CMP3BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
in | value |
Compare Buffer Channel 3 value |
None. |
TCE0_ScaleEnable()
void TCE0_ScaleEnable (bool state)
Enables or disables the Scaling for the TCE0 module.
in | state |
Enable or disable:
|
None. |
TCE0_ScaleModeSet()
void TCE0_ScaleModeSet (TCE_SCALEMODE_t mode)
Sets the Scaling mode used for the TCE0 module.
in | mode |
Scale mode:
|
None. |
TCE0_SoftwareCommand()
void TCE0_SoftwareCommand (TCE_CMD_t command)
Sends a software command to the TCE0 module.
in | command |
Software command.
|
None. |
TCE0_StandBySleep()
void TCE0_StandBySleep (bool state)
Enables or disables the Run in Standby mode for the TCE0 module.
in | state |
Enable or disable:
|
None. |
TCE0_Start()
void TCE0_Start (void )
Starts the TCE0 module.
None. |
None. |
TCE0_StatusGet()
TCE0_status_t TCE0_StatusGet (void )
Returns the status of the TCE0 module.
None. |
Status of the TCE0 module |
TCE_STATUS_IDLE |
The timer is not running |
TCE_STATUS_RUNNING |
The timer is running |
TCE0_Stop()
void TCE0_Stop (void )
Stops the TCE0 module.
None. |
None. |
TCE0_Tasks()
void TCE0_Tasks (void )
Runs the callback functions in Polling mode.
None. |
None. |
Enumeration Type Documentation
TCE0_status_t
enum TCE0_status_t
Lists the possible states of the TCE0 module.
TCE_STATUS_IDLE |
The timer is not running |
TCE_STATUS_RUNNING |
The timer is running |
Variable Documentation
TCE0_CMP0_isr_cb
TCE0_cb_t TCE0_CMP0_isr_cb = NULL[static]
Function pointer to the Compare Channel 0 (CMP0) interrupt callback function.
TCE0_CMP1_isr_cb
TCE0_cb_t TCE0_CMP1_isr_cb = NULL[static]
Function pointer to the Compare Channel 1 (CMP1) interrupt callback function.
TCE0_CMP2_isr_cb
TCE0_cb_t TCE0_CMP2_isr_cb = NULL[static]
Function pointer to the Compare Channel 2 (CMP2) interrupt callback function.
TCE0_CMP3_isr_cb
TCE0_cb_t TCE0_CMP3_isr_cb = NULL[static]
Function pointer to the Compare Channel 3 (CMP3) interrupt callback function.
TCE0_OVF_isr_cb
TCE0_cb_t TCE0_OVF_isr_cb = NULL[static]
Function pointer to the Overflow (OVF) interrupt callback function.
timerActive
volatile bool timerActive = false[static]
Mirrors the CTRLA.ENABLE bit of the TCE0 module.
timerMode
volatile uint8_t timerMode = TCE_WGMODE_FRQ_gc[static]
Mirrors the CTRLB.WGMODE bits of the TCE0 module.
3.14.7.5 File Documentation
3.14.7.5.1 source/tce0.c File Reference
Timer/Counter Type E Driver API Source File.
#include "tce0.h" #include <stddef.h> #include <avr/interrupt.h> #include <util/atomic.h>
Functions
-
Interrupt Service Routine (ISR) for the Overflow (OVF) interrupt.
-
Interrupt Service Routine (ISR) for the Compare Channel 0 (CMP0) interrupt.
-
Interrupt Service Routine (ISR) for the Compare Channel 1 (CMP1) interrupt.
-
Interrupt Service Routine (ISR) for the Compare Channel 2 (CMP2) interrupt.
-
Interrupt Service Routine (ISR) for the Compare Channel 3 (CMP3) interrupt.
void TCE0_OverflowCallbackRegister (TCE0_cb_t callback)
Sets the Overflow (OVF) interrupt callback for the TCE0 module.
void TCE0_Compare0CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 0 (CMP0) interrupt callback for the TCE0 module.
void TCE0_Compare1CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 1 (CMP1) interrupt callback for the TCE0 module.
void TCE0_Compare2CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 2 (CMP2) interrupt callback for the TCE0 module.
void TCE0_Compare3CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 3 (CMP3) interrupt callback for the TCE0 module.
void TCE0_Initialize (void)
Initializes the TCE0 module.
void TCE0_Deinitialize (void)
Deinitializes the TCE0 module.
void TCE0_Start (void)
Starts the TCE0 module.
void TCE0_Stop (void)
Stops the TCE0 module.
TCE0_status_t TCE0_StatusGet (void)
Returns the status of the TCE0 module.
void TCE0_ModeSet (TCE_WGMODE_t mode)
Sets the Waveform Generation mode for the TCE0 module.
void TCE0_Interrupts_Enable (uint8_t interrupts)
Enables the OVF, CMP0, CMP1, CMP2, or CMP3 interrupts of the TCE0 module.
void TCE0_Interrupts_FlagsClear (uint8_t interrupts)
Clears the OVF, CMP0, CMP1, CMP2, or CMP3 interrupt flags of the TCE0 module.
uint8_t TCE0_Interrupts_FlagsGet (void)
Returns the OVF, CMP0, CMP1, CMP2, or CMP3 interrupt flags of the TCE0 module.
void TCE0_Interrupts_Disable (uint8_t interrupts)
Disables the OVF, CMP0, CMP1, CMP2, or CMP3 interrupts of the TCE0 module.
void TCE0_Event_OutputMode (uint8_t mode)
Sets the event output mode to Pulse or Waveform.
void TCE0_Event_InputConfig (uint8_t value)
Configures the input events for the TCE0 module.
void TCE0_SoftwareCommand (TCE_CMD_t command)
Sends a software command to the TCE0 module.
void TCE0_StandBySleep (bool state)
Enables or disables the Run in Standby mode for the TCE0 module.
void TCE0_DebugRun (bool state)
Enables or disables the Run in Debug mode for the TCE0 module.
uint16_t TCE0_CounterGet (void)
Returns the Counter register value for the TCE0 module.
void TCE0_CounterSet (uint16_t value)
Sets the Counter register value for the TCE0 module.
void TCE0_PrescalerSet (TCE_CLKSEL_t prescaler)
Sets the clock prescaler for the TCE0 module.
void TCE0_Compare0Set (uint16_t value)
Sets the Compare Channel 0 (CMP0) register value for the TCE0 module.
void TCE0_Compare1Set (uint16_t value)
Sets the Compare Channel 1 (CMP1) register value for the TCE0 module.
void TCE0_Compare2Set (uint16_t value)
Sets the Compare Channel 2 (CMP2) register value for the TCE0 module.
void TCE0_Compare3Set (uint16_t value)
Sets the Compare Channel 3 (CMP3) register value for the TCE0 module.
void TCE0_CompareAllChannelsSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all the Compare (CMPn) registers for the TCE0 module.
void TCE0_CompareChannels012Set (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare Channel 0 (CMP0), Compare Channel 1 (CMP1), and Compare Channel 2 (CMP2) registers for the TCE0 module.
void TCE0_CompareChannels123Set (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare Channel 1 (CMP1), Compare Channel 2 (CMP2), and Compare Channel 3 (CMP3) registers for the TCE0 module.
void TCE0_CompareAllChannelsBufferedSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all the Compare Buffer (CMPBUF) registers for the TCE0 module.
void TCE0_CompareChannels012BufferedSet (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare Buffer Channel 0 (CMP0BUF), Compare Buffer Channel 1 (CMP1BUF), and Compare Buffer Channel 2 (CMP2BUF) registers for the TCE0 module.
void TCE0_CompareChannels123BufferedSet (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare Buffer Channel 1 (CMP1BUF), Compare Buffer Channel 2 (CMP2BUF), and Compare Buffer Channel 3 (CMP3BUF) registers for the TCE0 module.
void TCE0_OutputsEnable (uint8_t value)
Enable the Waveform Outputs for the TCE0 module.
void TCE0_OutputsValueSet (uint8_t value)
Sets the Waveform Outputs for the TCE0 module.
uint8_t TCE0_OutputsValueGet (void)
Returns the Waveform Outputs value for the TCE0 module.
void TCE0_OutputPolaritySet (uint8_t value)
Sets the Waveform Outputs Polarity for the TCE0 module.
uint8_t TCE0_OutputPolarityGet (void)
Returns the Waveform Outputs Polarity for the TCE0 module.
void TCE0_HighResSet (TCE_HREN_t resolution)
Sets the High Resolution mode for the TCE0 module.
void TCE0_ScaleModeSet (TCE_SCALEMODE_t mode)
Sets the Scaling mode used for the TCE0 module.
void TCE0_ScaleEnable (bool state)
Enables or disables the Scaling for the TCE0 module.
void TCE0_AmplitudeControlEnable (bool state)
Enables or disables the Amplitude Control for the TCE0 module.
void TCE0_AmplitudeSet (uint16_t value)
Sets the Amplitude (AMP) register of the TCE0 module.
uint16_t TCE0_AmplitudeGet (void)
Returns the value of the Amplitude (AMP) register of the TCE0 module.
void TCE0_OffsetSet (uint16_t value)
Sets the Offset (OFFSET) register for the TCE0 module.
uint16_t TCE0_OffsetGet (void)
Returns the value of the Offset (OFFSET) register for the TCE0 module.
void TCE0_PeriodSet (uint16_t period)
Sets the Period (PER) register for the TCE0 module.
uint16_t TCE0_PeriodGet (void)
Returns the value of the Period (PER) register for the TCE0 module.
void TCE0_CountDirectionSet (void)
Sets the counting direction to UP for the TCE0 module.
void TCE0_CountDirectionClear (void)
Sets the counting direction to DOWN for the TCE0 module.
void TCE0_LockUpdateSet (void)
Sets the Lock Update (LUPD) bit for the TCE0 module.
void TCE0_LockUpdateClear (void)
Clears the Lock Update (LUPD) bit for the TCE0 module.
void TCE0_AutoLockUpdateSet (void)
Sets the Auto-Lock Update (ALUPD) bit for the TCE0 module.
void TCE0_AutoLockUpdateClear (void)
Clears the Auto-Lock Update (ALUPD) bit for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle0Set (uint16_t value)
Sets the Compare Buffer Channel 0 (CMP0BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle1Set (uint16_t value)
Sets the Compare Buffer Channel 1 (CMP1BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle2Set (uint16_t value)
Sets the Compare Buffer Channel 2 (CMP2BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle3Set (uint16_t value)
Sets the Compare Buffer Channel 3 (CMP3BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PeriodBufferSet (uint16_t value)
Sets the Persiod Buffer (PERBUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
uint16_t TCE0_MaxCountGet (void)
Returns the maximum counter value for the TCE0 module.
void TCE0_Tasks (void)
Runs the callback functions in Polling mode.
Variables
static TCE0_cb_t TCE0_OVF_isr_cb = NULL
Function pointer to the Overflow (OVF) interrupt callback function.
static TCE0_cb_t TCE0_CMP0_isr_cb = NULL
Function pointer to the Compare Channel 0 (CMP0) interrupt callback function.
static TCE0_cb_t TCE0_CMP1_isr_cb = NULL
Function pointer to the Compare Channel 1 (CMP1) interrupt callback function.
static TCE0_cb_t TCE0_CMP2_isr_cb = NULL
Function pointer to the Compare Channel 2 (CMP2) interrupt callback function.
static TCE0_cb_t TCE0_CMP3_isr_cb = NULL
Function pointer to the Compare Channel 3 (CMP3) interrupt callback function.
static volatile bool timerActive = false
Mirrors the CTRLA.ENABLE bit of the TCE0 module.
static volatile uint8_t timerMode = TCE_WGMODE_FRQ_gc
Mirrors the CTRLB.WGMODE bits of the TCE0 module.
Detailed Description
Timer/Counter Type E Driver API Source File.
TCE0 Driver Version 1.0.1 |
© 2024 Microchip Technology Inc. and its subsidiaries. |
Subject to your compliance with these terms, you may use Microchip software and any derivatives exclusively with Microchip products. You're responsible for complying with 3rd party license terms applicable to your use of 3rd party software (including open source software) that may accompany Microchip software.
SOFTWARE IS "AS IS." NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
3.14.7.5.2 source/tce0.h File Reference
Timer/Counter Type E Driver API Header File.
#include <stdbool.h> #include <stdint.h> #include <avr/io.h>
Functions
void TCE0_OverflowCallbackRegister (TCE0_cb_t callback)
Sets the Overflow (OVF) interrupt callback for the TCE0 module.
void TCE0_Compare0CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 0 (CMP0) interrupt callback for the TCE0 module.
void TCE0_Compare1CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 1 (CMP1) interrupt callback for the TCE0 module.
void TCE0_Compare2CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 2 (CMP2) interrupt callback for the TCE0 module.
void TCE0_Compare3CallbackRegister (TCE0_cb_t callback)
Sets the Compare Channel 3 (CMP3) interrupt callback for the TCE0 module.
void TCE0_Initialize (void)
Initializes the TCE0 module.
void TCE0_Deinitialize (void)
Deinitializes the TCE0 module.
void TCE0_Start (void)
Starts the TCE0 module.
void TCE0_Stop (void)
Stops the TCE0 module.
TCE0_status_t TCE0_StatusGet (void)
Returns the status of the TCE0 module.
void TCE0_ModeSet (TCE_WGMODE_t mode)
Sets the Waveform Generation mode for the TCE0 module.
void TCE0_Interrupts_Enable (uint8_t interrupts)
Enables the OVF, CMP0, CMP1, CMP2, or CMP3 interrupts of the TCE0 module.
void TCE0_Interrupts_FlagsClear (uint8_t interrupts)
Clears the OVF, CMP0, CMP1, CMP2, or CMP3 interrupt flags of the TCE0 module.
uint8_t TCE0_Interrupts_FlagsGet (void)
Returns the OVF, CMP0, CMP1, CMP2, or CMP3 interrupt flags of the TCE0 module.
void TCE0_Interrupts_Disable (uint8_t interrupts)
Disables the OVF, CMP0, CMP1, CMP2, or CMP3 interrupts of the TCE0 module.
void TCE0_Event_OutputMode (uint8_t mode)
Sets the event output mode to Pulse or Waveform.
void TCE0_Event_InputConfig (uint8_t value)
Configures the input events for the TCE0 module.
void TCE0_SoftwareCommand (TCE_CMD_t command)
Sends a software command to the TCE0 module.
void TCE0_StandBySleep (bool state)
Enables or disables the Run in Standby mode for the TCE0 module.
void TCE0_DebugRun (bool state)
Enables or disables the Run in Debug mode for the TCE0 module.
uint16_t TCE0_CounterGet (void)
Returns the Counter register value for the TCE0 module.
void TCE0_CounterSet (uint16_t value)
Sets the Counter register value for the TCE0 module.
void TCE0_PrescalerSet (TCE_CLKSEL_t prescaler)
Sets the clock prescaler for the TCE0 module.
void TCE0_Compare0Set (uint16_t value)
Sets the Compare Channel 0 (CMP0) register value for the TCE0 module.
void TCE0_Compare1Set (uint16_t value)
Sets the Compare Channel 1 (CMP1) register value for the TCE0 module.
void TCE0_Compare2Set (uint16_t value)
Sets the Compare Channel 2 (CMP2) register value for the TCE0 module.
void TCE0_Compare3Set (uint16_t value)
Sets the Compare Channel 3 (CMP3) register value for the TCE0 module.
void TCE0_CompareAllChannelsSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all the Compare (CMPn) registers for the TCE0 module.
void TCE0_CompareChannels012Set (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare Channel 0 (CMP0), Compare Channel 1 (CMP1), and Compare Channel 2 (CMP2) registers for the TCE0 module.
void TCE0_CompareChannels123Set (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare Channel 1 (CMP1), Compare Channel 2 (CMP2), and Compare Channel 3 (CMP3) registers for the TCE0 module.
void TCE0_CompareAllChannelsBufferedSet (uint16_t value0, uint16_t value1, uint16_t value2, uint16_t value3)
Sets all the Compare Buffer (CMPBUF) registers for the TCE0 module.
void TCE0_CompareChannels012BufferedSet (uint16_t value0, uint16_t value1, uint16_t value2)
Sets the Compare Buffer Channel 0 (CMP0BUF), Compare Buffer Channel 1 (CMP1BUF), and Compare Buffer Channel 2 (CMP2BUF) registers for the TCE0 module.
void TCE0_CompareChannels123BufferedSet (uint16_t value1, uint16_t value2, uint16_t value3)
Sets the Compare Buffer Channel 1 (CMP1BUF), Compare Buffer Channel 2 (CMP2BUF), and Compare Buffer Channel 3 (CMP3BUF) registers for the TCE0 module.
void TCE0_OutputsEnable (uint8_t value)
Enable the Waveform Outputs for the TCE0 module.
void TCE0_OutputsValueSet (uint8_t value)
Sets the Waveform Outputs for the TCE0 module.
uint8_t TCE0_OutputsValueGet (void)
Returns the Waveform Outputs value for the TCE0 module.
void TCE0_OutputPolaritySet (uint8_t value)
Sets the Waveform Outputs Polarity for the TCE0 module.
uint8_t TCE0_OutputPolarityGet (void)
Returns the Waveform Outputs Polarity for the TCE0 module.
void TCE0_HighResSet (TCE_HREN_t resolution)
Sets the High Resolution mode for the TCE0 module.
void TCE0_ScaleModeSet (TCE_SCALEMODE_t mode)
Sets the Scaling mode used for the TCE0 module.
void TCE0_ScaleEnable (bool state)
Enables or disables the Scaling for the TCE0 module.
void TCE0_AmplitudeControlEnable (bool state)
Enables or disables the Amplitude Control for the TCE0 module.
void TCE0_AmplitudeSet (uint16_t value)
Sets the Amplitude (AMP) register of the TCE0 module.
uint16_t TCE0_AmplitudeGet (void)
Returns the value of the Amplitude (AMP) register of the TCE0 module.
void TCE0_OffsetSet (uint16_t value)
Sets the Offset (OFFSET) register for the TCE0 module.
uint16_t TCE0_OffsetGet (void)
Returns the value of the Offset (OFFSET) register for the TCE0 module.
void TCE0_PeriodSet (uint16_t period)
Sets the Period (PER) register for the TCE0 module.
uint16_t TCE0_PeriodGet (void)
Returns the value of the Period (PER) register for the TCE0 module.
void TCE0_CountDirectionSet (void)
Sets the counting direction to UP for the TCE0 module.
void TCE0_CountDirectionClear (void)
Sets the counting direction to DOWN for the TCE0 module.
void TCE0_LockUpdateSet (void)
Sets the Lock Update (LUPD) bit for the TCE0 module.
void TCE0_LockUpdateClear (void)
Clears the Lock Update (LUPD) bit for the TCE0 module.
void TCE0_AutoLockUpdateSet (void)
Sets the Auto-Lock Update (ALUPD) bit for the TCE0 module.
void TCE0_AutoLockUpdateClear (void)
Clears the Auto-Lock Update (ALUPD) bit for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle0Set (uint16_t value)
Sets the Compare Buffer Channel 0 (CMP0BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle1Set (uint16_t value)
Sets the Compare Buffer Channel 1 (CMP1BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle2Set (uint16_t value)
Sets the Compare Buffer Channel 2 (CMP2BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PWM_BufferedDutyCycle3Set (uint16_t value)
Sets the Compare Buffer Channel 3 (CMP3BUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
void TCE0_PeriodBufferSet (uint16_t value)
Sets the Persiod Buffer (PERBUF) register value in Pulse-Width Modulation (PWM) mode for the TCE0 module.
uint16_t TCE0_MaxCountGet (void)
Returns the maximum counter value for the TCE0 module.
void TCE0_Tasks (void)
Runs the callback functions in Polling mode.
Macros
#define TCE0_PER_US_TO_TICKS(US, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from microseconds to clock increments for setting the period.
#define TCE0_PER_MS_TO_TICKS(MS, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from milliseconds to clock increments for setting the period.
#define TCE0_PER_S_TO_TICKS(S, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE_PRESCALER)) + 0.5) - 1
Converts from seconds to clock increments for setting the period.
#define TCE0_CMP_US_TO_TICKS(US, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(US)) / (1000000.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from microseconds to clock increments for setting the compare registers.
#define TCE0_CMP_MS_TO_TICKS(MS, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(MS)) / (1000.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from milliseconds to clock increments for setting the compare registers.
#define TCE0_CMP_S_TO_TICKS(S, F_CLOCK, TCE_PRESCALER) (uint16_t)(((float)(F_CLOCK) * (float)(S)) / (1.0 * (float)(TCE_PRESCALER)) + 0.5)
Converts from seconds to clock increments for setting the compare registers.
#define TCE0_HZ_TO_CLOCKS_FREQUENCYMODE(HZ, F_CLOCK, TCE_PRESCALER) (uint16_t)((float)(F_CLOCK) / (2 * (float)(HZ) * (float)(TCE_PRESCALER)) - 1)
Converts from hertz to clock increments.
Typedefs
typedef void(* TCE0_cb_t) (void)
Pointer to a function to be used as a callback handler when an interrupt event occurs.
Enumerations
enum TCE0_status_t { TCE_STATUS_IDLE = 0, TCE_STATUS_RUNNING = 1 }
Lists the possible states of the TCE0 module.
Detailed Description
Timer/Counter Type E Driver API Header File.