@@ 47,8 47,8 @@
* Various tone sequences
*/
extern const __flash uint8_t sine_wave[WAVE_STEPS / 4 + 1];
-extern const __flash uint8_t tones_fixed[10];
-extern const __flash uint8_t tones_lfsr[16];
-extern const __flash uint8_t tones_morse[2];
+extern const __flash uint16_t tones_fixed[10];
+extern const __flash uint16_t tones_lfsr[16];
+extern const __flash uint16_t tones_morse[2];
#endif
@@ 378,7 378,7 @@ void gen_sample(void)
tone = next_fixed_tone(tone);
}
- dphase = tones_fixed[tone] << 8;
+ dphase = tones_fixed[tone];
break;
case STATE_PLAYING_LFSR:
if (!steps) {
@@ 386,7 386,7 @@ void gen_sample(void)
tone = next_lfsr_tone(tone);
}
- dphase = tones_lfsr[tone] << 8;
+ dphase = tones_lfsr[tone];
break;
case STATE_PLAYING_IDENT:
if (!steps) {
@@ 401,7 401,7 @@ void gen_sample(void)
phase = 0;
}
- dphase = tones_morse[tone] << 8;
+ dphase = tones_morse[tone];
break;
}
@@ 25,7 25,7 @@
#define DIV_ROUND_UP(x, y) (((x) + (y) - 1) / (y))
#define HZ_TO_STEPS(freq) \
- DIV_ROUND_UP((freq), (OUT_SAMPLE_RATE / WAVE_STEPS))
+ DIV_ROUND_UP((freq) * 256ul, (OUT_SAMPLE_RATE / WAVE_STEPS))
#define E4 HZ_TO_STEPS(330)
#define G4 HZ_TO_STEPS(392)
@@ 44,12 44,12 @@
#define D7 HZ_TO_STEPS(2349)
/* a fixed sequence of tones that play in order */
-const __flash uint8_t tones_fixed[] = {
+const __flash uint16_t tones_fixed[] = {
C6, C5, D6, D5, E6, E5, G6, G5, A6, A5,
};
/* a set of tones for a 4-bit LFSR */
-const __flash uint8_t tones_lfsr[16] = {
+const __flash uint16_t tones_lfsr[16] = {
0, /* never used since LFSRs are never 0 */
E4, G4, A4,
C5, D5, E5, G5, A5,
@@ 57,6 57,6 @@ const __flash uint8_t tones_lfsr[16] = {
C7, D7,
};
-const __flash uint8_t tones_morse[2] = {
+const __flash uint16_t tones_morse[2] = {
0, D5,
};