Source file: /~heha/hs/bl/bl.zip/flash.cpp

#include "bl.h"

#define spin() while (FLASH->SR&FLASH_SR_BSY)

void flash::writeInit(uint32_t flash) {
 FLASH->KEYR = FLASH_KEY1;	// Unlock Flash with magic keys
 FLASH->KEYR = FLASH_KEY2;
 spin();
 FLASH->CR |= FLASH_CR_PER;	// Format page
 FLASH->AR = flash;
 FLASH->CR |= FLASH_CR_STRT;
 spin();
 FLASH->CR &=~FLASH_CR_PER;
 spin();
 FLASH->CR |= FLASH_CR_PG;
}

void flash::writeDone() {
 FLASH->CR &=~FLASH_CR_PG;
 FLASH->CR |= FLASH_CR_LOCK;	// Lock Flash
}

Detected encoding: ASCII (7 bit)2