summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2019-11-25 11:43:51 -0600
committerJeff Epler <jepler@gmail.com>2019-11-25 11:43:51 -0600
commit1ee35fd6fde6ef6e1aa9fd8d5d15cfd821f2a83d (patch)
treee8f478584289aaf5c2605105885010562bfabf2d
parent47a6eaa297216d3d1120f99dbc6a574797384700 (diff)
nrf: i2sout: move register settings closer together
.. just for consistency's sake
-rw-r--r--ports/nrf/common-hal/audiobusio/I2SOut.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ports/nrf/common-hal/audiobusio/I2SOut.c b/ports/nrf/common-hal/audiobusio/I2SOut.c
index 1110c8446..9958e5f00 100644
--- a/ports/nrf/common-hal/audiobusio/I2SOut.c
+++ b/ports/nrf/common-hal/audiobusio/I2SOut.c
@@ -250,6 +250,10 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
NRF_I2S->CONFIG.SWIDTH = self->bytes_per_sample == 1
? I2S_CONFIG_SWIDTH_SWIDTH_8Bit
: I2S_CONFIG_SWIDTH_SWIDTH_16Bit;
+ NRF_I2S->CONFIG.CHANNELS = self->channel_count == 1
+ ? I2S_CONFIG_CHANNELS_CHANNELS_Left
+ : I2S_CONFIG_CHANNELS_CHANNELS_Stereo;
+
choose_i2s_clocking(self, sample_rate);
/* Allocate buffers based on a maximum duration
* This duration was chosen empirically based on what would
@@ -273,9 +277,6 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
self->stopping = false;
i2s_buffer_fill(self);
- NRF_I2S->CONFIG.CHANNELS = self->channel_count == 1 ? I2S_CONFIG_CHANNELS_CHANNELS_Left : I2S_CONFIG_CHANNELS_CHANNELS_Stereo;
-
-
NRF_I2S->RXTXD.MAXCNT = self->buffer_length / 4;
NRF_I2S->ENABLE = I2S_ENABLE_ENABLE_Enabled;