Digital Power Starter Kit 3 Firmware
dsPIC33C Boost Converter Voltage Mode Control Example
p33c_timer.h
1 /*************************************************************************************************
2  * @file p33c_ccp.h
3  * @author I62419
4  * @date Created on October 12, 2020, 5:41 PM
5  ************************************************************************************************/
6 
7 /*************************************************************************************************
8  * @brief Generic Capture Compare Driver Module (header file)
9  * @details
10  * This additional header file contains defines for all required bit-settings of all related
11  * special function registers of a peripheral module and/or instance.
12  * This file is an additional header file on top of the generic device header file.
13  ************************************************************************************************/
14 
15 #ifndef P33C_TIMER16_SFR_ABSTRACTION_H
16 #define P33C_TIMER16_SFR_ABSTRACTION_H
17 
18 #include <xc.h> // include processor files - each processor file is guarded.
19 #include <stdint.h> // include standard integer data types
20 #include <stdbool.h> // include standard boolean data types
21 #include <stddef.h> // include standard definition data types
22 
23 
24 #ifndef P33C_TIMER_MODULE_s
25 
26 /***********************************************************************************
27  * @ingroup lib-layer-pral-properties-public-timer
28  * @struct P33C_TIMER_MODULE_s
29  * @brief Abstracted set of Special Function Registers of the 16-bit timer peripheral module
30  * @details
31  * This structure defines an abstracted set of Special Function Registers of the
32  * single 16-bit general purpose timer peripheral. Users can use this abstracted
33  * set of registers to capture register settings from or write generic register
34  * settings to a specific instance of this peripheral.
35  *
36  **********************************************************************************/
37 
39 
40  union {
41  struct tagT1CONBITS bits; // Register bit-field
42  uint16_t value; // 16-bit wide register value
43  } TxCON; // TxCON: Timer X CONTROL REGISTER
44 
45  volatile unsigned :16; // (reserved)
46 
47  union {
48  struct {
49  uint16_t CNT;
50  } bits; // Register bit-field
51  uint16_t value; // 16-bit wide register value
52  } TMRx; // TMRx TIMER COUNTER REGISTER
53 
54  volatile unsigned :16; // (reserved)
55 
56  union {
57  struct {
58  uint16_t PER;
59  } bits; // Register bit-field
60  uint16_t value; // 16-bit wide register value
61  } PRx; // PRx TIMER PERIOD REGISTER
62 
63  } __attribute__((packed));
64 
66 
67 
68 /*********************************************************************************
69  * @def p33c_TimerModule_GetHandle(x)
70  * @ingroup lib-layer-pral-functions-public-timer
71  * @brief Returns a pointer to the start address of the Timer SFR block
72  * @return Pointer address to Timer SFR block of type struct P33C_TIMER_MODULE_s
73  *
74  * @details
75  * This macro returns the address pointer (tmrHandle) of the Timer Special
76  * Function Register. The handle can be used to assign a global variable
77  * in user code, which allows to directly read from/write to Timer registers
78  * with zero API overhead.
79  *
80  *********************************************************************************/
81  #define p33c_TimerModule_GetHandle() (struct P33C_TIMER_MODULE_s*)&T1CON;
82 
83 #endif
84 
85 /* GLOBAL FUNCTION CALL PROTOTYPES */
86 extern volatile struct P33C_TIMER_MODULE_s p33c_Timer_ConfigRead(void);
87 extern volatile uint16_t p33c_Timer_ConfigWrite(volatile struct P33C_TIMER_MODULE_s tmrConfig);
88 
89 #endif /* P33C_TIMER16_SFR_ABSTRACTION_H */
90 
91 // end of file
union P33C_TIMER_MODULE_s::@336 TxCON
union P33C_TIMER_MODULE_s::@337 TMRx
struct tagT1CONBITS bits
Definition: p33c_timer.h:41
union P33C_TIMER_MODULE_s::@338 PRx