diff options
| author | Ayke van Laethem | 2017-11-13 18:52:02 +0100 |
|---|---|---|
| committer | Damien George | 2018-07-18 17:12:25 +1000 |
| commit | 83f38a99a9831203a9764986ed7fac8060a875dd (patch) | |
| tree | 7c909ee2869103130f481635ec02eb93ee5ff474 | |
| parent | a2b4c93e85df539cb9d657096505dfd0523f8fa9 (diff) | |
nrf/hal/hal_nvmc: Fix non-SD code.
The code wasn't tested yet without a SoftDevice.
| -rw-r--r-- | ports/nrf/hal/hal_nvmc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ports/nrf/hal/hal_nvmc.c b/ports/nrf/hal/hal_nvmc.c index c5ac1697d..d790a0145 100644 --- a/ports/nrf/hal/hal_nvmc.c +++ b/ports/nrf/hal/hal_nvmc.c @@ -35,13 +35,13 @@ #ifdef HAL_NVMC_MODULE_ENABLED -#if BLUETOOTH_SD - // Rotates bits in `value` left `shift` times. STATIC inline uint32_t rotate_left(uint32_t value, uint32_t shift) { return (value << shift) | (value >> (32 - shift)); } +#if BLUETOOTH_SD + STATIC volatile uint8_t hal_nvmc_operation_state = HAL_NVMC_BUSY; STATIC void operation_init() { @@ -158,7 +158,7 @@ bool hal_nvmc_write_byte(byte *dest_in, byte b) { uint32_t value = 0xffffff00 | b; // Rotate bits in value to an aligned position. - value = rotate_left(value, 24 - (dest - dest_aligned) * 8); + value = rotate_left(value, (dest & 3) * 8); // Put the value at the right place. *(uint32_t*)dest_aligned = value; |
