\doxysection{\+\_\+\+\_\+general\+\_\+flash.\+c} \hypertarget{____general__flash_8c_source}{}\label{____general__flash_8c_source}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/\_\_general\_flash.c@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/\_\_general\_flash.c}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00001}00001\ \textcolor{preprocessor}{\#include\ "{}\_\_general\_flash.h"{}}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00002}00002\ FLASH\_EraseInitTypeDef\ EraseInitStruct;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00003}00003\ \textcolor{keyword}{extern}\ HAL\_StatusTypeDef\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00004}00004\ \textcolor{keywordtype}{unsigned}\ CRC\_Update;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00005}00005\ \textcolor{comment}{//uint32\_t\ PAGE\_OFFSET\ =\ ((uint32\_t)((4-\/1)\ *\ 0x0400));}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00006}00006\ uint32\_t\ PAGE\_NUMB\ =\ 127;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00007}00007\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00008}00008\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00009}00009\ \textcolor{comment}{/*\ Записать\ в\ память\ данные,\ произвольного\ размера\ */}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00010}00010\ HAL\_StatusTypeDef\ FLASH\_Write\_Data(uint32\_t*\ Address,\ uint8\_t*\ Data,\ \textcolor{keywordtype}{int}\ Data\_size)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00011}00011\ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00012}00012\ \ \ HAL\_StatusTypeDef\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00013}00013\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00014}00014\ \ \ \textcolor{keywordtype}{int}\ data\_cnt\ =\ 0;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00015}00015\ \ \ uint32\_t\ adr;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00016}00016\ \ \ uint32\_t\ word\_data;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00017}00017\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00018}00018\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00019}00019\ \ \ res\_hal\ =\ HAL\_FLASH\_Unlock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00020}00020\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00021}00021\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00022}00022\ \ \ \textcolor{keywordflow}{for}\ (adr\ =\ *Address;\ adr\ <\ *Address\ +\ Data\_size;\ adr\ =\ adr\ +\ 4)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00023}00023\ \ \ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00024}00024\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00025}00025\ \ \ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00026}00026\ \ \ \ \ word\_data\ =\ (} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00027}00027\ \ \ \ \ \ \ Data[data\_cnt]\ |} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00028}00028\ \ \ \ \ \ \ Data[data\_cnt\ +\ 1]\ <<\ 8\ |} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00029}00029\ \ \ \ \ \ \ Data[data\_cnt\ +\ 2]\ <<\ 16\ |} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00030}00030\ \ \ \ \ \ \ Data[data\_cnt\ +\ 3]\ <<\ 24);} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00031}00031\ \ \ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00032}00032\ \ \ \ \ res\_hal\ =\ HAL\_FLASH\_Program(FLASH\_TYPEPROGRAM\_WORD,\ adr,\ word\_data);} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00033}00033\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00034}00034\ \ \ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00035}00035\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00036}00036\ \ \ \ \ data\_cnt\ +=\ 4;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00037}00037\ \ \ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00038}00038\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00039}00039\ \ \ *Address\ +=\ Data\_size;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00040}00040\ \ \ res\_hal\ =\ HAL\_FLASH\_Lock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00041}00041\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00042}00042\ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00043}00043\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00044}00044\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00045}00045\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00046}00046\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00047}00047\ HAL\_StatusTypeDef\ FLASH\_Enable\_DualBankMode(\textcolor{keywordtype}{void})} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00048}00048\ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00049}00049\ \ \ HAL\_StatusTypeDef\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00050}00050\ \ \ FLASH\_AdvOBProgramInitTypeDef\ OB\_DualBank;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00051}00051\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00052}00052\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00053}00053\ \ \ res\_hal\ =\ HAL\_FLASH\_Unlock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00054}00054\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00055}00055\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00056}00056\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00057}00057\ \ \ res\_hal\ =\ HAL\_FLASH\_OB\_Unlock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00058}00058\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00059}00059\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00060}00060\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00061}00061\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00062}00062\ \ \ FLASH-\/>OPTCR\ |=\ FLASH\_OPTCR\_DB1M;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00063}00063\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00064}00064\ \ \ res\_hal\ =\ HAL\_FLASH\_OB\_Launch();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00065}00065\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00066}00066\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00067}00067\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00068}00068\ \ \ res\_hal\ =\ HAL\_FLASH\_OB\_Lock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00069}00069\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00070}00070\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00071}00071\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00072}00072\ \ \ res\_hal\ =\ HAL\_FLASH\_Lock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00073}00073\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00074}00074\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00075}00075\ \ \ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00076}00076\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00077}00077\ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00078}00078\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00079}00079\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00080}00080\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00081}00081\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00082}00082\ \textcolor{comment}{/*\ Убрать\ защиту\ */}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00083}00083\ HAL\_StatusTypeDef\ FLASH\_WriteProtection(uint32\_t\ BankN,\ uint32\_t\ WriteProtection)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00084}00084\ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00085}00085\ \ \ HAL\_StatusTypeDef\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00086}00086\ \ \ FLASH\_OBProgramInitTypeDef\ OBInit;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00087}00087\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00088}00088\ \ \ \ \ \textcolor{comment}{//\ Очистка\ всех\ возможных\ ошибок}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00089}00089\ \ \ FLASH-\/>SR\ |=\ FLASH\_FLAG\_WRPERR\ \ \textcolor{comment}{//\ Write\ Protection\ Error}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00090}00090\ \ \ \ \ \ \ \ \ \ \ \ \ \ |\ FLASH\_FLAG\_PGSERR\ \ \textcolor{comment}{//\ Programming\ Sequence\ Error}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00091}00091\ \ \ \ \ \ \ \ \ \ \ \ \ \ |\ FLASH\_FLAG\_PGAERR\ \ \textcolor{comment}{//\ Programming\ Alignment\ Error}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00092}00092\ \ \ \ \ \ \ \ \ \ \ \ \ \ |\ FLASH\_FLAG\_OPERR;\ \ \textcolor{comment}{//\ Operation\ Error}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00093}00093\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00094}00094\ \ \ res\_hal\ =\ HAL\_FLASH\_Unlock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00095}00095\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00096}00096\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00097}00097\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00098}00098\ \ \ res\_hal\ =\ HAL\_FLASH\_OB\_Unlock();\ \textcolor{comment}{//\ Разблокировка\ Option\ Bytes}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00099}00099\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00100}00100\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00101}00101\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00102}00102\ \ \ \textcolor{comment}{//\ Считываем\ текущую\ конфигурацию\ Option\ Bytes}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00103}00103\ \ \ HAL\_FLASHEx\_OBGetConfig(\&OBInit);} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00104}00104\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00105}00105\ \ \ \textcolor{comment}{//\ Отключаем\ защиту\ на\ всех\ секторах\ второго\ банка}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00106}00106\ \ \ OBInit.OptionType\ =\ OPTIONBYTE\_WRP;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00107}00107\ \ \ OBInit.WRPState\ =\ WriteProtection;\ \textcolor{comment}{//\ Снять\ защиту}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00108}00108\ \ \ OBInit.WRPSector\ =\ OB\_WRP\_SECTOR\_12;\ \textcolor{comment}{//\ Снять\ защиту}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00109}00109\ \ \ OBInit.Banks\ =\ BankN;\ \textcolor{comment}{//\ Указываем\ второй\ банк}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00110}00110\ \ \ res\_hal\ =\ HAL\_FLASHEx\_OBProgram(\&OBInit);} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00111}00111\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00112}00112\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00113}00113\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00114}00114\ \ \ \textcolor{comment}{//\ Записываем\ изменения\ и\ перезагружаем\ чип}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00115}00115\ \ \ res\_hal\ =\ HAL\_FLASH\_OB\_Launch();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00116}00116\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00117}00117\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00118}00118\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00119}00119\ \ \ \textcolor{comment}{//\ Считываем\ текущую\ конфигурацию\ Option\ Bytes}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00120}00120\ \ \ HAL\_FLASHEx\_OBGetConfig(\&OBInit);} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00121}00121\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00122}00122\ \textcolor{comment}{//\ Блокировка\ Option\ Bytes}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00123}00123\ \ \ res\_hal\ =\ HAL\_FLASH\_OB\_Lock();\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00124}00124\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00125}00125\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00126}00126\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00127}00127\ \ \ res\_hal\ =\ HAL\_FLASH\_Lock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00128}00128\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00129}00129\ \ \ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00130}00130\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00131}00131\ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00132}00132\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00133}00133\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/ELEMENTARY\ FUNCTIONS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00134}00134\ \textcolor{comment}{/*\ functions\ for\ reading\ bytes/halswords/words\ */}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00135}00135\ uint8\_t\ FLASH\_Read\_Byte(uint32\_t\ add)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00136}00136\ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00137}00137\ \ \ \textcolor{keywordflow}{return}\ (*(\_\_IO\ uint8\_t*)(add));} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00138}00138\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00139}00139\ uint16\_t\ FLASH\_Read\_HalfWord(uint32\_t\ add)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00140}00140\ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00141}00141\ \ \ \textcolor{keywordflow}{return}\ (*(\_\_IO\ uint16\_t*)(add));} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00142}00142\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00143}00143\ uint32\_t\ FLASH\_Read\_Word(uint32\_t\ add)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00144}00144\ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00145}00145\ \ \ \textcolor{keywordflow}{return}\ (*(\_\_IO\ uint32\_t*)(add));} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00146}00146\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00147}00147\ \textcolor{comment}{/*\ functions\ for\ writing\ bytes/halswords/words\ */}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00148}00148\ HAL\_StatusTypeDef\ FLASH\_Write\_Byte(uint32\_t\ Address,\ uint8\_t\ Data)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00149}00149\ \{\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00150}00150\ \ \ HAL\_StatusTypeDef\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00151}00151\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00152}00152\ \ \ res\_hal\ =\ HAL\_FLASH\_Unlock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00153}00153\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00154}00154\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00155}00155\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00156}00156\ \ \ res\_hal\ =\ HAL\_FLASH\_Program(FLASH\_TYPEPROGRAM\_BYTE,\ Address,\ (uint8\_t)(Data));} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00157}00157\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00158}00158\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00159}00159\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00160}00160\ \ \ res\_hal\ =\ HAL\_FLASH\_Lock();\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00161}00161\ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00162}00162\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00163}00163\ HAL\_StatusTypeDef\ FLASH\_Write\_HalfWord(uint32\_t\ Address,\ uint16\_t\ Data)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00164}00164\ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00165}00165\ \ \ HAL\_StatusTypeDef\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00166}00166\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00167}00167\ \ \ res\_hal\ =\ HAL\_FLASH\_Unlock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00168}00168\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00169}00169\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00170}00170\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00171}00171\ \ \ res\_hal\ =\ HAL\_FLASH\_Program(FLASH\_TYPEPROGRAM\_HALFWORD,\ Address,\ (uint16\_t)(Data));} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00172}00172\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00173}00173\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00174}00174\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00175}00175\ \ \ res\_hal\ =\ HAL\_FLASH\_Lock();\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00176}00176\ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00177}00177\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00178}00178\ HAL\_StatusTypeDef\ FLASH\_Write\_Word(uint32\_t\ Address,\ uint32\_t\ Data)} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00179}00179\ \{} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00180}00180\ \ \ HAL\_StatusTypeDef\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00181}00181\ \ \ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00182}00182\ \ \ res\_hal\ =\ HAL\_FLASH\_Unlock();} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00183}00183\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00184}00184\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00185}00185\ \ \ res\_hal\ =\ HAL\_FLASH\_Program(FLASH\_TYPEPROGRAM\_WORD,\ Address,\ (uint32\_t)(Data));\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00186}00186\ \ \ \textcolor{keywordflow}{if}\ (res\_hal\ !=\ HAL\_OK)\ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00187}00187\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00188}00188\ \ \ res\_hal\ =\ HAL\_FLASH\_Lock();\ } \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00189}00189\ \ \ \textcolor{keywordflow}{return}\ res\_hal;} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00190}00190\ \}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00191}00191\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{____general__flash_8c_source_l00192}00192\ } \end{DoxyCode}