Update cubesatsim.ino

pull/153/head
alanbjohnston 4 years ago committed by GitHub
parent 90ed124608
commit a84c120216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2021,10 +2021,11 @@ void pwm_interrupt_handler() {
// based on code https://github.com/rgrosset/pico-pwm-audio // based on code https://github.com/rgrosset/pico-pwm-audio
// //
pwm_clear_irq(pwm_gpio_to_slice_num(AUDIO_OUT_PIN)); pwm_clear_irq(pwm_gpio_to_slice_num(AUDIO_OUT_PIN));
if (wav_position < (WAV_DATA_LENGTH<<3) - 1) { // if (wav_position < (WAV_DATA_LENGTH<<3) - 1) {
if (wav_position > (buffer_size - 1)) {
// set pwm level // set pwm level
// allow the pwm value to repeat for 8 cycles this is >>3 // allow the pwm value to repeat for 8 cycles this is >>3
pwm_set_gpio_level(AUDIO_OUT_PIN, buffer[wav_position>>3]); pwm_set_gpio_level(AUDIO_OUT_PIN, buffer[wav_position]);
wav_position++; wav_position++;
} else { } else {
// reset to start // reset to start

Loading…
Cancel
Save

Powered by TurnKey Linux.