@mchp-mcc/scf-pic8-interrupt-v3 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +8 -0
- package/LICENSE.txt +21 -0
- package/Readme.md +14 -0
- package/lib/generated_module/src/index.js +11 -0
- package/output/autoCreator.js +3859 -0
- package/output/autoCreator.js.map +1 -0
- package/output/autoProcessor.js +3861 -0
- package/output/autoProcessor.js.map +1 -0
- package/output/creator.js +7482 -0
- package/output/creator.js.map +1 -0
- package/output/interrupt_manager_priorityDisabled.c.ftl +169 -0
- package/output/interrupt_manager_priorityDisabled.h.ftl +178 -0
- package/output/nullPrototype.json +49 -0
- package/output/processor.js +7482 -0
- package/output/processor.js.map +1 -0
- package/package.json +221 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interrupt Manager Generated Driver File
|
|
3
|
+
*
|
|
4
|
+
* @file interrupt.c
|
|
5
|
+
*
|
|
6
|
+
* @ingroup interrupt
|
|
7
|
+
*
|
|
8
|
+
* @brief This file contains the API implementation for the Interrupt Manager driver.
|
|
9
|
+
*
|
|
10
|
+
* @version Interrupt Manager Driver Version 2.0.5
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
${disclaimer}
|
|
14
|
+
|
|
15
|
+
#include "../../${header[0].path}${header[0].name}"
|
|
16
|
+
#include "../../system/system.h"
|
|
17
|
+
#include "../pins.h"
|
|
18
|
+
|
|
19
|
+
<#list allocatedPins as intPin>
|
|
20
|
+
void (*${intPin.functionName}_InterruptHandler)(void);
|
|
21
|
+
</#list>
|
|
22
|
+
|
|
23
|
+
void INTERRUPT_Initialize (void)
|
|
24
|
+
{
|
|
25
|
+
<#if IPENData??>
|
|
26
|
+
// ${IPENData.comment}
|
|
27
|
+
${IPENData.name} = ${IPENData.value};
|
|
28
|
+
|
|
29
|
+
</#if>
|
|
30
|
+
<#list allocatedPins as pin>
|
|
31
|
+
// Clear the interrupt flag
|
|
32
|
+
<#if pin.edge??>
|
|
33
|
+
// Set the external interrupt edge detect
|
|
34
|
+
</#if>
|
|
35
|
+
${pin.customName}_InterruptFlagClear();
|
|
36
|
+
<#if pin.edge??>
|
|
37
|
+
${pin.customName}_${pin.edge}EdgeSet();
|
|
38
|
+
</#if>
|
|
39
|
+
// Set Default Interrupt Handler
|
|
40
|
+
${pin.functionName}_SetInterruptHandler(${pin.functionName}_DefaultInterruptHandler);
|
|
41
|
+
<#if pin.interruptEnabled == false>// </#if>${pin.customName}_InterruptEnable();
|
|
42
|
+
|
|
43
|
+
</#list>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
<#if hasHighInterrupts>
|
|
47
|
+
/**
|
|
48
|
+
* @ingroup interrupt
|
|
49
|
+
* @brief Services the Interrupt Service Routines (ISR) of enabled interrupts and is called every time an interrupt is triggered.
|
|
50
|
+
* @pre Interrupt Manager is initialized.
|
|
51
|
+
* @param None.
|
|
52
|
+
* @return None.
|
|
53
|
+
*/
|
|
54
|
+
void __interrupt() INTERRUPT_InterruptManager (void)
|
|
55
|
+
{
|
|
56
|
+
<#assign isIfCondUsedBefore = false>
|
|
57
|
+
<#assign isPieInterruptConfigured = false>
|
|
58
|
+
// interrupt handler
|
|
59
|
+
<#list highInterrupts as interrupt>
|
|
60
|
+
<#if isIfCondUsedBefore && serviceSingleIsrPerInterrupt>
|
|
61
|
+
<#assign if_cmd = "else if">
|
|
62
|
+
<#else>
|
|
63
|
+
<#assign if_cmd = "if">
|
|
64
|
+
</#if>
|
|
65
|
+
<#if (!interrupt.isPeripheralInterrupt || !pieAvailable)>
|
|
66
|
+
<#assign isIfCondUsedBefore = true>
|
|
67
|
+
${if_cmd}(${interrupt.enable} == 1 && ${interrupt.flag} == 1)
|
|
68
|
+
{
|
|
69
|
+
<#if interrupt.generateISR>
|
|
70
|
+
${interrupt.isrCallback.name}();
|
|
71
|
+
<#else>
|
|
72
|
+
//${interrupt.isrCallback.name}();
|
|
73
|
+
</#if>
|
|
74
|
+
}
|
|
75
|
+
<#else>
|
|
76
|
+
<#assign isPieInterruptConfigured = true>
|
|
77
|
+
</#if>
|
|
78
|
+
</#list>
|
|
79
|
+
<#if isPieInterruptConfigured>
|
|
80
|
+
<#if isIfCondUsedBefore && serviceSingleIsrPerInterrupt>
|
|
81
|
+
<#assign if_cmd = "else if">
|
|
82
|
+
<#else>
|
|
83
|
+
<#assign if_cmd = "if">
|
|
84
|
+
</#if>
|
|
85
|
+
${if_cmd}(${INTCON.settings.PEIE.bitName} == 1)
|
|
86
|
+
{
|
|
87
|
+
<#assign isIfCondUsedBefore = false>
|
|
88
|
+
<#list highInterrupts as interrupt>
|
|
89
|
+
<#if isIfCondUsedBefore && serviceSingleIsrPerInterrupt>
|
|
90
|
+
<#assign if_cmd = "else if">
|
|
91
|
+
<#else>
|
|
92
|
+
<#assign if_cmd = "if">
|
|
93
|
+
</#if>
|
|
94
|
+
<#if (interrupt.isPeripheralInterrupt && pieAvailable)>
|
|
95
|
+
<#assign isIfCondUsedBefore = true>
|
|
96
|
+
${if_cmd}(${interrupt.enable} == 1 && ${interrupt.flag} == 1)
|
|
97
|
+
{
|
|
98
|
+
<#if interrupt.generateISR>
|
|
99
|
+
${interrupt.isrCallback.name}();
|
|
100
|
+
<#else>
|
|
101
|
+
//${interrupt.isrCallback.name}();
|
|
102
|
+
</#if>
|
|
103
|
+
}
|
|
104
|
+
</#if>
|
|
105
|
+
</#list>
|
|
106
|
+
<#if preemptiveHigh>
|
|
107
|
+
else
|
|
108
|
+
{
|
|
109
|
+
//Unhandled Interrupt
|
|
110
|
+
}
|
|
111
|
+
</#if>
|
|
112
|
+
}
|
|
113
|
+
</#if>
|
|
114
|
+
<#if preemptiveHigh>
|
|
115
|
+
else
|
|
116
|
+
{
|
|
117
|
+
//Unhandled Interrupt
|
|
118
|
+
}
|
|
119
|
+
</#if>
|
|
120
|
+
}
|
|
121
|
+
</#if>
|
|
122
|
+
|
|
123
|
+
<#list allocatedPins as intPin>
|
|
124
|
+
<#if vectoredInterruptEnabled>
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @ingroup interrupt
|
|
128
|
+
* @brief Execute whenever the signal on the ${intPin.functionName} pin will transition to the preconfigured state.
|
|
129
|
+
* @pre Interrupt Manager is initialized.
|
|
130
|
+
* @param None.
|
|
131
|
+
* @return None.
|
|
132
|
+
*/
|
|
133
|
+
<#if intPin.isHighPriority>
|
|
134
|
+
void __interrupt(irq(${intPin.getIRQname}),base(${IVTBaseAddress})) ${intPin.functionName}_ISR()
|
|
135
|
+
<#else>
|
|
136
|
+
void __interrupt(irq(${intPin.getIRQname}),base(${IVTBaseAddress}),low_priority) ${intPin.functionName}_ISR()
|
|
137
|
+
</#if>
|
|
138
|
+
<#else>
|
|
139
|
+
void ${intPin.functionName}_ISR(void)
|
|
140
|
+
</#if>
|
|
141
|
+
{
|
|
142
|
+
${intPin.customName}_InterruptFlagClear();
|
|
143
|
+
|
|
144
|
+
// Callback function gets called everytime this ISR executes
|
|
145
|
+
${intPin.functionName}_CallBack();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
void ${intPin.functionName}_CallBack(void)
|
|
150
|
+
{
|
|
151
|
+
// Add your custom callback code here
|
|
152
|
+
if(${intPin.functionName}_InterruptHandler)
|
|
153
|
+
{
|
|
154
|
+
${intPin.functionName}_InterruptHandler();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
void ${intPin.functionName}_SetInterruptHandler(void (* InterruptHandler)(void)){
|
|
159
|
+
${intPin.functionName}_InterruptHandler = InterruptHandler;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
void ${intPin.functionName}_DefaultInterruptHandler(void){
|
|
163
|
+
// add your ${intPin.functionName} interrupt custom code
|
|
164
|
+
// or set custom function using ${intPin.functionName}_SetInterruptHandler()
|
|
165
|
+
}
|
|
166
|
+
</#list>
|
|
167
|
+
/**
|
|
168
|
+
End of File
|
|
169
|
+
*/
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interrupt Manager Generated Driver API Header File
|
|
3
|
+
*
|
|
4
|
+
* @file interrupt.h
|
|
5
|
+
*
|
|
6
|
+
* @defgroup interrupt INTERRUPT
|
|
7
|
+
*
|
|
8
|
+
* @brief This file contains API prototypes and other data types for the Interrupt Manager driver.
|
|
9
|
+
*
|
|
10
|
+
* @version Interrupt Manager Driver Version 2.0.5
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
${disclaimer}
|
|
14
|
+
|
|
15
|
+
#ifndef INTERRUPT_H
|
|
16
|
+
#define INTERRUPT_H
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @ingroup interrupt
|
|
21
|
+
* @brief Enables global interrupts.
|
|
22
|
+
* @param None.
|
|
23
|
+
* @return None.
|
|
24
|
+
*/
|
|
25
|
+
#define INTERRUPT_GlobalInterruptEnable() (${INTCON.settings.GIE.bitName} = 1)
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @ingroup interrupt
|
|
29
|
+
* @brief Disables global interrupts.
|
|
30
|
+
* @param None.
|
|
31
|
+
* @return None.
|
|
32
|
+
*/
|
|
33
|
+
#define INTERRUPT_GlobalInterruptDisable() (${INTCON.settings.GIE.bitName} = 0)
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @ingroup interrupt
|
|
37
|
+
* @brief Returns the Global Interrupt Enable bit status.
|
|
38
|
+
* @param None.
|
|
39
|
+
* @retval 0 - Global interrupt disabled.
|
|
40
|
+
* @retval 1 - Global interrupt enabled.
|
|
41
|
+
*/
|
|
42
|
+
#define INTERRUPT_GlobalInterruptStatus() (${INTCON.settings.GIE.bitName})
|
|
43
|
+
|
|
44
|
+
<#if pieAvailable>
|
|
45
|
+
/**
|
|
46
|
+
* @ingroup interrupt
|
|
47
|
+
* @brief Enables peripheral interrupts.
|
|
48
|
+
* @param None.
|
|
49
|
+
* @return None.
|
|
50
|
+
*/
|
|
51
|
+
#define INTERRUPT_PeripheralInterruptEnable() (${INTCON.settings.PEIE.bitName} = 1)
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @ingroup interrupt
|
|
55
|
+
* @brief Disables peripheral interrupts.
|
|
56
|
+
* @param None.
|
|
57
|
+
* @return None.
|
|
58
|
+
*/
|
|
59
|
+
#define INTERRUPT_PeripheralInterruptDisable() (${INTCON.settings.PEIE.bitName} = 0)
|
|
60
|
+
</#if>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @ingroup interrupt
|
|
64
|
+
* @brief Initializes peripheral interrupt priorities, enables or disables priority vectors and initializes the external interrupt.
|
|
65
|
+
* @param None.
|
|
66
|
+
* @return None.
|
|
67
|
+
*/
|
|
68
|
+
void INTERRUPT_Initialize (void);
|
|
69
|
+
|
|
70
|
+
<#list allocatedPins as intPin>
|
|
71
|
+
<#-- if intPin.interruptEnabled -->
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @ingroup interrupt
|
|
75
|
+
* @brief Clears the Interrupt flag for the external interrupt, ${intPin.functionName}.
|
|
76
|
+
* @param None.
|
|
77
|
+
* @return None.
|
|
78
|
+
*/
|
|
79
|
+
#define ${intPin.customName}_InterruptFlagClear() (${intPin.flagName} = 0)
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @ingroup interrupt
|
|
83
|
+
* @brief Clears the interrupt enable for the external interrupt, ${intPin.functionName}. This way, the external interrupts on this pin will not be serviced by the interrupt handler.
|
|
84
|
+
* @param None.
|
|
85
|
+
* @return None.
|
|
86
|
+
*/
|
|
87
|
+
#define ${intPin.customName}_InterruptDisable() (${intPin.enableBitName} = 0)
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @ingroup interrupt
|
|
91
|
+
* @brief Sets the interrupt enable for the external interrupt, ${intPin.functionName}. This way, the external interrupts on this pin will be serviced by the interrupt handler.
|
|
92
|
+
* @param None.
|
|
93
|
+
* @return None.
|
|
94
|
+
*/
|
|
95
|
+
#define ${intPin.customName}_InterruptEnable() (${intPin.enableBitName} = 1)
|
|
96
|
+
|
|
97
|
+
<#if intPin.edge?? && intPin.SFREdgeDetectFromPin??>
|
|
98
|
+
/**
|
|
99
|
+
* @ingroup interrupt
|
|
100
|
+
* @brief Sets the edge detect of the external interrupt to positive edge. This way, the Interrupt flag will be set when the external interrupt pin level transitions from low to high.
|
|
101
|
+
* @param None.
|
|
102
|
+
* @return None.
|
|
103
|
+
*/
|
|
104
|
+
#define ${intPin.customName}_risingEdgeSet() (${intPin.SFREdgeDetectFromPin} = 1)
|
|
105
|
+
</#if>
|
|
106
|
+
|
|
107
|
+
<#if intPin.edge?? && intPin.SFREdgeDetectFromPin??>
|
|
108
|
+
/**
|
|
109
|
+
* @ingroup interrupt
|
|
110
|
+
* @brief Sets the edge detect of the external interrupt to negative edge. This way, the Interrupt flag will be set when the external interrupt pin level transitions from high to low.
|
|
111
|
+
* @param None.
|
|
112
|
+
* @return None.
|
|
113
|
+
*/
|
|
114
|
+
#define ${intPin.customName}_fallingEdgeSet() (${intPin.SFREdgeDetectFromPin} = 0)
|
|
115
|
+
</#if>
|
|
116
|
+
<#-- /#if -->
|
|
117
|
+
</#list>
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
Section: External Interrupt Handlers
|
|
121
|
+
*/
|
|
122
|
+
<#list allocatedPins as intPin>
|
|
123
|
+
<#if vectoredInterruptEnabled>
|
|
124
|
+
<#else>
|
|
125
|
+
<#-- if intPin.interruptEnabled -->
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @ingroup interrupt
|
|
129
|
+
* @brief Executes the ISR whenever the signal on the ${intPin.functionName} pin transitions to the preconfigured state.
|
|
130
|
+
* @pre Interrupt Manager is initialized.
|
|
131
|
+
* @param None.
|
|
132
|
+
* @return None.
|
|
133
|
+
*/
|
|
134
|
+
void ${intPin.functionName}_ISR(void);
|
|
135
|
+
</#if>
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @ingroup interrupt
|
|
139
|
+
* @brief Allows for a specific callback function to be called in the ${intPin.functionName} ISR and for a nonspecific interrupt handler to be called at run time.
|
|
140
|
+
* @pre Interrupt Manager is initialized.
|
|
141
|
+
* @param None.
|
|
142
|
+
* @return None.
|
|
143
|
+
*/
|
|
144
|
+
void ${intPin.functionName}_CallBack(void);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @ingroup interrupt
|
|
148
|
+
* @brief Allows selecting an interrupt handler for ${intPin.customName} - ${intPin.functionName} at application run time.
|
|
149
|
+
* @pre Interrupt Manager is initialized.
|
|
150
|
+
* @param (*InterruptHandler)(void) - InterruptHandler function pointer.
|
|
151
|
+
* @return None.
|
|
152
|
+
*/
|
|
153
|
+
void ${intPin.functionName}_SetInterruptHandler(void (* InterruptHandler)(void));
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @ingroup interrupt
|
|
157
|
+
* @brief Dynamic interrupt handler to be called every time the ${intPin.functionName} ISR is executed. It allows any function to be registered at run time.
|
|
158
|
+
* @pre Interrupt Manager is initialized.
|
|
159
|
+
* @param None.
|
|
160
|
+
* @return None.
|
|
161
|
+
*/
|
|
162
|
+
extern void (*${intPin.functionName}_InterruptHandler)(void);
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @ingroup interrupt
|
|
166
|
+
* @brief Default interrupt handler to be called every time the ${intPin.functionName} ISR is executed. It allows any function to be registered at run time.
|
|
167
|
+
* @pre Interrupt Manager is initialized.
|
|
168
|
+
* @param None.
|
|
169
|
+
* @return None.
|
|
170
|
+
*/
|
|
171
|
+
void ${intPin.functionName}_DefaultInterruptHandler(void);
|
|
172
|
+
<#-- /#if -->
|
|
173
|
+
</#list>
|
|
174
|
+
|
|
175
|
+
#endif // INTERRUPT_H
|
|
176
|
+
/**
|
|
177
|
+
End of File
|
|
178
|
+
*/
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"payload": null,
|
|
3
|
+
"imports": {
|
|
4
|
+
"scf_pic8_interrupt_v3": {
|
|
5
|
+
"interfaceId": {
|
|
6
|
+
"name": "scf-pic8-interrupt-v3",
|
|
7
|
+
"version": "1.0.0"
|
|
8
|
+
},
|
|
9
|
+
"isRequired": true
|
|
10
|
+
},
|
|
11
|
+
"initializer_system": {
|
|
12
|
+
"interfaceId": {
|
|
13
|
+
"name": "initializer-system",
|
|
14
|
+
"version": "^0"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"initializer_main": {
|
|
18
|
+
"interfaceId": {
|
|
19
|
+
"name": "initializer-main",
|
|
20
|
+
"version": "^0"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"pin_standard": {
|
|
24
|
+
"interfaceId": {
|
|
25
|
+
"name": "pin-standard",
|
|
26
|
+
"version": "^0"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"device_meta": {
|
|
30
|
+
"interfaceId": {
|
|
31
|
+
"name": "device-meta",
|
|
32
|
+
"version": "^1"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
"interrupt": {
|
|
38
|
+
"interfaces": [
|
|
39
|
+
{
|
|
40
|
+
"interfaceId": {
|
|
41
|
+
"name": "interrupt-standard",
|
|
42
|
+
"version": "1.0.1"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"isEntryPoint": true
|
|
49
|
+
}
|