Flipklok
 
Loading...
Searching...
No Matches
pinInterrupts.c
Go to the documentation of this file.
1/*
2 * pinInterrupts.c
3 *
4 * Created on: 27 mrt. 2025
5 */
10
11#include "pinInterrupts.h"
12#include "dcfReceive.h"
13#include "timeKeeping.h"
14
15
16volatile unsigned int lastDirection = 0; // 0 = counting up, 1 = counting down
17
18volatile int toggle123 = 0;
19
25#pragma vector=PORT1_VECTOR
26__interrupt void port1ISR(void)
27{
28// if (P1IFG & BIT0) // Check if interrupt occurred on P2.0
29// {
30// P1IFG &= ~BIT0; // Clear interrupt flag
31// }
32// if (P1IFG & BIT1) // P1.1
33// {
34// P1IFG &= ~BIT1; // Clear interrupt flag
35// }
36// if (P1IFG & BIT2) // P1.2 // start bit time measurement for DCF77 signals
37// {
38// P1IFG &= ~BIT2; // Clear flag
39// }
40// if (P1IFG & BIT3) // P1.3
41// {
42// P1IFG &= ~BIT3; // Clear interrupt flag
43// }
44// if (P1IFG & BIT4) // P1.4
45// {
46// P1IFG &= ~BIT4; // Clear interrupt flag
47// }
48 if (P1IFG & BIT5) // P1.5 DCF pin
49 {
50 P1IFG &= ~BIT5; // Clear interrupt flag
51 P1IE |= BIT5; // Re-enable interrupt for P1.5
52 __no_operation();
53 if (0 == countDcf77Messages)
54 {
55 if (toggle123 == 1)
56 {
57 P1OUT |= BIT7; //Toggle indicator LED
58 toggle123 = 0;
59 }
60 else
61 {
62 P1OUT &= ~BIT7; //Toggle indicator LED
63 toggle123 = 1;
64 }
65 }
66 if(1 == toggleInterruptDcf)
67 {
69 }
70
71 __no_operation();
72 }
73// if (P1IFG & BIT6) // P1.6
74// {
75// P1IFG &= ~BIT6; // Clear interrupt flag
76// }
77// if (P1IFG & BIT7) // P1.7
78// {
79// P1IFG &= ~BIT7; // Clear interrupt flag
80// }
81
82}
83
89#pragma vector=PORT2_VECTOR
90__interrupt void port2ISR(void)
91{
92 // Check if interrupt occurred
93 if (P2IFG & BIT0) // P2.0
94 {
95 P2IFG &= ~BIT0; // Clear interrupt flag
96 }
97 if (P2IFG & BIT1) // P2.1 fwdButton
98 {
99 P2IE &= ~BIT1; // disable interrupt
100 if(1 == toggleFwdInterruptISR)
101 {
102 __no_operation();
103 if (timerCompareStepperSpeedToggle == 0) // Toggle edge interrupt If rising edge was set, switch to falling & vice versa
104 {
105 P2IES |= BIT1;
108 TA0CCTL2 |= CCIE; // TACCR2 interrupt enable
109 }
110 else
111 {
112 P2IES &= ~BIT1;
115
116 // TA0CCTL2 &= ~CCIE; not needed stepperAdvance enables calculateTime function automaticly when remaining steps are 0 // TACCR2 interrupt disable control back to calculateTimeDifference function
117 }
118 }
119 else //turn speed toggle off when function is disabled
120 {
122 }
123
124 P2IFG &= ~BIT1; // Clear interrupt flag
125 P2IE |= BIT1; // enable interrupt
126 }
127// if (P2IFG & BIT2) // P2.2
128// {
129// P2IFG &= ~BIT2; // Clear interrupt flag
130// }
131// if (P2IFG & BIT3) // P2.3
132// {
133// P2IFG &= ~BIT3; // Clear interrupt flag
134// }
135// if (P2IFG & BIT4) // P2.4
136// {
137// P2IFG &= ~BIT4; // Clear interrupt flag
138// }
139// if (P2IFG & BIT5) // P2.5
140// {
141// P2IFG &= ~BIT5; // Clear interrupt flag
142// }
143// if (P2IFG & BIT6) // P2.6
144// {
145// P2IFG &= ~BIT6; // Clear interrupt flag
146// }
147// if (P2IFG & BIT7) // P2.7
148// {
149// P2IFG &= ~BIT7; // Clear interrupt flag
150// }
151}
void interruptDcf()
Time the DCF77 pulses gets called from pin interrupt port1ISR(void)
Definition dcfReceive.c:26
uint32_t countDcf77Messages
Definition dcfReceive.h:49
bool toggleInterruptDcf
Definition dcfReceive.h:24
__interrupt void port2ISR(void)
Interrupt vector of port2, gets called when a interrupt on this port is reached.
volatile int toggle123
volatile unsigned int lastDirection
__interrupt void port1ISR(void)
Interrupt vector of port1, gets called when a interrupt on this port is reached.
bool toggleFwdInterruptISR
bool toggleFwdInterrupt
bool timerCompareStepperSpeedToggle