Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf] No need to store buffer_length as part of audiopwmio_pwmaudioout_obj_t #4335

Merged
merged 1 commit into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t* self,
if (max_buffer_length > UINT16_MAX) {
mp_raise_ValueError_varg(translate("Buffer length %d too big. It must be less than %d"), max_buffer_length, UINT16_MAX);
}
self->buffer_length = (uint16_t)max_buffer_length;
self->buffers[0] = m_malloc(self->buffer_length * 2 * sizeof(uint16_t), false);
uint16_t buffer_length = (uint16_t)max_buffer_length;
self->buffers[0] = m_malloc(buffer_length * 2 * sizeof(uint16_t), false);
if (!self->single_buffer)
self->buffers[1] = m_malloc(self->buffer_length * 2 * sizeof(uint16_t), false);
self->buffers[1] = m_malloc(buffer_length * 2 * sizeof(uint16_t), false);


uint32_t top;
Expand Down
1 change: 0 additions & 1 deletion ports/nrf/common-hal/audiopwmio/PWMAudioOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ typedef struct {
NRF_PWM_Type *pwm;
uint16_t *buffers[2];

uint16_t buffer_length;
uint16_t quiescent_value;
uint16_t scale;

Expand Down