use PROGMEM for the pitch-to-period lookup table
This commit is contained in:
parent
b6de9ecaee
commit
149dcf9001
|
@ -44,7 +44,7 @@ print("")
|
||||||
print("constexpr unsigned int midi_pitch_offset = " + str(start_pitch) + ";")
|
print("constexpr unsigned int midi_pitch_offset = " + str(start_pitch) + ";")
|
||||||
print("constexpr unsigned int midi_pitch_max = " + str(end_pitch) + ";")
|
print("constexpr unsigned int midi_pitch_max = " + str(end_pitch) + ";")
|
||||||
print("// period is in units of 0.5 us, instead of 1 us")
|
print("// period is in units of 0.5 us, instead of 1 us")
|
||||||
print("constexpr unsigned long midi_pitch_period[" + str(end_pitch - start_pitch) + "] = {")
|
print("constexpr PROGMEM unsigned long midi_pitch_period[" + str(end_pitch - start_pitch) + "] = {")
|
||||||
|
|
||||||
for i in range(start_pitch, end_pitch):
|
for i in range(start_pitch, end_pitch):
|
||||||
period = int(2.0 * pitch_to_period_micros(i))
|
period = int(2.0 * pitch_to_period_micros(i))
|
||||||
|
|
|
@ -77,7 +77,7 @@ void MotorControl::TickAtPitch(unsigned int midi_pitch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TickOn(midi_pitch_period[midi_pitch - midi_pitch_offset]);
|
TickOn(pgm_read_dword_near(midi_pitch_period + (midi_pitch - midi_pitch_offset)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorControl::TickPitchBend(int bend) {
|
void MotorControl::TickPitchBend(int bend) {
|
||||||
|
|
Loading…
Reference in New Issue