| Digital Power Starter Kit 3 Firmware dsPIC33C Boost Converter Voltage Mode Control Example |

p33c_opa.h
1 /* Microchip Technology Inc. and its subsidiaries. You may use this software
2 * and any derivatives exclusively with Microchip products.
3 *
4 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
5 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
6 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
7 * PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
8 * WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
9 *
10 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
11 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
12 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
13 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
14 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS
15 * IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF
16 * ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
17 *
18 * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
19 * TERMS.
20 */
21
22 /**************************************************************************************************
23 * @file p33c_opa.h
24 * @see p33c_opa.c
25 * @brief Generic Operational Amplifier Driver Module (header file)
26 * @details
27 * This additional header file contains defines for all required bit-settings of all related
28 * special function registers of a peripheral module and/or instance.
29 * This file is an additional header file on top of the generic device header file.
30 *
31 *************************************************************************************************/
32
33 // This is a guard condition so that contents of this file are not included
34 // more than once.
35 #ifndef P33C_OPA_SFR_ABSTRACTION_H
36 #define P33C_OPA_SFR_ABSTRACTION_H
37
38 // Include standard header files
39 #include <xc.h> // include processor files - each processor file is guarded.
40 #include <stdint.h> // include standard integer data types
41 #include <stdbool.h> // include standard boolean data types
42 #include <stddef.h> // include standard definition data types
43
44
45 // GENERIC PDM OP-AMP MODULE SPECIAL FUNCTION REGISTER SET
46 #ifndef P33C_OPA_MODULE_s
47
48 struct P33C_OPA_MODULE_s{
49 union {
50 volatile struct tagAMPCON1LBITS bits; // Register bit-field
51 volatile uint16_t value; // 16-bit wide register value
52 } AmpCon1L; // (AMPCON1L) OP-AMP CONTROL 1 REGISTER LOW
53 union {
54 volatile struct tagAMPCON1HBITS bits; // Register bit-field
55 volatile uint16_t value; // 16-bit wide register value
56 } AmpCon1H; // (AMPCON1H) OP-AMP CONTROL 2 REGISTER LOW
57 } __attribute__((packed));
58 typedef struct P33C_OPA_MODULE_s P33C_OPA_MODULE_t; // PDM OP-AMP MODULE REGISTER SET
59
60 /*********************************************************************************
61 * @def p33c_OpaModule_GetHandle()
62 * @ingroup lib-layer-pral-functions-public-opa
63 * @brief Gets pointer to op-amp Module SFR set
64 * @return struct P33C_OPA_MODULE_s*: Pointer to op-amp module special function register set object
65 *
66 * @details
67 * This macro returns the pointer to a op-amp module register set
68 * Special Function Register memory space. This pointer can be used to
69 * directly write to/read from the Special Function Registers of the
70 * op-amp peripheral module configuration.
71 *********************************************************************************/
72
73 #define p33c_OpaModule_GetHandle() (struct P33C_OPA_MODULE_s*)&AMPCON1L // Captures memory address of first OPA module register
74
75 #endif
76
77
78 /* ********************************************************************************************* *
79 * API FUNCTION PROTOTYPES
80 * ********************************************************************************************* */
81
82 extern volatile uint16_t p33c_OpaModule_Dispose(void);
83
84 extern volatile struct P33C_OPA_MODULE_s p33c_OpaModule_ConfigRead(void);
85 extern volatile uint16_t p33c_OpaModule_ConfigWrite(
86 volatile struct P33C_OPA_MODULE_s opaConfig
87 );
88
89
90 /* ********************************************************************************************* *
91 * OP-AMP INSTANCE CONFIGURATION TEMPLATES
92 * ********************************************************************************************* */
93 extern volatile struct P33C_OPA_MODULE_s opaModuleConfigClear;
94 extern volatile struct P33C_OPA_MODULE_s opaModuleDefault;
95
96 #endif /* P33C_OPA_SFR_ABSTRACTION_H */
97
98 // end of file
P33C_OPA_MODULE_s
Definition: p33c_opa.h:48
P33C_OPA_MODULE_s::AmpCon1H
union P33C_OPA_MODULE_s::@202 AmpCon1H
P33C_OPA_MODULE_s::bits
volatile struct tagAMPCON1LBITS bits
Definition: p33c_opa.h:50
P33C_OPA_MODULE_s::AmpCon1L
union P33C_OPA_MODULE_s::@201 AmpCon1L
P33C_OPA_MODULE_s::value
volatile uint16_t value
Definition: p33c_opa.h:51