Skip to content

Commit 9c42a72

Browse files
committed
Fix up single-byte access to nvm.ByteArray
1 parent 83dad37 commit 9c42a72

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

ports/nrf/common-hal/nvm/ByteArray.h

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
typedef struct {
3333
mp_obj_base_t base;
34-
uint32_t start_address;
35-
uint32_t len;
3634
} nvm_bytearray_obj_t;
3735

3836
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_NVM_BYTEARRAY_H

shared-bindings/nvm/ByteArray.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ STATIC mp_obj_t nvm_bytearray_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj
124124
#endif
125125
} else {
126126
// Single index rather than slice.
127-
size_t index = mp_get_index(self->base.type, self->len, index_in, false);
127+
size_t index = mp_get_index(self->base.type, common_hal_nvm_bytearray_get_length(self),
128+
index_in, false);
128129
if (value == MP_OBJ_SENTINEL) {
129130
// load
130131
uint8_t value_out;

0 commit comments

Comments
 (0)