Inital working code

This commit is contained in:
2025-01-30 20:02:06 -05:00
commit ea24f650d1
49 changed files with 6617 additions and 0 deletions

View File

@@ -0,0 +1,143 @@
/**
* TMR0 Generated Driver File
*
* @file tmr0.c
*
* @ingroup tmr08bit
*
* @brief Driver implementation for the TMR0 driver
*
* @version TMR0 Driver Version 3.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.
*/
#include <xc.h>
#include "../tmr0.h"
static void (*TMR0_PeriodMatchCallback)(void);
static void TMR0_DefaultCallback(void);
/**
Section: TMR0 APIs
*/
void TMR0_Initialize(void)
{
TMR0H = 0x63; // Period 10ms; Frequency 10000 Hz; Count 99
TMR0L = 0x0;
T0CON1 = (0 << _T0CON1_T0CS_POSN) // T0CS T0CKI_PIN
| (0 << _T0CON1_T0CKPS_POSN) // T0CKPS 1:1
| (1 << _T0CON1_T0ASYNC_POSN); // T0ASYNC not_synchronised
TMR0_PeriodMatchCallback = TMR0_DefaultCallback;
PIR0bits.TMR0IF = 0;
PIE0bits.TMR0IE = 1;
T0CON0 = (0 << _T0CON0_T0OUTPS_POSN) // T0OUTPS 1:1
| (1 << _T0CON0_T0EN_POSN) // T0EN enabled
| (0 << _T0CON0_T016BIT_POSN); // T016BIT 8-bit
}
void TMR0_Deinitialize(void)
{
T0CON0bits.T0EN = 0;
PIR0bits.TMR0IF = 0;
PIE0bits.TMR0IE = 0;
T0CON0 = 0x0;
T0CON1 = 0x0;
TMR0H = 0xFF;
TMR0L =0x0;
}
void TMR0_Start(void)
{
T0CON0bits.T0EN = 1;
}
void TMR0_Stop(void)
{
T0CON0bits.T0EN = 0;
}
uint8_t TMR0_CounterGet(void)
{
uint8_t counterValue;
counterValue = TMR0L;
return counterValue;
}
void TMR0_CounterSet(uint8_t counterValue)
{
TMR0L = counterValue;
}
void TMR0_PeriodSet(uint8_t periodValue)
{
TMR0H = periodValue;
}
uint8_t TMR0_PeriodGet(void)
{
return TMR0H;
}
uint8_t TMR0_MaxCountGet(void)
{
return TMR0_MAX_COUNT;
}
void TMR0_TMRInterruptEnable(void)
{
PIE0bits.TMR0IE = 1;
}
void TMR0_TMRInterruptDisable(void)
{
PIE0bits.TMR0IE = 0;
}
void TMR0_ISR(void)
{
if(NULL != TMR0_PeriodMatchCallback)
{
TMR0_PeriodMatchCallback();
}
PIR0bits.TMR0IF = 0;
}
void TMR0_PeriodMatchCallbackRegister(void (* callbackHandler)(void))
{
TMR0_PeriodMatchCallback = callbackHandler;
}
static void TMR0_DefaultCallback(void)
{
// Default callback
}

View File

@@ -0,0 +1,218 @@
/**
* TMR1 Generated Driver File
*
* @file tmr1.c
*
* @ingroup tmr1
*
* @brief Driver implementation for the TMR1 driver
*
* @version TMR1 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.
*/
/**
* Section: Included Files
*/
#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_DefaultGateCallback(void);
void TMR1_Initialize(void)
{
T1CONbits.TMR1ON = 0; // TMRON disabled
T1GCON = (0 << _T1GCON_T1GGO_POSN) // T1GGO done
| (0 << _T1GCON_T1GSPM_POSN) // T1GSPM disabled
| (0 << _T1GCON_T1GTM_POSN) // T1GTM disabled
| (0 << _T1GCON_T1GPOL_POSN) // T1GPOL low
| (0 << _T1GCON_T1GE_POSN); // T1GE disabled
T1GATE = (0 << _T1GATE_GSS_POSN); // GSS T1G_pin
T1CLK = (4 << _T1CLK_CS_POSN); // CS LFINTOSC
TMR1H = 0xF3; // Period 100.03226ms; Timer clock 31000 Hz;
TMR1L = 0xE3;
timer1ReloadVal=((uint16_t)TMR1H << 8) | TMR1L;
TMR1_OverflowCallback = TMR1_DefaultOverflowCallback;
TMR1_GateCallback = TMR1_DefaultGateCallback;
PIR4bits.TMR1IF = 0;
PIE4bits.TMR1IE = 1;
T1CON = (1 << _T1CON_TMR1ON_POSN) // TMR1ON enabled
| (0 << _T1CON_T1RD16_POSN) // T1RD16 disabled
| (1 << _T1CON_nT1SYNC_POSN) // nT1SYNC do_not_synchronize
| (0 << _T1CON_CKPS_POSN); // CKPS 1:1
}
void TMR1_Deinitialize(void)
{
T1CONbits.TMR1ON = 0; // TMRON disabled
T1CON = 0x0;
T1GCON = 0x0;
T1GATE = 0x0;
T1CLK = 0x0;
TMR1H = 0x0;
TMR1L = 0x0;
PIR4bits.TMR1IF = 0;
PIE4bits.TMR1IE = 0;
PIR5bits.TMR1GIF = 0;
PIE5bits.TMR1GIE = 0;
}
void TMR1_Start(void)
{
T1CONbits.TMR1ON = 1;
}
void TMR1_Stop(void)
{
T1CONbits.TMR1ON = 0;
}
uint16_t TMR1_CounterGet(void)
{
uint16_t readVal;
uint8_t readValHigh;
uint8_t readValLow;
readValLow = TMR1L;
readValHigh = TMR1H;
readVal = ((uint16_t)readValHigh << 8) | readValLow;
return readVal;
}
void TMR1_CounterSet(uint16_t timerVal)
{
if (1U == T1CONbits.nT1SYNC)
{
bool onState = T1CONbits.TMR1ON;
TMR1H = (uint8_t)(timerVal >> 8);
TMR1L = (uint8_t)timerVal;
T1CONbits.TMR1ON = onState;
}
else
{
TMR1H = (uint8_t)(timerVal >> 8);
TMR1L = (uint8_t)timerVal;
}
}
void TMR1_PeriodSet(uint16_t periodVal)
{
timer1ReloadVal = periodVal;
}
uint16_t TMR1_PeriodGet(void)
{
return timer1ReloadVal;
}
void TMR1_Reload(void)
{
/* cppcheck-suppress misra-c2012-8.7 */
TMR1_CounterSet(timer1ReloadVal);
}
uint16_t TMR1_MaxCountGet(void)
{
return TMR1_MAX_COUNT;
}
void TMR1_SinglePulseAcquisitionStart(void)
{
T1GCONbits.T1GGO = 1;
}
uint8_t TMR1_GateStateGet(void)
{
return (T1GCONbits.T1GVAL);
}
void TMR1_TMRInterruptEnable(void)
{
PIE4bits.TMR1IE = 1;
}
void TMR1_TMRInterruptDisable(void)
{
PIE4bits.TMR1IE = 0;
}
void TMR1_OverflowISR(void)
{
static volatile uint16_t CountCallBack = 0;
/* cppcheck-suppress misra-c2012-8.7 */
TMR1_CounterSet(timer1ReloadVal);
// Callback function: This is called on every 5 pass.
if(++CountCallBack >= TMR1_INTERRUPT_TICKER_FACTOR)
{
if(NULL != TMR1_OverflowCallback)
{
TMR1_OverflowCallback();
}
CountCallBack = 0;
}
PIR4bits.TMR1IF = 0;
}
void TMR1_OverflowCallbackRegister(void (*CallbackHandler)(void))
{
TMR1_OverflowCallback = CallbackHandler;
}
void TMR1_GateCallbackRegister(void (*CallbackHandler)(void))
{
TMR1_GateCallback = CallbackHandler;
}
static void TMR1_DefaultOverflowCallback(void)
{
// Default overflow callback
}
static void TMR1_DefaultGateCallback(void)
{
// Default Gate callback
}
/**
End of File
*/

View File

@@ -0,0 +1,157 @@
/**
* TMR2 Generated Timer Driver File
*
* @file tmr2.c
*
* @ingroup timerdriver
*
* @brief Driver implementation for the TMR2 Timer 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.
*/
/**
Section: Included Files
*/
#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);
/**
Section: TMR2 APIs
*/
void TMR2_Initialize(void)
{
T2CLKCON = (1 << _T2CLKCON_T2CS_POSN); // T2CS FOSC/4
T2HLT = (0 << _T2HLT_T2MODE_POSN) // T2MODE Software control
| (0 << _T2HLT_T2CKSYNC_POSN) // T2CKSYNC Not Synchronized
| (0 << _T2HLT_T2CKPOL_POSN) // T2CKPOL Rising Edge
| (0 << _T2HLT_T2PSYNC_POSN); // T2PSYNC Not Synchronized
T2RST = (0 << _T2RST_T2RSEL_POSN); // T2RSEL T2INPPS pin
T2PR = 0xF9; // Period 0.001s; Frequency 250000Hz; Count 249
T2TMR = 0x0;
TMR2_PeriodMatchCallback = TMR2_DefaultPeriodMatchCallback;
PIR4bits.TMR2IF = 0;
PIE4bits.TMR2IE = 1;
T2CON = (5 << _T2CON_T2CKPS_POSN) // T2CKPS 1:32
| (1 << _T2CON_TMR2ON_POSN) // TMR2ON on
| (0 << _T2CON_T2OUTPS_POSN); // T2OUTPS 1:1
}
void TMR2_Deinitialize(void)
{
T2CONbits.TMR2ON = 0;
PIR4bits.TMR2IF = 0;
PIE4bits.TMR2IE = 0;
T2CON = 0x0;
T2CLKCON = 0x0;
T2HLT = 0x0;
T2RST = 0x0;
T2PR = 0xFF;
T2TMR =0x0;
}
void TMR2_Start(void)
{
T2CONbits.TMR2ON = 1;
}
void TMR2_Stop(void)
{
T2CONbits.TMR2ON = 0;
}
uint32_t TMR2_CounterGet(void)
{
return (uint32_t)T2TMR;
}
void TMR2_CounterSet(uint32_t count)
{
T2TMR = (uint8_t)count;
}
void TMR2_PeriodSet(uint32_t periodVal)
{
T2PR = (uint8_t)periodVal;
}
uint32_t TMR2_PeriodGet(void)
{
return (uint32_t)T2PR;
}
uint32_t TMR2_MaxCountGet(void)
{
return (uint32_t)TMR2_MAX_COUNT;
}
void TMR2_ISR(void)
{
// The ticker is set to 1 -> The callback function gets called every time this ISR executes.
if(NULL != TMR2_PeriodMatchCallback)
{
TMR2_PeriodMatchCallback();
}
PIR4bits.TMR2IF = 0;
}
void TMR2_PeriodMatchCallbackRegister(void (* callbackHandler)(void))
{
TMR2_PeriodMatchCallback = callbackHandler;
}
static void TMR2_DefaultPeriodMatchCallback(void)
{
// Default callback function
}

View File

@@ -0,0 +1,110 @@
/**
* TIMER Generated Driver Interface Header File
*
* @file timer_interface.h
*
* @defgroup timerdriver Timer Driver
*
* @brief The Timer driver is an 8-bit, 16-bit or 32-bit timer that can operate as a
* free-running interval timer using PIC<49>, dsPIC<49> and AVR<56> microcontrollers (MCUs).
*
* @skipline @version Firmware Driver Version 1.7.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 TIMER_INTERFACE_H
#define TIMER_INTERFACE_H
// Section: Included Files
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
// Section: Data Type Definitions
/**
* @ingroup timerdriver
* @brief Defines the deprecated SCCPx_Timer_PeriodCountSet or TMRx_PeriodCountSet API.
* Set it to 1 for backward compatibility for 16-bit MCUs only.
*/
#define TIMER_PERIODCOUNTSET_API_SUPPORT 0
/**
* @ingroup timerdriver
* @brief The InterruptPrioritySet API is not supported.
*/
#define TIMER_INTERRUPT_PRIORITY_SUPPORT 0
/**
@ingroup timerdriver
@struct TIMER_INTERFACE
@brief Structure containing the function pointers of the Timer driver
*/
struct TIMER_INTERFACE
{
void (*Initialize)(void);
///< Pointer to MCCPx_Timer_Initialize, SCCPx_Timer_Initialize or TMRx_Initialize (e.g., \ref SCCP1_Timer_Initialize or \ref TMR1_Initialize).
void (*Deinitialize)(void);
///< Pointer to MCCPx_Timer_Deinitialize, SCCPx_Timer_Deinitialize or TMRx_Deinitialize (e.g., \ref SCCP1_Timer_Deinitialize or \ref TMR1_Deinitialize).
void (*Start)(void);
///< Pointer to MCCPx_Timer_Start, SCCPx_Timer_Start or TMRx_Start (e.g., \ref SCCP1_Timer_Start or \ref TMR1_Start).
void (*Stop)(void);
///< Pointer to MCCPx_Timer_Stop, SCCPx_Timer_Stop or TMRx_Stop (e.g., \ref SCCP1_Timer_Stop or \ref TMR1_Stop).
#if TIMER_PERIODCOUNTSET_API_SUPPORT
void (*PeriodCountSet)(size_t count);
///< Pointer to MCCPx_Timer_PeriodCountSet, SCCPx_Timer_PeriodCountSet or TMRx_PeriodCountSet (e.g., \ref SCCP1_Timer_PeriodCountSet or \ref TMR1_PeriodCountSet).
#endif
void (*PeriodSet)(uint32_t count);
///< Pointer to MCCPx_Timer_PeriodSet, SCCPx_Timer_PeriodSet or TMRx_PeriodSet (e.g., \ref SCCP1_Timer_PeriodSet or \ref TMR1_PeriodSet).
uint32_t (*PeriodGet)(void);
///< Pointer to MCCPx_Timer_PeriodGet, SCCPx_Timer_PeriodGet or TMRx_PeriodGet (e.g., \ref SCCP1_Timer_PeriodGet or \ref TMR1_PeriodGet).
uint32_t (*CounterGet)(void);
///< Pointer to MCCPx_Timer_CounterGet, SCCPx_Timer_CounterGet or TMRx_CounterGet (e.g., \ref SCCP1_Timer_CounterGet or \ref TMR1_CounterGet).
void (*CounterSet)(uint32_t count);
///< Pointer to MCCPx_Timer_CounterSet, SCCPx_Timer_CounterSet or TMRx_CounterSet (e.g., \ref SCCP1_Timer_CounterSet or \ref TMR1_CounterSet).
uint32_t (*MaxCountGet)(void);
///< Pointer to MCCPx_Timer_MaxCountGet, SCCPx_Timer_MaxCountGet or TMRx_MaxCountGet (e.g., \ref SCCP1_Timer_MaxCountGet or \ref TMR1_MaxCountGet).
#if TIMER_INTERRUPT_PRIORITY_SUPPORT
void (*InterruptPrioritySet)(enum INTERRUPT_PRIORITY priority);
///< Pointer to MCCPx_Timer_InterruptPrioritySet, SCCPx_Timer_InterruptPrioritySet or TMRx_InterruptPrioritySet (e.g., \ref SCCP1_Timer_InterruptPrioritySet or \ref TMR1_InterruptPrioritySet).
#endif
void (*TimeoutCallbackRegister)(void (*CallbackHandler)(void));
///< Pointer to MCCPx_TimeoutCallbackRegister, SCCPx_TimeoutCallbackRegister or TMRx_TimeoutCallbackRegister (e.g., \ref SCCP1_TimeoutCallbackRegister or \ref TMR1_TimeoutCallbackRegister).
void (*Tasks)(void);
///< Pointer to MCCPx_Timer_Tasks, SCCPx_Timer_Tasks or TMRx_Tasks (e.g., \ref SCCP1_Timer_Tasks or \ref TMR1_Tasks, supported only in Polling mode).
};
#endif // TIMER_INTERFACE_H

View File

@@ -0,0 +1,266 @@
/**
* TMR0 Generated Driver API Header File
*
* @file tmr0.h
*
* @defgroup tmr08bit TMR0 in 8-Bit Mode
*
* @brief This file contains API prototypes and other data types for the TMR0 driver.
*
* @version TMR0 Driver Version 3.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 TMR0_H
#define TMR0_H
#include <stdint.h>
#include <stdbool.h>
#include "tmr0_deprecated.h"
/**
* @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 tmr08bit
* @brief Defines the maximum count value of the timer.
*/
#define TMR0_MAX_COUNT (255U)
/**
* @ingroup tmr08bit
* @brief Defines the timer prescaled clock frequency in hertz.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR0_CLOCK_FREQ (10000UL)
/**
* @ingroup tmr08bit
* @brief Defines the timer interrupt ticker factor.
*/
#define TMR0_INTERRUPT_TICKER_FACTOR (1U)
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_MAX_COUNT.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_MAX_COUNT TMR0_MAX_COUNT
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_CLOCK_FREQ.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_CLOCK_FREQ TMR0_CLOCK_FREQ
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_Initialize API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_Initialize TMR0_Initialize
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_Deinitialize API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_Deinitialize TMR0_Deinitialize
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_Start API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_Start TMR0_Start
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_Stop API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_Stop TMR0_Stop
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_CounterGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_CounterGet TMR0_CounterGet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_CounterSet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_CounterSet TMR0_CounterSet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodSet API
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_PeriodSet TMR0_PeriodSet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_PeriodGet TMR0_PeriodGet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_MaxCountGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_MaxCountGet TMR0_MaxCountGet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_TMRInterruptEnable API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_TMRInterruptEnable TMR0_TMRInterruptEnable
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_TMRInterruptDisable API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_TMRInterruptDisable TMR0_TMRInterruptDisable
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_ISR API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_ISR TMR0_ISR
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodMatchCallbackRegister API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_PeriodMatchCallbackRegister TMR0_PeriodMatchCallbackRegister
/**
* @ingroup tmr08bit
* @brief Initializes the Timer0 (TMR0) module.
* This routine must be called before any other TMR0 routines.
* @param None.
* @return None.
*/
void TMR0_Initialize(void);
/**
* @ingroup tmr08bit
* @brief Deinitializes the TMR0 module.
* @param None.
* @return None.
*/
void TMR0_Deinitialize(void);
/**
* @ingroup tmr08bit
* @brief Starts the TMR0 timer.
* @pre Initialize TMR0 with TMR0_Initialize() before calling this API.
* @param None.
* @return None.
*/
void TMR0_Start(void);
/**
* @ingroup tmr08bit
* @brief Stops the TMR0 timer.
* @pre Initialize TMR0 with TMR0_Initialize() before calling this API.
* @param None.
* @return None.
*/
void TMR0_Stop(void);
/**
* @ingroup tmr08bit
* @brief Returns the current counter value.
* @pre Initialize TMR0 with TMR0_Initialize() before calling this API.
* @param None.
* @return Counter value from the TMR0L register
*/
uint8_t TMR0_CounterGet(void);
/**
* @ingroup tmr08bit
* @brief Sets the counter value.
* @pre Initialize TMR0 with TMR0_Initialize() before calling this API.
* @param counterValue - Counter value to be written to the TMR0L register
* @return None.
*/
void TMR0_CounterSet(uint8_t counterValue);
/**
* @ingroup tmr08bit
* @brief Sets the period value.
* @pre Initialize TMR0 with TMR0_Initialize() before calling this API.
* @param periodCount - Period count value written to the TMR0H register
* @return None.
*/
void TMR0_PeriodSet(uint8_t periodCount);
/**
* @ingroup tmr08bit
* @brief Returns the current period value.
* @pre Initialize TMR0 with TMR0_Initialize() before calling this API.
* @param None.
* @return Period count value from the TMR0H register
*/
uint8_t TMR0_PeriodGet(void);
/**
* @ingroup tmr08bit
* @brief Returns the maximum count value.
* @param None.
* @return Maximum count value
*/
uint8_t TMR0_MaxCountGet(void);
/**
* @ingroup tmr08bit
* @brief Enables the TMR0 interrupt.
* @param None.
* @return None.
*/
void TMR0_TMRInterruptEnable(void);
/**
* @ingroup tmr08bit
* @brief Disables the TMR0 interrupt.
* @param None.
* @return None.
*/
void TMR0_TMRInterruptDisable(void);
/**
* @ingroup tmr08bit
* @brief Interrupt Service Routine (ISR) for the TMR0 overflow or period match interrupt.
* @param None.
* @return None.
*/
void TMR0_ISR(void);
/**
* @ingroup tmr08bit
* @brief Registers a callback function for the TMR0 overflow or period match event.
* @param CallbackHandler - Address to the custom callback function
* @return None.
*/
void TMR0_PeriodMatchCallbackRegister(void (* CallbackHandler)(void));
#endif //TMR0_H

View File

@@ -0,0 +1,136 @@
/**
* TMR0 Generated Driver API Header File
*
* @file tmr0.h
*
* @defgroup tmr08bit TMR0 in 8-Bit Mode
*
* @brief This file contains the deprecated macros or APIs for the TMR0 driver.
*
* @version TMR0 Driver Version 3.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 TMR0_DEPRECATED_H
#define TMR0_DEPRECATED_H
#include <stdint.h>
#include <stdbool.h>
#warning "The tmr0_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 tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_CounterGet API.
* The TMR0_Read will be deprecated in the future release. Use TMR0_CounterGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR0_Read TMR0_CounterGet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_CounterGet API.
* The TMR_TX_Read will be deprecated in the future release. Use TMR0_CounterGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_Read TMR0_CounterGet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_CounterSet API.
* The TMR0_Write will be deprecated in the future release. Use TMR0_CounterSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR0_Write TMR0_CounterSet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_CounterSet API.
* The TMR_TX_Write will be deprecated in the future release. Use TMR0_CounterSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_Write TMR0_CounterSet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodSet API.
* The TMR0_PeriodCountSet will be deprecated in the future release. Use TMR0_PeriodSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR0_PeriodCountSet TMR0_PeriodSet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodSet API.
* The TMR_TX_PeriodCountSet will be deprecated in the future release. Use TMR0_PeriodSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_PeriodCountSet TMR0_PeriodSet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodSet API.
* The TMR0_Reload will be deprecated in the future release. Use TMR0_PeriodSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR0_Reload TMR0_PeriodSet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodSet API.
* The TMR_TX_Reload will be deprecated in the future release. Use TMR0_PeriodSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_Reload TMR0_PeriodSet
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_ISR API.
* The TMR0_OverflowISR will be deprecated in the future release. Use TMR0_ISR instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR0_OverflowISR TMR0_ISR
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_ISR API.
* The TMR_TX_OverflowISR will be deprecated in the future release. Use TMR0_ISR instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_OverflowISR TMR0_ISR
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodMatchCallbackRegister API.
* The TMR0_OverflowCallbackRegister will be deprecated in the future release. Use TMR0_PeriodMatchCallbackRegister instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR0_OverflowCallbackRegister TMR0_PeriodMatchCallbackRegister
/**
* @ingroup tmr08bit
* @brief Defines the Custom Name for the \ref TMR0_PeriodMatchCallbackRegister API.
* The TMR_TX_OverflowCallbackRegister will be deprecated in the future release. Use TMR0_PeriodMatchCallbackRegister instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_TX_OverflowCallbackRegister TMR0_PeriodMatchCallbackRegister
/**
* @}
*/
#endif //TMR0_DEPRECATED_H

View File

@@ -0,0 +1,318 @@
/**
* TMR1 Generated Driver API Header File
*
* @file tmr1.h
*
* @defgroup tmr1 TMR1
*
* @brief This file contains API prototypes and other data types for the TMR1 driver.
*
* @version TMR1 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 TMR1_H
#define TMR1_H
#include <stdbool.h>
#include <stdint.h>
#include "tmr1_deprecated.h"
/**
* @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 tmr1
* @brief Defines the maximum count value of the timer.
*/
#define TMR1_MAX_COUNT (65535U)
/**
* @ingroup tmr1
* @brief Defines the TMR1 prescaled clock frequency in hertz.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR1_CLOCK_FREQ (31000UL)
/**
* @ingroup tmr1
* @brief Defines the TMR1 ticker factor for callback function call.
*/
#define TMR1_INTERRUPT_TICKER_FACTOR (5U)
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_MAX_COUNT.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_MAX_COUNT TMR1_MAX_COUNT
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_CLOCK_FREQ.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_CLOCK_FREQ TMR1_CLOCK_FREQ
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_Initialize API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_Initialize TMR1_Initialize
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_Deinitialize API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_Deinitialize TMR1_Deinitialize
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_Start API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_Start TMR1_Start
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_Stop API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_Stop TMR1_Stop
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_CounterGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_CounterGet TMR1_CounterGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_CounterSet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_CounterSet TMR1_CounterSet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_PeriodSet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_PeriodSet TMR1_PeriodSet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_PeriodGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_PeriodGet TMR1_PeriodGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_MaxCountGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_MaxCountGet TMR1_MaxCountGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_Reload API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_Reload TMR1_Reload
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_GateStateGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_GateStateGet TMR1_GateStateGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_SinglePulseAcquisitionStart API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_SinglePulseAcquisitionStart TMR1_SinglePulseAcquisitionStart
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_GateCallbackRegister API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_GateCallbackRegister TMR1_GateCallbackRegister
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_TMRInterruptEnable API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_TMRInterruptEnable TMR1_TMRInterruptEnable
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_TMRInterruptDisable API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_TMRInterruptDisable TMR1_TMRInterruptDisable
/**
* @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 Initializes the Timer1 (TMR1) module.
* This routine must be called before any other TMR1 routines.
* @param None.
* @return None.
*/
void TMR1_Initialize(void);
/**
* @ingroup tmr1
* @brief Deinitializes the TMR1 to POR values.
* @param None.
* @return None.
*/
void TMR1_Deinitialize(void);
/**
* @ingroup tmr1
* @brief Starts the TMR1 timer.
* @pre Initialize TMR1 with TMR1_Initialize() before calling this API.
* @param None.
* @return None.
*/
void TMR1_Start(void);
/**
* @ingroup tmr1
* @brief Stops the TMR1 timer.
* @pre Initialize TMR1 with TMR1_Initialize() before calling this API.
* @param None.
* @return None.
*/
void TMR1_Stop(void);
/**
* @ingroup tmr1
* @brief Returns the current counter value.
* @pre Initialize TMR1 with TMR1_Initialize() before calling this API.
* @param None.
* @return Counter value from the TMR1 register
*/
uint16_t TMR1_CounterGet(void);
/**
* @ingroup tmr1
* @brief Sets the counter value.
* @pre Initialize TMR1 with TMR1_Initialize() before calling this API.
* @param timerVal - Counter value to be written to the TMR1 register
* @return None.
*/
void TMR1_CounterSet(uint16_t timerVal);
/**
* @ingroup tmr1
* @brief Sets the period count value for the TMR1 timer.
* The period count is calculated by subtracting the number of ticks required for the period from the maximum count.
* @param periodVal - Period value to be stored in the timer period variable
* @return None.
*/
void TMR1_PeriodSet(uint16_t periodVal);
/**
* @ingroup tmr1
* @brief Returns the period count value.
* @param None.
* @return Period count value
*/
uint16_t TMR1_PeriodGet(void);
/**
* @ingroup tmr1
* @brief Loads the period count value to the TMR1 register.
* @pre Initialize TMR1 with TMR1_Initialize() before calling this API.
* @param None.
* @return None.
*/
void TMR1_Reload(void);
/**
* @ingroup tmr1
* @brief Returns the TMR1 maximum count value.
* @param None.
* @return Maximum count value of the timer
*/
uint16_t TMR1_MaxCountGet(void);
/**
* @ingroup tmr1
* @brief Starts the single pulse acquisition in TMR1 gate operation.
* @pre Use this function only when the TMR1 gate is enabled.
* @param None.
* @return None.
*/
void TMR1_SinglePulseAcquisitionStart(void);
/**
* @ingroup tmr1
* @brief Returns the TMR1 gate state value.
* @pre Use this function only when the TMR1 gate is enabled.
* @param None.
* @return Gate state value
*/
uint8_t TMR1_GateStateGet(void);
/**
* @ingroup tmr1
* @brief Enables the TMR1 overflow interrupt.
* @param None.
* @return None.
*/
void TMR1_TMRInterruptEnable(void);
/**
* @ingroup tmr1
* @brief Disables the TMR1 overflow interrupt.
* @param None.
* @return None.
*/
void TMR1_TMRInterruptDisable(void);
/**
* @ingroup tmr1
* @brief Interrupt Service Routine (ISR) for the TMR1 overflow interrupt.
* @param None.
* @return None.
*/
void TMR1_OverflowISR(void);
/**
* @ingroup tmr1
* @brief Registers a callback function for the TMR1 overflow event.
* @param CallbackHandler - Address of the custom callback function
* @return None.
*/
void TMR1_OverflowCallbackRegister(void (* CallbackHandler)(void));
/**
* @ingroup tmr1
* @brief Registers a callback function for the TMR1 gate event.
* @param CallbackHandler - Address of the custom callback function
* @return None.
*/
void TMR1_GateCallbackRegister(void (* CallbackHandler)(void));
#endif // TMR1_H

View File

@@ -0,0 +1,117 @@
/**
* TMR1 Generated Driver API Header File
*
* @file tmr1.h
*
* @defgroup tmr1 TMR1
*
* @brief This file contains the deprecated macros or APIs for the TMR1 driver.
*
* @version TMR1 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 TMR1_DEPRECATED_H
#define TMR1_DEPRECATED_H
#warning "The tmr1_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 tmr1
* @brief Defines the Custom Name for the \ref TMR1_CounterGet API.
* The TMR1_Read will be deprecated in the future release. Use TMR1_CounterGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR1_Read TMR1_CounterGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_CounterGet API.
* The TMR_SENSOR_Read will be deprecated in the future release. Use TMR_SENSOR_CounterGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_Read TMR1_CounterGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_CounterSet API.
* The TMR1_Write will be deprecated in the future release. Use TMR1_CounterSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR1_Write TMR1_CounterSet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_CounterSet API.
* The TMR_SENSOR_Write will be deprecated in the future release. Use TMR_SENSOR_CounterSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_Write TMR1_CounterSet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_PeriodSet API.
* The TMR1_PeriodCountSet will be deprecated in the future release. Use TMR1_PeriodSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR1_PeriodCountSet TMR1_PeriodSet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_PeriodSet API.
* The TMR_SENSOR_PeriodCountSet will be deprecated in the future release. Use TMR_SENSOR_PeriodSet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_PeriodCountSet TMR1_PeriodSet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_GateStateGet API.
* The TMR1_CheckGateValueStatus will be deprecated in the future release. Use TMR1_GateStateGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR1_CheckGateValueStatus TMR1_GateStateGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_GateStateGet API.
* The TMR_SENSOR_CheckGateValueStatus will be deprecated in the future release. Use TMR_SENSOR_GateStateGet instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_CheckGateValueStatus TMR1_GateStateGet
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_SinglePulseAcquisitionStart API.
* The TMR1_StartSinglePulseAcquisition will be deprecated in the future release. Use TMR1_SinglePulseAcquisitionStart instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR1_StartSinglePulseAcquisition TMR1_SinglePulseAcquisitionStart
/**
* @ingroup tmr1
* @brief Defines the Custom Name for the \ref TMR1_SinglePulseAcquisitionStart API.
* The TMR_SENSOR_StartSinglePulseAcquisition will be deprecated in the future release. Use TMR_SENSOR_SinglePulseAcquisitionStart instead.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR_SENSOR_StartSinglePulseAcquisition TMR1_SinglePulseAcquisitionStart
#endif // TMR1_DEPRECATED_H

View File

@@ -0,0 +1,248 @@
/**
* TMR2 Generated Timer Driver API Header File
*
* @file tmr2.h
*
* @ingroup timerdriver
*
* @brief This file contains API prototypes and other data types for the TMR2 Timer 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_H
#define TMR2_H
#include <stdint.h>
#include <stdbool.h>
#include "timer_interface.h"
/**
* @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 timerdriver
* @brief Defines the TMR2 maximum count value.
*/
#define TMR2_MAX_COUNT (255U)
/**
* @ingroup timerdriver
* @brief Defines the TMR2 prescaled clock frequency in hertz.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define TMR2_CLOCK_FREQ (250000UL)
/**
* @ingroup timerdriver
* @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
* @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
* @brief Defines the Custom Name for the \ref TMR2_Initialize API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Initialize TMR2_Initialize
/**
* @ingroup timerdriver
* @brief Defines the Custom Name for the \ref TMR2_Deinitialize API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Deinitialize TMR2_Deinitialize
/**
* @ingroup timerdriver
* @brief Defines the Custom Name for the \ref TMR2_Start API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Start TMR2_Start
/**
* @ingroup timerdriver
* @brief Defines the Custom Name for the \ref TMR2_Stop API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_Stop TMR2_Stop
/**
* @ingroup timerdriver
* @brief Defines the Custom Name for the \ref TMR2_CounterGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_CounterGet TMR2_CounterGet
/**
* @ingroup timerdriver
* @brief Defines the Custom Name for the \ref TMR2_CounterSet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_CounterSet TMR2_CounterSet
/**
* @ingroup timerdriver
* @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
* @brief Defines the Custom Name for the \ref TMR2_MaxCountGet API.
*/
/* cppcheck-suppress misra-c2012-2.5 */
#define Timer2_MaxCountGet TMR2_MaxCountGet
/**
* @ingroup timerdriver
* @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
*/
/* 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.
*/
extern const struct TIMER_INTERFACE Timer2;
/**
* Section: TMR2 APIs
*/
/**
* @ingroup timerdriver
* @brief Initializes the Timer2 (TMR2) module.
* This routine must be called before any other TMR2 routines.
* @param None.
* @return None.
*/
void TMR2_Initialize(void);
/**
* @ingroup timerdriver
* @brief Deinitializes the TMR2 to Power-on Reset (POR) values.
* @param None.
* @return None.
*/
void TMR2_Deinitialize(void);
/**
* @ingroup timerdriver
* @brief Starts the TMR2 timer.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param None.
* @return None.
*/
void TMR2_Start(void);
/**
* @ingroup timerdriver
* @brief Stops the TMR2 timer.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param None.
* @return None.
*/
void TMR2_Stop(void);
/**
* @ingroup timerdriver
* @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
*/
uint32_t TMR2_CounterGet(void);
/**
* @ingroup timerdriver
* @brief Sets the counter value.
* @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);
/**
* @ingroup timerdriver
* @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);
/**
* @ingroup timerdriver
* @brief Returns the current period value.
* @pre Initialize TMR2 with TMR2_Initialize() before calling this API.
* @param None.
* @return Period count value
*/
uint32_t TMR2_PeriodGet(void);
/**
* @ingroup timerdriver
* @brief Returns the maximum count value of the timer.
* @param None.
* @return Maximum count value of the timer
*/
uint32_t TMR2_MaxCountGet(void);
/**
* @ingroup timerdriver
* @brief Interrupt Service Routine (ISR) for the TMR2 period match event.
* @param None.
* @return None.
*/
void TMR2_ISR(void);
/**
* @ingroup timerdriver
* @brief Registers a callback function for the TMR2 period match event.
* @param CallbackHandler - Address of the custom callback function
* @return None.
*/
void TMR2_PeriodMatchCallbackRegister(void (* callbackHandler)(void));
#endif // TMR2_H
/**
End of File
*/