redid the mcc graphical stuff

This commit is contained in:
2025-02-02 11:11:54 -05:00
parent ea24f650d1
commit 988765e2c2
22 changed files with 948 additions and 184 deletions

View File

@@ -7,9 +7,9 @@
*
* @brief Driver implementation for the TMR1 driver
*
* @version TMR1 Driver Version 4.0.0
* @version TMR1 Driver Version 4.1.0
*
* @version Package Version 5.0.0
* @version Package Version 5.1.0
*/
/*
<EFBFBD> [2025] Microchip Technology Inc. and its subsidiaries.
@@ -39,16 +39,15 @@
#include <xc.h>
#include "../tmr1.h"
static volatile uint16_t timer1ReloadVal;
static void (*TMR1_OverflowCallback)(void);
static void (*TMR1_GateCallback)(void);
static void TMR1_DefaultOverflowCallback(void);
static void (*TMR1_GateCallback)(void);
static void TMR1_DefaultGateCallback(void);
void TMR1_Initialize(void)
{
T1CONbits.TMR1ON = 0; // TMRON disabled
T1CONbits.TMR1ON = 0U; // TMRON disabled
T1GCON = (0 << _T1GCON_T1GGO_POSN) // T1GGO done
| (0 << _T1GCON_T1GSPM_POSN) // T1GSPM disabled
@@ -64,11 +63,13 @@ void TMR1_Initialize(void)
TMR1L = 0xE3;
timer1ReloadVal=((uint16_t)TMR1H << 8) | TMR1L;
TMR1_OverflowCallback = TMR1_DefaultOverflowCallback;
TMR1_GateCallback = TMR1_DefaultGateCallback;
PIR4bits.TMR1IF = 0;
PIE4bits.TMR1IE = 1;
PIR4bits.TMR1IF = 0U;
PIE4bits.TMR1IE = 1U;
PIR5bits.TMR1GIF = 0U;
T1CON = (1 << _T1CON_TMR1ON_POSN) // TMR1ON enabled
| (0 << _T1CON_T1RD16_POSN) // T1RD16 disabled
@@ -78,7 +79,7 @@ void TMR1_Initialize(void)
void TMR1_Deinitialize(void)
{
T1CONbits.TMR1ON = 0; // TMRON disabled
T1CONbits.TMR1ON = 0U; // TMRON disabled
T1CON = 0x0;
T1GCON = 0x0;
@@ -87,20 +88,20 @@ void TMR1_Deinitialize(void)
TMR1H = 0x0;
TMR1L = 0x0;
PIR4bits.TMR1IF = 0;
PIE4bits.TMR1IE = 0;
PIR5bits.TMR1GIF = 0;
PIE5bits.TMR1GIE = 0;
PIR4bits.TMR1IF = 0U;
PIE4bits.TMR1IE = 0U;
PIR5bits.TMR1GIF = 0U;
PIE5bits.TMR1GIE = 0U;
}
void TMR1_Start(void)
{
T1CONbits.TMR1ON = 1;
T1CONbits.TMR1ON = 1U;
}
void TMR1_Stop(void)
{
T1CONbits.TMR1ON = 0;
T1CONbits.TMR1ON = 0U;
}
uint16_t TMR1_CounterGet(void)
@@ -112,25 +113,26 @@ uint16_t TMR1_CounterGet(void)
readValLow = TMR1L;
readValHigh = TMR1H;
readVal = ((uint16_t)readValHigh << 8) | readValLow;
readVal = ((uint16_t)readValHigh << 8U) | readValLow;
return readVal;
}
/* cppcheck-suppress misra-c2012-8.7 */
void TMR1_CounterSet(uint16_t timerVal)
{
if (1U == T1CONbits.nT1SYNC)
{
bool onState = T1CONbits.TMR1ON;
TMR1H = (uint8_t)(timerVal >> 8);
TMR1H = (uint8_t)(timerVal >> 8U);
TMR1L = (uint8_t)timerVal;
T1CONbits.TMR1ON = onState;
}
else
{
TMR1H = (uint8_t)(timerVal >> 8);
TMR1H = (uint8_t)(timerVal >> 8U);
TMR1L = (uint8_t)timerVal;
}
}
@@ -158,7 +160,7 @@ uint16_t TMR1_MaxCountGet(void)
void TMR1_SinglePulseAcquisitionStart(void)
{
T1GCONbits.T1GGO = 1;
T1GCONbits.T1GGO = 1U;
}
uint8_t TMR1_GateStateGet(void)
@@ -166,14 +168,24 @@ uint8_t TMR1_GateStateGet(void)
return (T1GCONbits.T1GVAL);
}
void TMR1_TMRInterruptEnable(void)
void TMR1_OverflowInterruptEnable(void)
{
PIE4bits.TMR1IE = 1;
PIE4bits.TMR1IE = 1U;
}
void TMR1_TMRInterruptDisable(void)
void TMR1_OverflowInterruptDisable(void)
{
PIE4bits.TMR1IE = 0;
PIE4bits.TMR1IE = 0U;
}
bool TMR1_GateEventStatusGet(void)
{
return (PIR5bits.TMR1GIF);
}
void TMR1_GateEventStatusClear(void)
{
PIR5bits.TMR1GIF = 0U;
}
void TMR1_OverflowISR(void)
@@ -191,14 +203,26 @@ void TMR1_OverflowISR(void)
}
CountCallBack = 0;
}
PIR4bits.TMR1IF = 0;
PIR4bits.TMR1IF = 0U;
}
void TMR1_Tasks(void)
{
if(1U == PIR5bits.TMR1GIF)
{
if(NULL != TMR1_GateCallback)
{
TMR1_GateCallback();
}
PIR5bits.TMR1GIF = 0U;
}
}
void TMR1_OverflowCallbackRegister(void (*CallbackHandler)(void))
{
TMR1_OverflowCallback = CallbackHandler;
}
void TMR1_GateCallbackRegister(void (*CallbackHandler)(void))
{
TMR1_GateCallback = CallbackHandler;

View File

@@ -1,11 +1,11 @@
/**
* TMR2 Generated Timer Driver File
* TMR2 Generated Driver File
*
* @file tmr2.c
*
* @ingroup timerdriver
* @ingroup tmr2
*
* @brief Driver implementation for the TMR2 Timer driver.
* @brief Driver implementation for the TMR2 module.
*
* @version Driver Version 4.0.0
*
@@ -40,20 +40,6 @@
#include <xc.h>
#include "../tmr2.h"
const struct TIMER_INTERFACE Timer2 = {
.Initialize = TMR2_Initialize,
.Deinitialize = TMR2_Deinitialize,
.Start = TMR2_Start,
.Stop = TMR2_Stop,
.PeriodSet = TMR2_PeriodSet,
.PeriodGet = TMR2_PeriodGet,
.CounterGet = TMR2_CounterGet,
.CounterSet = TMR2_CounterSet,
.MaxCountGet = TMR2_MaxCountGet,
.TimeoutCallbackRegister = TMR2_PeriodMatchCallbackRegister,
.Tasks = NULL
};
static void (*TMR2_PeriodMatchCallback)(void);
static void TMR2_DefaultPeriodMatchCallback(void);
@@ -72,7 +58,7 @@ void TMR2_Initialize(void)
T2RST = (0 << _T2RST_T2RSEL_POSN); // T2RSEL T2INPPS pin
T2PR = 0xF9; // Period 0.001s; Frequency 250000Hz; Count 249
T2PR = 0xF9; // Period 0.001s; Frequency 250000Hz; Count 249
T2TMR = 0x0;
@@ -111,29 +97,49 @@ void TMR2_Stop(void)
T2CONbits.TMR2ON = 0;
}
uint32_t TMR2_CounterGet(void)
void TMR2_ModeSet(TMR2_HLT_MODE mode)
{
return (uint32_t)T2TMR;
T2HLTbits.T2MODE = mode;
}
void TMR2_CounterSet(uint32_t count)
void TMR2_ExtResetSourceSet(TMR2_HLT_EXT_RESET_SOURCE reset)
{
T2TMR = (uint8_t)count;
T2RSTbits.T2RSEL = reset;
}
void TMR2_PeriodSet(uint32_t periodVal)
uint8_t TMR2_CounterGet(void)
{
T2PR = (uint8_t)periodVal;
return T2TMR;
}
uint32_t TMR2_PeriodGet(void)
void TMR2_CounterSet(uint8_t count)
{
return (uint32_t)T2PR;
T2TMR = count;
}
uint32_t TMR2_MaxCountGet(void)
void TMR2_PeriodSet(uint8_t periodVal)
{
return (uint32_t)TMR2_MAX_COUNT;
T2PR = periodVal;
}
uint8_t TMR2_PeriodGet(void)
{
return T2PR;
}
uint8_t TMR2_MaxCountGet(void)
{
return TMR2_MAX_COUNT;
}
void TMR2_TMRInterruptEnable(void)
{
PIE4bits.TMR2IE = 1;
}
void TMR2_TMRInterruptDisable(void)
{
PIE4bits.TMR2IE = 0;
}
void TMR2_ISR(void)
@@ -155,3 +161,5 @@ static void TMR2_DefaultPeriodMatchCallback(void)
{
// Default callback function
}

View File

@@ -7,9 +7,9 @@
*
* @brief This file contains API prototypes and other data types for the TMR1 driver.
*
* @version TMR1 Driver Version 4.0.0
* @version TMR1 Driver Version 4.1.0
*
* @version Package Version 5.0.0
* @version Package Version 5.1.0
*/
/*
<EFBFBD> [2025] Microchip Technology Inc. and its subsidiaries.
@@ -153,22 +153,41 @@
#define TMR_SENSOR_GateCallbackRegister TMR1_GateCallbackRegister
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_TMRInterruptEnable API.
* @brief Defines the Custom Name for the \ref TMR1_OverflowInterruptEnable API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_TMRInterruptEnable TMR1_TMRInterruptEnable
#define TMR_SENSOR_OverflowInterruptEnable TMR1_OverflowInterruptEnable
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_TMRInterruptDisable API.
* @brief Defines the Custom Name for the \ref TMR1_OverflowInterruptDisable API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_TMRInterruptDisable TMR1_TMRInterruptDisable
#define TMR_SENSOR_OverflowInterruptDisable TMR1_OverflowInterruptDisable
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_OverflowCallbackRegister API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_OverflowCallbackRegister TMR1_OverflowCallbackRegister
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_GateEventStatusGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_GateEventStatusGet TMR1_GateEventStatusGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_GateEventStatusClear API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_GateEventStatusClear TMR1_GateEventStatusClear
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_Tasks API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_Tasks TMR1_Tasks
/**
* @ingroup tmr1
@@ -281,7 +300,7 @@ uint8_t TMR1_GateStateGet(void);
* @param None.
* @return None.
*/
void TMR1_TMRInterruptEnable(void);
void TMR1_OverflowInterruptEnable(void);
/**
* @ingroup tmr1
@@ -289,7 +308,7 @@ void TMR1_TMRInterruptEnable(void);
* @param None.
* @return None.
*/
void TMR1_TMRInterruptDisable(void);
void TMR1_OverflowInterruptDisable(void);
/**
* @ingroup tmr1
@@ -299,6 +318,31 @@ void TMR1_TMRInterruptDisable(void);
*/
void TMR1_OverflowISR(void);
/**
* @ingroup tmr1
* @brief Returns the TMR1 Gate flag status in Non-Interrupt mode.
* @param None.
* @retval True - Timer Gate Event has occurred
* @retval False - Timer Gate Event has not occurred
*/
bool TMR1_GateEventStatusGet(void);
/**
* @ingroup tmr1
* @brief Clears the TMR1 Gate flag in Non-Interrupt mode.
* @param None.
* @return None.
*/
void TMR1_GateEventStatusClear(void);
/**
* @ingroup tmr1
* @brief Performs the tasks to be executed during the TMR1 overflow or gate event.
* @param None.
* @return None.
*/
void TMR1_Tasks(void);
/**
* @ingroup tmr1
* @brief Registers a callback function for the TMR1 overflow event.

View File

@@ -7,9 +7,9 @@
*
* @brief This file contains the deprecated macros or APIs for the TMR1 driver.
*
* @version TMR1 Driver Version 4.0.0
* @version TMR1 Driver Version 4.1.0
*
* @version Package Version 5.0.0
* @version Package Version 5.1.0
*/
/*
<EFBFBD> [2025] Microchip Technology Inc. and its subsidiaries.
@@ -113,5 +113,33 @@
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_StartSinglePulseAcquisition TMR1_SinglePulseAcquisitionStart
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_OverflowInterruptEnable API.
* The TMR1_TMRInterruptEnable will be deprecated in the future release. Use TMR1_OverflowStatusGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR1_TMRInterruptEnable TMR1_OverflowInterruptEnable
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_OverflowInterruptEnable API.
* The TMR_SENSOR_TMRInterruptEnable will be deprecated in the future release. Use TMR_SENSOR_OverflowStatusGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_TMRInterruptEnable TMR1_OverflowInterruptEnable
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_OverflowInterruptDisable API.
* The TMR1_TMRInterruptDisable will be deprecated in the future release. Use TMR1_OverflowStatusGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR1_TMRInterruptDisable TMR1_OverflowInterruptDisable
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_OverflowInterruptDisable API.
* The TMR_SENSOR_TMRInterruptDisable will be deprecated in the future release. Use TMR_SENSOR_OverflowStatusGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_TMRInterruptDisable TMR1_OverflowInterruptDisable
#endif // TMR1_DEPRECATED_H

View File

@@ -1,11 +1,11 @@
/**
* TMR2 Generated Timer Driver API Header File
* TMR2 Generated Driver API Header File
*
* @file tmr2.h
*
* @ingroup timerdriver
* @defgroup tmr2 TMR2
*
* @brief This file contains API prototypes and other data types for the TMR2 Timer driver.
* @brief This file contains API prototypes and other data types for the TMR2 driver.
*
* @version Driver Version 4.0.0
*
@@ -38,7 +38,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "timer_interface.h"
#include "tmr2_deprecated.h"
/**
* @misradeviation{@advisory,2.5}
@@ -47,108 +47,316 @@
*/
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the TMR2 maximum count value.
*/
#define TMR2_MAX_COUNT (255U)
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the TMR2 prescaled clock frequency in hertz.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR2_CLOCK_FREQ (250000UL)
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_MAX_COUNT.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TIMER2_MAX_COUNT TMR2_MAX_COUNT
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_CLOCK_FREQ.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TIMER2_CLOCK_FREQ TMR2_CLOCK_FREQ
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_Initialize API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Initialize TMR2_Initialize
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_Deinitialize API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Deinitialize TMR2_Deinitialize
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_Start API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Start TMR2_Start
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_Stop API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Stop TMR2_Stop
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_CounterGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_CounterGet TMR2_CounterGet
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_CounterSet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_CounterSet TMR2_CounterSet
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_PeriodSet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_PeriodSet TMR2_PeriodSet
/**
* @ingroup timerdriver
* @brief Defines the Custom Name for the \ref TMR2_PeriodGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_PeriodGet TMR2_PeriodGet
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_MaxCountGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_MaxCountGet TMR2_MaxCountGet
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_ModeSet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_ModeSet TMR2_ModeSet
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_ExtResetSourceSet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_ExtResetSourceSet TMR2_ExtResetSourceSet
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_PeriodMatchCallbackRegister API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_PeriodMatchCallbackRegister TMR2_PeriodMatchCallbackRegister
/**
* @ingroup timerdriver
* @brief Defines the Custom Name for the \ref TMR2_ISR API
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_TMRInterruptEnable API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_TMRInterruptEnable TMR2_TMRInterruptEnable
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_TMRInterruptDisable API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_TMRInterruptDisable TMR2_TMRInterruptDisable
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_ISR API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_ISR TMR2_ISR
/**
@ingroup timerdriver
@struct TIMER_INTERFACE
@brief This is an instance of TIMER_INTERFACE for the TMR2 module.
* @ingroup tmr2
* @enum TMR2_HLT_EXT_RESET_SOURCE
* @brief Defines the several modes of timer's operation of the timer with the Hardware Limit Timer (HLT) extension.
*/
extern const struct TIMER_INTERFACE Timer2;
typedef enum
{
/* Roll-over Pulse mode clears the TMRx upon TMRx = PRx, then continue running.
ON bit must be set and is not affected by Resets
*/
/* Roll-over Pulse mode indicates that Timer starts
immediately upon ON = 1 (Software Control)
*/
TMR2_ROP_STARTS_TMRON,
/* Roll-over Pulse mode indicates that the Timer starts
when ON = 1 and TMRx_ers = 1. Stops when TMRx_ers = 0
*/
TMR2_ROP_STARTS_TMRON_ERSHIGH,
/* Roll-over Pulse mode indicates that the Timer starts
when ON = 1 and TMRx_ers = 0. Stops when TMRx_ers = 1
*/
TMR2_ROP_STARTS_TMRON_ERSLOW,
/* Roll-over Pulse mode indicates that the Timer resets
upon rising or falling edge of TMRx_ers
*/
TMR2_ROP_RESETS_ERSBOTHEDGE,
/* Roll-over Pulse mode indicates that the Timer resets
upon rising edge of TMRx_ers
*/
TMR2_ROP_RESETS_ERSRISINGEDGE,
/* Roll-over Pulse mode indicates that the Timer resets
upon falling edge of TMRx_ers
*/
TMR2_ROP_RESETS_ERSFALLINGEDGE,
/* Roll-over Pulse mode indicates that the Timer resets
upon TMRx_ers = 0
*/
TMR2_ROP_RESETS_ERSLOW,
/* Roll-over Pulse mode indicates that the Timer resets
upon TMRx_ers = 1
*/
TMR2_ROP_RESETS_ERSHIGH,
/*In all One-Shot mode the timer resets and the ON bit is
cleared when the timer value matches the PRx period
value. The ON bit must be set by software to start
another timer cycle.
*/
/* One shot mode indicates that the Timer starts
immediately upon ON = 1 (Software Control)
*/
TMR2_OS_STARTS_TMRON,
/* One shot mode indicates that the Timer starts
when a rising edge is detected on the TMRx_ers
*/
TMR2_OS_STARTS_ERSRISINGEDGE ,
/* One shot mode indicates that the Timer starts
when a falling edge is detected on the TMRx_ers
*/
TMR2_OS_STARTS_ERSFALLINGEDGE ,
/* One shot mode indicates that the Timer starts
when either a rising or falling edge is detected on TMRx_ers
*/
TMR2_OS_STARTS_ERSBOTHEDGE,
/* One shot mode indicates that the Timer starts
upon first TMRx_ers rising edge and resets on all
subsequent TMRx_ers rising edges
*/
TMR2_OS_STARTS_ERSFIRSTRISINGEDGE,
/* One shot mode indicates that the Timer starts
upon first TMRx_ers falling edge and restarts on all
subsequent TMRx_ers falling edges
*/
TMR2_OS_STARTS_ERSFIRSTFALLINGEDGE,
/* One shot mode indicates that the Timer starts
when a rising edge is detected on the TMRx_ers,
resets upon TMRx_ers = 0
*/
TMR2_OS_STARTS_ERSRISINGEDGEDETECT,
/* One shot mode indicates that the Timer starts
when a falling edge is detected on the TMRx_ers,
resets upon TMRx_ers = 1
*/
TMR2_OS_STARTS_ERSFALLINGEDGEDETECT,
/* One shot mode indicates that the Timer starts
when a TMRx_ers = 1,ON =1 and resets upon TMRx_ers =0
*/
TMR2_OS_STARTS_TMRON_ERSHIGH = 0x16,
/* One shot mode indicates that the Timer starts
when a TMRx_ers = 0,ON = 1 and resets upon TMRx_ers =1
*/
TMR2_OS_STARTS_TMRON_ERSLOW = 0x17,
/*In all Mono-Stable mode the ON bit must be initially set,but
not cleared upon the TMRx = PRx, and the timer will start upon
an TMRx_ers start event following TMRx = PRx.*/
/* Mono Stable mode indicates that the Timer starts
when a rising edge is detected on the TMRx_ers and ON = 1
*/
TMR2_MS_STARTS_TMRON_ERSRISINGEDGEDETECT = 0x11,
/* Mono Stable mode indicates that the Timer starts
when a falling edge is detected on the TMRx_ers and ON = 1
*/
TMR2_MS_STARTS_TMRON_ERSFALLINGEDGEDETECT = 0x12,
/* Mono Stable mode indicates that the Timer starts
when either a rising or falling edge is detected on TMRx_ers
and ON = 1
*/
TMR2_MS_STARTS_TMRON_ERSBOTHEDGE = 0x13
} TMR2_HLT_MODE;
/**
* Section: TMR2 APIs
* @ingroup tmr2
* @enum TMR2_HLT_EXT_RESET_SOURCE
* @brief Defines the different Reset sources of the HLT.
*/
typedef enum
{
/*
* T2INPPS_PIN as the Timer external reset source
*/
TMR2_T2INPPS_PIN = 0x0,
/*
* CCP1OUT as the Timer external reset source
*/
TMR2_CCP1OUT = 0x1,
/*
* CCP2OUT as the Timer external reset source
*/
TMR2_CCP2OUT = 0x2,
/*
* PWM3OUT as the Timer external reset source
*/
TMR2_PWM3OUT = 0x3,
/*
* PWM4OUT as the Timer external reset source
*/
TMR2_PWM4OUT = 0x4,
/*
* PWM5OUT as the Timer external reset source
*/
TMR2_PWM5OUT = 0x5,
/*
* PWM6OUT as the Timer external reset source
*/
TMR2_PWM6OUT = 0x6,
/*
* CMP1OUT as the Timer external reset source
*/
TMR2_CMP1OUT = 0x7,
/*
* CMP2OUT as the Timer external reset source
*/
TMR2_CMP2OUT = 0x8,
/*
* ZCDOUT as the Timer external reset source
*/
TMR2_ZCDOUT = 0x9,
/*
* CLC1OUT as the Timer external reset source
*/
TMR2_CLC1OUT = 0xa,
/*
* CLC2OUT as the Timer external reset source
*/
TMR2_CLC2OUT = 0xb,
/*
* CLC3OUT as the Timer external reset source
*/
TMR2_CLC3OUT = 0xc,
/*
* CLC4OUT as the Timer external reset source
*/
TMR2_CLC4OUT = 0xd
} TMR2_HLT_EXT_RESET_SOURCE;
/**
* @ingroup timerdriver
Section: TMR2 APIs
*/
/**
* @ingroup tmr2
* @brief Initializes the Timer2 (TMR2) module.
* This routine must be called before any other TMR2 routines.
* @param None.
@@ -157,7 +365,7 @@ extern const struct TIMER_INTERFACE Timer2;
void TMR2_Initialize(void);
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Deinitializes the TMR2 to Power-on Reset (POR) values.
* @param None.
* @return None.
@@ -165,7 +373,7 @@ void TMR2_Initialize(void);
void TMR2_Deinitialize(void);
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Starts the TMR2 timer.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param None.
@@ -174,7 +382,7 @@ void TMR2_Deinitialize(void);
void TMR2_Start(void);
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Stops the TMR2 timer.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param None.
@@ -183,59 +391,93 @@ void TMR2_Start(void);
void TMR2_Stop(void);
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Returns the current counter value.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param None.
* @return Counter value from the T2TMR register
* @return Current counter value
*/
uint32_t TMR2_CounterGet(void);
uint8_t TMR2_CounterGet(void);
/**
* @ingroup timerdriver
* @brief Sets the counter value.
* @ingroup tmr2
* @brief Sets the counter value for the TMR2 timer.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param count - Counter value to be written to the T2TMR register
* @return None.
*/
void TMR2_CounterSet(uint32_t count);
void TMR2_CounterSet(uint8_t count);
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Sets the period count value.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param periodVal - Period count value to be written to the T2PR register
* @return None.
*/
void TMR2_PeriodSet(uint32_t periodVal);
void TMR2_PeriodSet(uint8_t periodVal);
/**
* @ingroup timerdriver
* @brief Returns the current period value.
* @ingroup tmr2
* @brief Returns the current period count value.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param None.
* @return Period count value
* @return Period count value from the T2PR register
*/
uint32_t TMR2_PeriodGet(void);
uint8_t TMR2_PeriodGet(void);
/**
* @ingroup timerdriver
* @brief Returns the maximum count value of the timer.
* @ingroup tmr2
* @brief Returns the TMR2 maximum count value.
* @param None.
* @return Maximum count value of the timer
*/
uint32_t TMR2_MaxCountGet(void);
uint8_t TMR2_MaxCountGet(void);
/**
* @ingroup timerdriver
* @brief Interrupt Service Routine (ISR) for the TMR2 period match event.
* @ingroup tmr2
* @brief Sets the HLT mode.
* @pre Initialize TMR2 with TMR2_Initialize() after calling this API.
* @param mode - Value to be written to the T2HLTbits.MODE bits
* @return None.
*/
void TMR2_ModeSet(TMR2_HLT_MODE mode);
/**
* @ingroup tmr2
* @brief Sets the HLT External Reset source.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param reset - Value to be written to the T2RSTbits.RSEL bits
* @return None.
*/
void TMR2_ExtResetSourceSet(TMR2_HLT_EXT_RESET_SOURCE reset);
/**
* @ingroup tmr2
* @brief Enables the TMR2 interrupt.
* @param None.
* @return None.
*/
void TMR2_TMRInterruptEnable(void);
/**
* @ingroup tmr2
* @brief Disables the TMR2 interrupt.
* @param None.
* @return None.
*/
void TMR2_TMRInterruptDisable(void);
/**
* @ingroup tmr2
* @brief Interrupt Service Routine (ISR) for the TMR2 period match interrupt.
* @param None.
* @return None.
*/
void TMR2_ISR(void);
/**
* @ingroup timerdriver
* @ingroup tmr2
* @brief Registers a callback function for the TMR2 period match event.
* @param CallbackHandler - Address of the custom callback function
* @return None.

View File

@@ -0,0 +1,107 @@
/**
* TMR2 Generated Driver API Header File
*
* @file tmr2.h
*
* @defgroup tmr2 TMR2
*
* @brief This file contains deprecated macros or functions for the TMR2 driver.
*
* @version Driver Version 4.0.0
*
* @version Package Version 5.0.0
*/
/*
<EFBFBD> [2025] 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 are 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.
*/
#ifndef TMR2_DEPRECATED_H
#define TMR2_DEPRECATED_H
#warning "The tmr2_deprecated.h file contains the deprecated macros or functions. Replace the deprecated macro or functions with the recommended alternative."
/**
* @misradeviation{@advisory,2.5}
* MCC Melody drivers provide macros that can be added to an application.
* It depends on the application whether a macro is used or not.
*/
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_CounterGet API.
* The TMR2_Read will be deprecated in the future release. Use TMR2_CounterGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR2_Read TMR2_CounterGet
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_CounterGet API.
* The Timer2_Read will be deprecated in the future release. Use Timer2_CounterGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Read TMR2_CounterGet
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_CounterSet API.
* The TMR2_Write will be deprecated in the future release. Use TMR2_CounterSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR2_Write TMR2_CounterSet
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_CounterSet API.
* The Timer2_Write will be deprecated in the future release. Use Timer2_CounterSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Write TMR2_CounterSet
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_PeriodSet API.
* The TMR2_PeriodCountSet will be deprecated in the future release. Use TMR2_PeriodSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR2_PeriodCountSet TMR2_PeriodSet
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_PeriodSet API.
* The Timer2_PeriodCountSet will be deprecated in the future release. Use Timer2_PeriodSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_PeriodCountSet TMR2_PeriodSet
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_PeriodMatchCallbackRegister API.
* The TMR2_OverflowCallbackRegister will be deprecated in the future release. Use TMR2_PeriodMatchCallbackRegister instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR2_OverflowCallbackRegister TMR2_PeriodMatchCallbackRegister
/**
* @ingroup tmr2
* @brief Defines the Custom Name for the \ref TMR2_PeriodMatchCallbackRegister API.
* The Timer2_OverflowCallbackRegister will be deprecated in the future release. Use Timer2_PeriodMatchCallbackRegister instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_OverflowCallbackRegister TMR2_PeriodMatchCallbackRegister
#endif // TMR2_DEPRECATED_H
/**
End of File
*/