Skip to content

Commit

Permalink
Merge pull request #192 from shorepine/pipcio
Browse files Browse the repository at this point in the history
Fixing pi pico Arduino example (#183)
  • Loading branch information
bwhitman authored Aug 27, 2024
2 parents cb5ae46 + 0703a7a commit 2306eba
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions examples/AMY_Test_Pi_Pico/AMY_Test_Pi_Pico.ino
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ void setup() {

void loop() {
// In your loop you have to get the buffer of samples and then play it out your device
uint8_t * samples = (uint8_t*)amy.render_to_buffer();
// Block until ready
while(i2s.availableForWrite()<AMY_BLOCK_SIZE*BYTES_PER_SAMPLE*AMY_NCHANS);
size_t written = i2s.write((const uint8_t*)samples, (size_t)AMY_BLOCK_SIZE*BYTES_PER_SAMPLE*AMY_NCHANS);
Serial.println(written);
int16_t * samples = (int16_t*)amy.render_to_buffer();
for(uint16_t i=0;i<AMY_BLOCK_SIZE;i++) {
i2s.write16(samples[i], samples[i]);
}
}

0 comments on commit 2306eba

Please sign in to comment.