Fix up single-byte access to nvm.ByteArray

This commit is contained in:
Nick Moore 2019-04-16 14:32:27 +10:00
parent 83dad37562
commit 9c42a72275
2 changed files with 2 additions and 3 deletions

View File

@ -31,8 +31,6 @@
typedef struct {
mp_obj_base_t base;
uint32_t start_address;
uint32_t len;
} nvm_bytearray_obj_t;
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_NVM_BYTEARRAY_H

View File

@ -124,7 +124,8 @@ STATIC mp_obj_t nvm_bytearray_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj
#endif
} else {
// Single index rather than slice.
size_t index = mp_get_index(self->base.type, self->len, index_in, false);
size_t index = mp_get_index(self->base.type, common_hal_nvm_bytearray_get_length(self),
index_in, false);
if (value == MP_OBJ_SENTINEL) {
// load
uint8_t value_out;