Skip to content

Commit d2056a4

Browse files
authored
Merge pull request #4335 from tyomitch/main
[nrf] No need to store `buffer_length` as part of `audiopwmio_pwmaudioout_obj_t`
2 parents bed96a9 + e0b96c0 commit d2056a4

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

ports/nrf/common-hal/audiopwmio/PWMAudioOut.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t* self,
259259
if (max_buffer_length > UINT16_MAX) {
260260
mp_raise_ValueError_varg(translate("Buffer length %d too big. It must be less than %d"), max_buffer_length, UINT16_MAX);
261261
}
262-
self->buffer_length = (uint16_t)max_buffer_length;
263-
self->buffers[0] = m_malloc(self->buffer_length * 2 * sizeof(uint16_t), false);
262+
uint16_t buffer_length = (uint16_t)max_buffer_length;
263+
self->buffers[0] = m_malloc(buffer_length * 2 * sizeof(uint16_t), false);
264264
if (!self->single_buffer)
265-
self->buffers[1] = m_malloc(self->buffer_length * 2 * sizeof(uint16_t), false);
265+
self->buffers[1] = m_malloc(buffer_length * 2 * sizeof(uint16_t), false);
266266

267267

268268
uint32_t top;

ports/nrf/common-hal/audiopwmio/PWMAudioOut.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ typedef struct {
3535
NRF_PWM_Type *pwm;
3636
uint16_t *buffers[2];
3737

38-
uint16_t buffer_length;
3938
uint16_t quiescent_value;
4039
uint16_t scale;
4140

0 commit comments

Comments
 (0)