aboutsummaryrefslogtreecommitdiffhomepage
path: root/source/Core/BSP/Pinecilv2/flash.c
blob: af29843149a126ec639202f76caba499e651f96c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * flash.c
 *
 *  Created on: 29 May 2020
 *      Author: Ralim
 */

#include "BSP.h"
#include "BSP_Flash.h"
#include "hal_flash.h"
#include "string.h"

void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
  BL_Err_Type err = flash_erase(SETTINGS_START_PAGE, FLASH_PAGE_SIZE);
  err             = flash_write(SETTINGS_START_PAGE, buffer, length);
}

void flash_read_buffer(uint8_t *buffer, const uint16_t length) { flash_read(SETTINGS_START_PAGE, buffer, length); }