Skip to content

Commit

Permalink
fixup! cpu/sam0_common: flashpage: split RWWEE and normal functions
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Jul 27, 2020
1 parent 2aadddf commit 65c7efa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cpu/sam0_common/periph/flashpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/

#include <assert.h>
#include <string.h>

#include "cpu.h"
#include "periph/flashpage.h"
Expand Down Expand Up @@ -114,10 +113,17 @@ static void _cmd_write_page(void)

static void _write_page(void* dst, const void *data, size_t len, void (*cmd_write)(void))
{
uint32_t *dst32 = dst;

_unlock();
_cmd_clear_page_buffer();

memcpy(dst, data, len);
/* copy whole words */
const uint32_t *data32 = data;
while (len) {
*dst32++ = *data32++;
len -= sizeof(uint32_t);
}

cmd_write();
_lock();
Expand Down

0 comments on commit 65c7efa

Please sign in to comment.