Skip to content

Commit 22ab6d3

Browse files
committed
return LUTFreq and tweak timing of output interrupts... add stereo_tog to
accepted external commands and ... add VNote/LNote to updateNote() ... and cleave off 256 bytes from the unused sysEx xdata buffer for the future
1 parent 58f9524 commit 22ab6d3

File tree

5 files changed

+178
-159
lines changed

5 files changed

+178
-159
lines changed

Blinky.c

+16-9
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ sbit WRAP_FREQ = songFlags^7; //if told to move beyond limits of txFreq, wrap ar
4747
//try moving to locals!!!
4848
//#define NUM_RIFFS HEAVY_11_SONG_SIZE//SAUCER_VOLCANO_SONG_SIZE//THUMP1_SONG_SIZE//3//FOR_SONG_ALT_SIZE//FIRST_SONG_ALT_SIZE//THIRD_SONG_SIZE//
4949
volatile RIFF_T* curSong;
50-
volatile word nextRiff = 0;
51-
volatile byte curRiffCnt = 0;
52-
volatile word numRiffs = 0;
50+
volatile word xdata nextRiff = 0;
51+
volatile byte xdata curRiffCnt = 0;
52+
volatile word xdata numRiffs = 0;
5353
volatile byte code* riff;
5454
//deltaSongPos ... just ... cant.. be ... a ... byte....
5555
volatile word deltaPos = 0;
@@ -83,6 +83,8 @@ volatile byte periodL1 = 0;
8383
//helpful shadows...
8484
volatile word LPeriod;
8585
volatile word VPeriod;
86+
volatile byte LNote;
87+
volatile byte VNote;
8688

8789
volatile word lDelta = 0;
8890
volatile word txDelta = 0;
@@ -714,15 +716,19 @@ void timers_isr1 (void) interrupt 3 using 2
714716
//reload
715717
TH1 = periodH1; //remember this only counts up!!!!
716718
TL1 = periodL1;
719+
//Match to other ISR
720+
_nop_();
721+
_nop_();
722+
_nop_();
717723
//generate square waves
718724
if(AUDIO_L_ON) { //could play with nops here
719725
audioL ^= 1;
720726
}
721727
#ifdef DAC1_OUT_AUDIO
722-
AD1DAT3 = LUTSIN128[dac1LUTdex++ & 0x7F];
728+
AD1DAT3 = LUTSIN[dac1LUTdex++ & LUTSINMASK];
723729
#else
724730
//just for the delay... hopefully it doesnt mess up ADC0
725-
AD1DAT0 = LUTSIN128[dac1LUTdex & 0x7F];
731+
AD1DAT0 = LUTSIN[dac1LUTdex & LUTSINMASK];
726732
#endif
727733
#endif
728734
}
@@ -766,9 +772,9 @@ void timers_isr0 (void) interrupt 1 using 3
766772
txVcc = 1; //tx OFF! station???
767773
}
768774
#ifdef DAC1_OUT_VCC
769-
AD1DAT3 = LUTSIN128[dac1LUTdex++ & 0x7F];
775+
AD1DAT3 = LUTSIN[dac1LUTdex++ & LUTSINMASK];
770776
#else
771-
AD1DAT0 = LUTSIN128[dac1LUTdex & 0x7F];
777+
AD1DAT0 = LUTSIN[dac1LUTdex & LUTSINMASK];
772778
#endif
773779
#endif
774780
}
@@ -1054,8 +1060,7 @@ void updateNote(void) {
10541060
case STATION_DOWN:
10551061
setFreq(--station);
10561062
break;
1057-
1058-
case HOLD1:
1063+
10591064
case SET_DAC:
10601065
//TODO
10611066
break;
@@ -1076,11 +1081,13 @@ void updateNote(void) {
10761081
temp -= LUT_MIDI_NOTE_SHIFT;
10771082
if (VnotL == 1) {
10781083
TX_VCC_ON = 1;
1084+
VNote = temp;
10791085
VPeriod = LUTFreq[temp];
10801086
periodH0 = (0xff & (LUTFreq[temp] >> 8));
10811087
periodL0 = (0xff & LUTFreq[temp]);
10821088
} else {
10831089
AUDIO_L_ON = 1;
1090+
LNote = temp;
10841091
LPeriod = LUTFreq[temp];
10851092
periodH1 = (0xff & (LUTFreq[temp] >> 8));
10861093
periodL1 = (0xff & LUTFreq[temp]);

LUTFreq.c

+112-113
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,112 @@
1-
#include "LUTFreq.h"
2-
3-
const unsigned int code LUTFreq[LUT_LEN] = {
4-
// 0,
5-
// 0,
6-
// 0,
7-
// 0,
8-
// 0,
9-
// 0,
10-
// 0,
11-
// 0,
12-
// 0,
13-
// 0,
14-
0,
15-
2465,
16-
6003,
17-
9338,
18-
12503,
19-
15483,
20-
18292,
21-
20944,
22-
23450,
23-
25819,
24-
28051,
25-
30156,
26-
32147,
27-
34024,
28-
35798,
29-
37470,
30-
39048,
31-
40538,
32-
41943,
33-
43271,
34-
44524,
35-
45706,
36-
46822,
37-
47876,
38-
48870,
39-
49809,
40-
50695,
41-
51531,
42-
52320,
43-
53065,
44-
53768,
45-
54432,
46-
55058,
47-
55650,
48-
56208,
49-
56735,
50-
57232,
51-
57701,
52-
58144,
53-
58562,
54-
58957,
55-
59329,
56-
59681,
57-
60013,
58-
60326,
59-
60622,
60-
60901,
61-
61164,
62-
61413,
63-
61647,
64-
61869,
65-
62078,
66-
62275,
67-
62461,
68-
62637,
69-
62803,
70-
62960,
71-
63108,
72-
63247,
73-
63379,
74-
63503,
75-
63620,
76-
63731,
77-
63836,
78-
63934,
79-
64027,
80-
64115,
81-
64198,
82-
64277,
83-
64351,
84-
64420,
85-
64486,
86-
64548,
87-
64607,
88-
64662,
89-
64715,
90-
64764,
91-
64810,
92-
64854,
93-
64896,
94-
64935,
95-
64972,
96-
65007,
97-
65040,
98-
65071,
99-
65100,
100-
65128,
101-
65154,
102-
65179,
103-
65202,
104-
65224,
105-
65245,
106-
65264,
107-
65283,
108-
65300,
109-
65317,
110-
65332,
111-
65347,
112-
65361
113-
};
1+
#include "LUTFreq.h"
2+
3+
const unsigned int code LUTFreq[LUT_LEN] = {
4+
// 0,
5+
// 0,
6+
// 0,
7+
// 0,
8+
// 0,
9+
// 0,
10+
// 0,
11+
// 0,
12+
// 0,
13+
0,
14+
2339,
15+
5884,
16+
9225,
17+
12398,
18+
15383,
19+
18197,
20+
20855,
21+
23366,
22+
25740,
23+
27977,
24+
30085,
25+
32080,
26+
33961,
27+
35739,
28+
37414,
29+
38996,
30+
40488,
31+
41896,
32+
43227,
33+
44482,
34+
45667,
35+
46785,
36+
47841,
37+
48837,
38+
49778,
39+
50665,
40+
51503,
41+
52294,
42+
53040,
43+
53745,
44+
54410,
45+
55038,
46+
55630,
47+
56190,
48+
56717,
49+
57216,
50+
57686,
51+
58130,
52+
58549,
53+
58944,
54+
59317,
55+
59670,
56+
60002,
57+
60316,
58+
60612,
59+
60892,
60+
61156,
61+
61405,
62+
61640,
63+
61862,
64+
62071,
65+
62269,
66+
62456,
67+
62632,
68+
62798,
69+
62955,
70+
63103,
71+
63243,
72+
63375,
73+
63499,
74+
63617,
75+
63728,
76+
63833,
77+
63932,
78+
64025,
79+
64113,
80+
64196,
81+
64274,
82+
64349,
83+
64418,
84+
64484,
85+
64547,
86+
64605,
87+
64661,
88+
64713,
89+
64763,
90+
64809,
91+
64853,
92+
64895,
93+
64934,
94+
64971,
95+
65006,
96+
65039,
97+
65070,
98+
65100,
99+
65127,
100+
65154,
101+
65178,
102+
65202,
103+
65224,
104+
65245,
105+
65264,
106+
65283,
107+
65300,
108+
65317,
109+
65332,
110+
65347,
111+
65361
112+
};

LUTFreq.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define LUTFREQ_H
33

44
#define LUT_NUM_NOTES 99
5-
#define LUT_MIDI_NOTE_SHIFT 10
5+
#define LUT_MIDI_NOTE_SHIFT 9
66
#define LUT_LEN (LUT_NUM_NOTES)
77
#define LUT_NOTE_LIMIT (LUT_LEN + LUT_MIDI_NOTE_SHIFT)
88

0 commit comments

Comments
 (0)