introduce direction flag
This commit is contained in:
parent
daf4613cd1
commit
9cdbf0a8e7
@ -19,17 +19,30 @@
|
||||
|
||||
|
||||
volatile uint8_t pulseWidthIdx = 0;
|
||||
volatile bool direction = true;
|
||||
|
||||
|
||||
ISR(TIMER1_A0, TA1_ISR_Ovrfl) {
|
||||
if (pulseWidthIdx == 0) {
|
||||
P2OUT |= BIT3;
|
||||
}
|
||||
if (pulseWidthIdx == 13) {
|
||||
P2OUT |= BIT4;
|
||||
}
|
||||
if (pulseWidthIdx == 26) {
|
||||
P2OUT |= BIT5;
|
||||
if (direction) {
|
||||
if (pulseWidthIdx == 0) {
|
||||
P2OUT |= BIT3;
|
||||
}
|
||||
if (pulseWidthIdx == 13) {
|
||||
P2OUT |= BIT4;
|
||||
}
|
||||
if (pulseWidthIdx == 26) {
|
||||
P2OUT |= BIT5;
|
||||
}
|
||||
} else {
|
||||
if (pulseWidthIdx == 0) {
|
||||
P2OUT |= BIT4;
|
||||
}
|
||||
if (pulseWidthIdx == 13) {
|
||||
P2OUT |= BIT3;
|
||||
}
|
||||
if (pulseWidthIdx == 26) {
|
||||
P2OUT |= BIT5;
|
||||
}
|
||||
}
|
||||
|
||||
pulseWidthIdx++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user