diff options
| author | Nick Moore <nick@zoic.org> | 2019-01-31 10:50:07 +1100 |
|---|---|---|
| committer | Nick Moore <nick@zoic.org> | 2019-04-16 14:53:44 +1000 |
| commit | df89156f2f3c39e5f2e49c7803ad30f50576f9cb (patch) | |
| tree | 0ec2bfa6f7a2e7ec6f2d1c4e50473ccc7f577f6d /ports | |
| parent | 4826994599e19ed28454de5a80bff2dc313ffb21 (diff) | |
Start on nRF nvm.ByteArray adafruit/circuitpython#1042 (doesn't do anything yet)
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h | 2 | ||||
| -rw-r--r-- | ports/nrf/common-hal/microcontroller/__init__.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h index eb8be7608..21232d2b3 100644 --- a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h +++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h @@ -55,7 +55,7 @@ #define CIRCUITPY_AUTORELOAD_DELAY_MS 500 -// TODO #define CIRCUITPY_INTERNAL_NVM_SIZE 8192 +#define CIRCUITPY_INTERNAL_NVM_SIZE (4096) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index c2e0c5b41..f29b0eb95 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -24,9 +24,14 @@ * THE SOFTWARE. */ +#include "py/mphal.h" +#include "py/obj.h" +#include "py/runtime.h" + #include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/nvm/ByteArray.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" @@ -63,6 +68,17 @@ const mcu_processor_obj_t common_hal_mcu_processor_obj = { }, }; +#if CIRCUITPY_INTERNAL_NVM_SIZE > 0 +// The singleton nvm.ByteArray object. +const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = { + .base = { + .type = &nvm_bytearray_type, + }, + .len = CIRCUITPY_INTERNAL_NVM_SIZE, + .start_address = 0 +}; +#endif + STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_P0_00), MP_ROM_PTR(&pin_P0_00) }, |
