2018-08-29 22:14:49 +02:00
|
|
|
/*
|
|
|
|
* This software is experimental and a work in progress.
|
|
|
|
* Under no circumstances should these files be used in relation to any critical system(s).
|
|
|
|
* Use of these files is at your own risk.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
|
|
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
2019-08-30 20:19:03 +02:00
|
|
|
* This files are free to use from https://github.com/rogerclarkmelbourne/Arduino_STM32 and
|
2018-08-29 22:14:49 +02:00
|
|
|
* https://github.com/leaflabs/libmaple
|
|
|
|
*
|
|
|
|
* Modifications for QMK and STM32F303 by Yiancar
|
|
|
|
*/
|
|
|
|
|
2020-12-26 05:56:11 +01:00
|
|
|
#pragma once
|
2018-08-29 22:14:49 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2019-08-30 20:19:03 +02:00
|
|
|
extern "C" {
|
2018-08-29 22:14:49 +02:00
|
|
|
#endif
|
|
|
|
|
2020-12-11 03:45:24 +01:00
|
|
|
#include <ch.h>
|
|
|
|
#include <hal.h>
|
2018-08-29 22:14:49 +02:00
|
|
|
|
2019-08-30 20:19:03 +02:00
|
|
|
typedef enum { FLASH_BUSY = 1, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_ERROR_OPT, FLASH_COMPLETE, FLASH_TIMEOUT, FLASH_BAD_ADDRESS } FLASH_Status;
|
2018-08-29 22:14:49 +02:00
|
|
|
|
|
|
|
#define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) < 0x0807FFFF))
|
|
|
|
|
|
|
|
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout);
|
|
|
|
FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
|
|
|
|
FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
|
|
|
|
|
|
|
|
void FLASH_Unlock(void);
|
|
|
|
void FLASH_Lock(void);
|
2019-01-07 02:22:19 +01:00
|
|
|
void FLASH_ClearFlag(uint32_t FLASH_FLAG);
|
2018-08-29 22:14:49 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|