introduce direction flag

This commit is contained in:
Wolfgang Hottgenroth 2016-10-14 14:57:26 +02:00
parent daf4613cd1
commit 9cdbf0a8e7

View File

@ -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++;