Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion modules/io/audioout/pico/audioout-pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
#include "pico/audio_i2s.h"
#include "modTimer.h"

#ifndef MODDEF_AUDIOOUT_I2S_BITSPERSAMPLE
#define MODDEF_AUDIOOUT_I2S_BITSPERSAMPLE 16
#endif
#ifndef MODDEF_AUDIOOUT_I2S_DATAOUT_PIN
#define MODDEF_AUDIOOUT_I2S_DATAOUT_PIN PICO_AUDIO_I2S_DATA_PIN
#endif
#ifndef MODDEF_AUDIOOUT_I2S_BCK_PIN
#define MODDEF_AUDIOOUT_I2S_BCK_PIN PICO_AUDIO_I2S_CLOCK_PIN_BASE
#endif
#ifndef MODDEF_AUDIOOUT_I2S_LR_PIN
#define MODDEF_AUDIOOUT_I2S_LR_PIN (MODDEF_AUDIOOUT_I2S_BCK_PIN + 1)
#endif

typedef struct AudioOutElementRecord AudioOutElementRecord;
typedef struct AudioOutElementRecord *AudioOutElement;

Expand Down Expand Up @@ -576,7 +589,7 @@ int doWrite(AudioOut audioOut, void *audioData, xsUnsignedValue requested)
int16_t volumeFixed = audioOut->volumeFixed;
int requestedSamples = amt >> 1; //@@ broken for stereo & 8 bit
int16_t *src = (int16_t *)audioData;
int16_t *samples = buffer->buffer->bytes + audioOut->bufferPendingPos;
int16_t *samples = (int16_t *)(buffer->buffer->bytes + audioOut->bufferPendingPos);
int i;
for (i=0; i<requestedSamples; i++)
samples[i] = (*src++ * volumeFixed) >> 8;
Expand Down
6 changes: 6 additions & 0 deletions modules/io/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"include": "./manifests/esp32/manifest.json"
},
"pico": {
"include": "./manifests/pico/manifest.json"
},
"pico/pico_w": {
"include": "./manifests/pico/manifest_net.json"
},
"pico/pico_2_w": {
"include": "./manifests/pico/manifest_net.json"
},
"nrf52": {
Expand Down
3 changes: 1 addition & 2 deletions modules/io/manifests/pico/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"$(IO)/analog/manifest.json",
"$(IO)/audioout/manifest.json",
"$(IO)/digital/manifest.json",
"$(IO)/i2c/manifest.json"
"$(IO)/i2c/manifest.json",
"$(IO)/pulsecount/manifest.json",
"$(IO)/pwm/manifest.json",
"$(IO)/serial/manifest.json",
Expand All @@ -18,7 +18,6 @@
"$(MODULES)/pins/digital/pico/modGPIO"
],
"commodetto/Bitmap": "$(COMMODETTO)/commodettoBitmap",

"system": "$(IO)/system/*"
},
"preload": [
Expand Down