introduce polarity, use 30 sine values

This commit is contained in:
Wolfgang Hottgenroth 2016-10-15 08:26:43 +02:00
parent 9cdbf0a8e7
commit b479b1416f

View File

@ -15,7 +15,7 @@
#include <isr_compat.h> #include <isr_compat.h>
#define NUM_OF_SINE_VALUES 20 #define NUM_OF_SINE_VALUES 30
volatile uint8_t pulseWidthIdx = 0; volatile uint8_t pulseWidthIdx = 0;
@ -27,20 +27,20 @@ ISR(TIMER1_A0, TA1_ISR_Ovrfl) {
if (pulseWidthIdx == 0) { if (pulseWidthIdx == 0) {
P2OUT |= BIT3; P2OUT |= BIT3;
} }
if (pulseWidthIdx == 13) { if (pulseWidthIdx == (NUM_OF_SINE_VALUES / 3)) {
P2OUT |= BIT4; P2OUT |= BIT4;
} }
if (pulseWidthIdx == 26) { if (pulseWidthIdx == (NUM_OF_SINE_VALUES / 3 * 2)) {
P2OUT |= BIT5; P2OUT |= BIT5;
} }
} else { } else {
if (pulseWidthIdx == 0) { if (pulseWidthIdx == 0) {
P2OUT |= BIT4; P2OUT |= BIT4;
} }
if (pulseWidthIdx == 13) { if (pulseWidthIdx == (NUM_OF_SINE_VALUES / 3)) {
P2OUT |= BIT3; P2OUT |= BIT3;
} }
if (pulseWidthIdx == 26) { if (pulseWidthIdx == (NUM_OF_SINE_VALUES / 3 * 2)) {
P2OUT |= BIT5; P2OUT |= BIT5;
} }
} }