/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
/* Copyright (c) 2016 King Kévin */
/* this library is used to store (read and write) data in flash */
/* peripherals used: none */
#include // device signature utilities
// how much data (in bytes) should we be able to store (be sure it's available and does not overlap the firmware)
#define STORAGE_SIZE 2048
// the end of the flash area where to store data
#define STORAGE_END FLASH_BASE+DESIG_FLASH_SIZE
// the start of the flash area where to store data (be sure it's after the firmware data)
// we will only use the last kilobytes
#define STORAGE_START STORAGE_END-STORAGE_SIZE
/* read data from address into
* returns if read succeeded */
bool storage_read(uint32_t address, uint8_t *buffer, size_t size);
/* write data from to address
* returns if write succeeded */
bool storage_write(uint32_t address, uint8_t *buffer, size_t size);