Update UC3 platform driver support to use the bitmasks defined in the header files...
[pub/USBasp.git] / Projects / MIDIToneGenerator / MIDIToneGenerator.c
index f923486..e1008a7 100644 (file)
@@ -57,7 +57,7 @@ USB_ClassInfo_MIDI_Device_t Keyboard_MIDI_Interface =
        };\r
 \r
 /** 8-bit 256 entry Sine Wave lookup table */\r
-const uint8_t SineTable[256] =\r
+static const uint8_t SineTable[256] =\r
 {\r
        128, 131, 134, 137, 140, 143, 146, 149, 152, 156, 159, 162, 165, 168, 171, 174,\r
        176, 179, 182, 185, 188, 191, 193, 196, 199, 201, 204, 206, 209, 211, 213, 216,\r
@@ -78,7 +78,8 @@ const uint8_t SineTable[256] =
 };\r
 \r
 /** Array of structures describing each note being generated */\r
-DDSNoteData NoteData[MAX_SIMULTANEOUS_NOTES];\r
+static DDSNoteData NoteData[MAX_SIMULTANEOUS_NOTES];\r
+\r
 \r
 /** Main program entry point. This routine contains the overall program flow, including initial\r
  *  setup of all components and the main program loop.\r
@@ -165,7 +166,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
                if (NoteData[i].Pitch)\r
                {\r
                        /* Use the top 8 bits of the table position as the sample table index */\r
-                       uint8_t TableIndex = ((uint8_t*)&NoteData[i].TablePosition)[3];\r
+                       uint8_t TableIndex = (NoteData[i].TablePosition >> 24);\r
                        \r
                        /* Add the new tone sample to the accumulator and increment the table position */\r
                        MixedSample += SineTable[TableIndex];\r