Skip to content

Commit 1ee35fd

Browse files
committed
nrf: i2sout: move register settings closer together
.. just for consistency's sake
1 parent 47a6eaa commit 1ee35fd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ports/nrf/common-hal/audiobusio/I2SOut.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
250250
NRF_I2S->CONFIG.SWIDTH = self->bytes_per_sample == 1
251251
? I2S_CONFIG_SWIDTH_SWIDTH_8Bit
252252
: I2S_CONFIG_SWIDTH_SWIDTH_16Bit;
253+
NRF_I2S->CONFIG.CHANNELS = self->channel_count == 1
254+
? I2S_CONFIG_CHANNELS_CHANNELS_Left
255+
: I2S_CONFIG_CHANNELS_CHANNELS_Stereo;
256+
253257
choose_i2s_clocking(self, sample_rate);
254258
/* Allocate buffers based on a maximum duration
255259
* This duration was chosen empirically based on what would
@@ -273,9 +277,6 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
273277
self->stopping = false;
274278
i2s_buffer_fill(self);
275279

276-
NRF_I2S->CONFIG.CHANNELS = self->channel_count == 1 ? I2S_CONFIG_CHANNELS_CHANNELS_Left : I2S_CONFIG_CHANNELS_CHANNELS_Stereo;
277-
278-
279280
NRF_I2S->RXTXD.MAXCNT = self->buffer_length / 4;
280281
NRF_I2S->ENABLE = I2S_ENABLE_ENABLE_Enabled;
281282

0 commit comments

Comments
 (0)