nrf: i2sout: Assign SWIDTH

The sample width register was never set, so all samples were played
as though they were 16 bit.

After this change, 8-bit samples no longer produce audio on the MAX 98357A
BOB, because only 16-, 24-, and 32-bit samples are supported by the
hardware.  This will be addressed by a future change to pad samples to
16 bits; see #2323 and the 98357A datasheet page 6.
This commit is contained in:
Jeff Epler 2019-11-25 11:43:29 -06:00
parent 8f4bab2d24
commit 47a6eaa297
1 changed files with 4 additions and 0 deletions

View File

@ -246,6 +246,10 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
self->single_buffer = single_buffer;
self->samples_signed = samples_signed;
NRF_I2S->CONFIG.SWIDTH = self->bytes_per_sample == 1
? I2S_CONFIG_SWIDTH_SWIDTH_8Bit
: I2S_CONFIG_SWIDTH_SWIDTH_16Bit;
choose_i2s_clocking(self, sample_rate);
/* Allocate buffers based on a maximum duration
* This duration was chosen empirically based on what would