191 lines
27 KiB
TeX
191 lines
27 KiB
TeX
\doxysection{mylibs\+\_\+defs.\+h}
|
||
\hypertarget{mylibs__defs_8h_source}{}\label{mylibs__defs_8h_source}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/mylibs\_defs.h@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/mylibs\_defs.h}}
|
||
\mbox{\hyperlink{mylibs__defs_8h}{Go to the documentation of this file.}}
|
||
\begin{DoxyCode}{0}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00001}00001\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00002}00002\ \textcolor{comment}{**************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00003}00003\ \textcolor{comment}{*\ @file\ mylibs\_defs.h}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Заголочный\ файл\ для\ дефайнов\ библиотеки\ MyLibsGeneral.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00005}00005\ \textcolor{comment}{**************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00006}00006\ \textcolor{comment}{*\ @defgroup\ MYLIBS\_DEFINES\ \ General\ Tools}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00007}00007\ \textcolor{comment}{*\ @ingroup\ \ MYLIBS\_ALL}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00008}00008\ \textcolor{comment}{*\ @brief\ \ \ \ Общие\ макросы\ и\ typedef'ы,\ используемые\ по\ всему\ проекту}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00009}00009\ \textcolor{comment}{*}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00010}00010\ \textcolor{comment}{*************************************************************************/}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00011}00011\ \textcolor{preprocessor}{\#ifndef\ \_\_MYLIBS\_DEFINES\_H\_}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00012}00012\ \textcolor{preprocessor}{\#define\ \_\_MYLIBS\_DEFINES\_H\_}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00013}00013\ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00014}00014\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{mylibs__config_8h}{mylibs\_config.h}}"{}}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00015}00015\ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00016}00016\ \textcolor{comment}{/***************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00017}00017\ \textcolor{comment}{******************************ERROR\_HANDLER********************************/}\textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00018}00018\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00019}00019\ \textcolor{comment}{\ \ *\ @addtogroup\ ERROR\_HANDLER\_DEFINES\ \ \ Error\ Handler\ defines}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00020}00020\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ MYLIBS\_DEFINES}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00021}00021\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ Дефайны\ для\ обработки\ ошибок}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00022}00022\ \textcolor{comment}{\ \ *\ @\{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00023}00023\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00024}00024\ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00025}00025\ \textcolor{comment}{/*\ extern\ Error\_Handler\ from\ main.h\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00026}00026\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{void}\ Error\_Handler(\textcolor{keywordtype}{void});}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00027}00027\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00028}00028\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00029}00029\ \textcolor{comment}{\ \ *\ @brief\ Error\_Handler\ который\ будет\ вызыватся\ в\ библиотеке}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00030}00030\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00031}\mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_gae110df81afd885a390bbeb152d7b709f}{00031}}\ \textcolor{preprocessor}{\#define\ MyLibs\_Error\_Handler(params)\ \ Error\_Handler(params)}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00032}00032\ \textcolor{comment}{/*\ If\ error\ handler\ not\ defined\ -\/\ set\ void\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00033}00033\ \textcolor{preprocessor}{\#ifndef\ MyLibs\_Error\_Handler}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00034}00034\ \textcolor{preprocessor}{\#define\ MyLibs\_Error\_Handler(...)}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00035}00035\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ MyLibs\_Error\_Handler}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00036}00036\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00037}00037\ \textcolor{comment}{/**\ @brief\ Проверить\ один\ указатель\ на\ NULL\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00038}\mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_ga5d066a5b9781f9437e75d98677489eb9}{00038}}\ \textcolor{preprocessor}{\#define\ check\_null\_ptr\_1(p1)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (p1\ ==\ NULL)}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00039}00039\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00040}00040\ \textcolor{comment}{/**\ @brief\ Проверить\ два\ указателя\ на\ NULL\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00041}\mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_ga27b363f333cacdccc15f5174e096b5b3}{00041}}\ \textcolor{preprocessor}{\#define\ check\_null\_ptr\_2(p1,\ p2)\ \ \ \ \ \ \ \ \ \ \ \ \ \ ((p1\ ==\ NULL)\ ||\ (p1\ !=\ NULL\ \&\&\ p2\ ==\ NULL))}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00042}00042\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00043}00043\ \textcolor{comment}{/**\ @brief\ Проверить\ три\ указателя\ на\ NULL\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00044}\mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_ga838b40542faa9aa273d18f921b21fda2}{00044}}\ \textcolor{preprocessor}{\#define\ check\_null\_ptr\_3(p1,\ p2,\ p3)\ \ \ \ \ \ \ \ \ \ ((p1\ ==\ NULL)\ ||\ (p1\ !=\ NULL\ \&\&\ ((p2\ ==\ NULL)\ ||\ (p2\ !=\ NULL\ \&\&\ p3\ ==\ NULL))))}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00045}00045\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00046}00046\ \textcolor{comment}{/**\ @brief\ Проверить\ четыре\ указателя\ на\ NULL\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00047}\mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_ga590973be111afc3f9ba15e6939530254}{00047}}\ \textcolor{preprocessor}{\#define\ check\_null\_ptr\_4(p1,\ p2,\ p3,\ p4)\ \ \ \ \ \ ((p1\ ==\ NULL)\ ||\ (p1\ !=\ NULL\ \&\&\ ((p2\ ==\ NULL)\ ||\ (p2\ !=\ NULL\ \&\&\ ((p3\ ==\ NULL)\ ||\ (p3\ !=\ NULL\ \&\&\ p4\ ==\ NULL))))))}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00048}00048\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00049}00049\ \textcolor{comment}{/**\ @brief\ Проверить\ пять\ указателей\ на\ NULL\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00050}\mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_gaab0aafd7a4a21ec4f338b19269f65490}{00050}}\ \textcolor{preprocessor}{\#define\ check\_null\_ptr\_5(p1,\ p2,\ p3,\ p4,\ p5)\ \ ((p1\ ==\ NULL)\ ||\ (p1\ !=\ NULL\ \&\&\ ((p2\ ==\ NULL)\ ||\ (p2\ !=\ NULL\ \&\&\ ((p3\ ==\ NULL)\ ||\ (p3\ !=\ NULL\ \&\&\ ((p4\ ==\ NULL)\ ||\ (p4\ !=\ NULL\ \&\&\ p5\ ==\ NULL))))))))}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00051}00051\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00052}00052\ \textcolor{comment}{/**\ ERROR\_HANDLER\_DEFINES}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00053}00053\ \textcolor{comment}{\ \ *\ @\}}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00054}00054\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00055}00055\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00056}00056\ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00057}00057\ \textcolor{comment}{/***************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00058}00058\ \textcolor{comment}{******************************DELAYS\_DEFINES*******************************/}\textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00059}00059\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00060}00060\ \textcolor{comment}{\ \ *\ @addtogroup\ DELAYS\_DEFINES\ \ \ \ Delays\ defines}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00061}00061\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ MYLIBS\_DEFINES}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00062}00062\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ \ Макросы\ и\ определения\ для\ работы\ с\ задержками\ в\ миллисекундах.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00063}00063\ \textcolor{comment}{\ \ *\ @details}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00064}00064\ \textcolor{comment}{\ \ *\ Этот\ блок\ содержит\ макросы\ для\ реализации\ задержек\ с\ использованием\ HAL\ или\ FreeRTOS:}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00065}00065\ \textcolor{comment}{\ \ *\ -\/\ @ref\ msDelay\ \ \ \ \ \ \ \ \ \ \ \ \ —\ простая\ задержка\ заданной\ длительности;}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00066}00066\ \textcolor{comment}{\ \ *\ -\/\ @ref\ msDelayStart\ \ \ \ \ \ \ \ —\ сохранение\ текущего\ времени\ начала\ задержки;}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00067}00067\ \textcolor{comment}{\ \ *\ -\/\ @ref\ msDelayWhileActive\ \ —\ проверка,\ активна\ ли\ задержка;}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00068}00068\ \textcolor{comment}{\ \ *\ -\/\ @ref\ msDelayWaitDone\ \ \ \ \ —\ проверка,\ завершена\ ли\ задержка.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00069}00069\ \textcolor{comment}{\ \ *\ Эти\ макросы\ удобны\ для\ реализации\ неблокирующих\ задержек.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00070}00070\ \textcolor{comment}{\ \ *\ @\{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00071}00071\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00072}00072\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00073}00073\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00074}00074\ \textcolor{comment}{\ \ *\ @def\ msDelay(\_ms\_)}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00075}00075\ \textcolor{comment}{\ \ *\ @brief\ Задержка\ на\ указанное\ количество\ миллисекунд.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00076}00076\ \textcolor{comment}{\ \ *\ @param\ \_ms\_\ Время\ задержки\ в\ миллисекундах.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00077}00077\ \textcolor{comment}{\ \ *\ @note\ Использует\ HAL\_Delay\ или\ osDelay\ в\ зависимости\ от\ @ref\ FREERTOS\_DELAY.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00078}00078\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00079}00079\ \textcolor{preprocessor}{\#ifdef\ FREERTOS\_DELAY}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00080}00080\ \textcolor{preprocessor}{\ \ \#define\ msDelay(\_ms\_)\ \ \ \ \ \ \ osDelay(\_ms\_)}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00081}00081\ \textcolor{preprocessor}{\#else}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00082}\mbox{\hyperlink{group___d_e_l_a_y_s___d_e_f_i_n_e_s_gabeb97579daeb622c6651ed03c4a27479}{00082}}\ \textcolor{preprocessor}{\ \ \#define\ msDelay(\_ms\_)\ \ \ \ \ \ \ HAL\_Delay(\_ms\_)}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00083}00083\ \textcolor{preprocessor}{\#endif}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00084}00084\ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00085}00085\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00086}00086\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00087}00087\ \textcolor{comment}{\ \ *\ @brief\ Начать\ отсчет\ задержки.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00088}00088\ \textcolor{comment}{\ \ *\ @param\ \_pvar\_\ Указатель\ на\ переменную\ типа\ uint32\_t\ для\ хранения\ времени\ старта.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00089}00089\ \textcolor{comment}{\ \ *\ @details\ После\ вызова\ этого\ макроса\ переменная\ \_pvar\_\ содержит\ текущее\ количество\ миллисекунд}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00090}00090\ \textcolor{comment}{\ \ *\ с\ момента\ запуска\ системы\ (HAL\_GetTick).\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00091}00091\ \textcolor{comment}{\ \ *\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00092}00092\ \textcolor{comment}{\ \ *\ Используется\ для\ реализации\ неблокирующих\ задержек.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00093}00093\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00094}\mbox{\hyperlink{group___d_e_l_a_y_s___d_e_f_i_n_e_s_ga8a5051b1292d1019fe8dd3fc5521ab25}{00094}}\ \textcolor{preprocessor}{\#define\ msDelayStart(\_pvar\_)\ \ \ \ \ \ \ \ \ \ \ \ *(\_pvar\_)\ =\ HAL\_GetTick()}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00095}00095\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00096}00096\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00097}00097\ \textcolor{comment}{\ *\ @brief\ Проверяет,\ активна\ ли\ задержка.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00098}00098\ \textcolor{comment}{\ *\ @param\ \_ms\_\ Длительность\ задержки\ в\ миллисекундах.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00099}00099\ \textcolor{comment}{\ *\ @param\ \_pvar\_\ Указатель\ на\ переменную,\ в\ которой\ сохранено\ время\ начала\ (@ref\ msDelayStart).}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00100}00100\ \textcolor{comment}{\ *\ @retval\ 1\ Задержка\ еще\ активна.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00101}00101\ \textcolor{comment}{\ *\ @retval\ 0\ Задержка\ завершена.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00102}00102\ \textcolor{comment}{\ *\ @details}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00103}00103\ \textcolor{comment}{\ *\ Возвращает\ true,\ пока\ время\ задержки\ не\ истекло.\ Используется\ в\ проверках,}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00104}00104\ \textcolor{comment}{\ *\ когда\ нужно\ **действовать,\ пока\ задержка\ выполняется**.\ Пример:}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00105}00105\ \textcolor{comment}{\ *\ @code}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00106}00106\ \textcolor{comment}{\ *\ while(msDelayWhileActive(1000,\ \&tick))\ \{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00107}00107\ \textcolor{comment}{\ *\ \ \ \ \ //\ выполняем\ другие\ задачи,\ задержка\ не\ блокирует\ поток}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00108}00108\ \textcolor{comment}{\ *\ \}}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00109}00109\ \textcolor{comment}{\ *\ @endcode}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00110}00110\ \textcolor{comment}{\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00111}\mbox{\hyperlink{group___d_e_l_a_y_s___d_e_f_i_n_e_s_ga0b97e172659a59ee4fa56f851643ae85}{00111}}\ \textcolor{preprocessor}{\#define\ msDelayWhileActive(\_ms\_,\ \_pvar\_)\ \ \ \ (HAL\_GetTick()\ -\/\ *(\_pvar\_)\ <\ \_ms\_)}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00112}00112\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00113}00113\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00114}00114\ \textcolor{comment}{\ *\ @brief\ Проверяет,\ завершилась\ ли\ задержка.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00115}00115\ \textcolor{comment}{\ *\ @param\ \_ms\_\ Длительность\ задержки\ в\ миллисекундах.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00116}00116\ \textcolor{comment}{\ *\ @param\ \_pvar\_\ Указатель\ на\ переменную,\ в\ которой\ сохранено\ время\ начала\ (msDelayStart).}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00117}00117\ \textcolor{comment}{\ *\ @retval\ 1\ Задержка\ завершена.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00118}00118\ \textcolor{comment}{\ *\ @retval\ 0\ Задержка\ еще\ активна.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00119}00119\ \textcolor{comment}{\ *\ @details}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00120}00120\ \textcolor{comment}{\ *\ Возвращает\ true,\ когда\ задержка\ уже\ завершена.\ Используется\ в\ проверках,}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00121}00121\ \textcolor{comment}{\ *\ когда\ нужно\ **выполнить\ действие\ только\ после\ окончания\ задержки**.\ Пример:}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00122}00122\ \textcolor{comment}{\ *\ @code}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00123}00123\ \textcolor{comment}{\ *\ if(msDelayWaitDone(1000,\ \&tick))\ \{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00124}00124\ \textcolor{comment}{\ *\ \ \ \ \ //\ выполняем\ действие\ после\ завершения\ задержки}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00125}00125\ \textcolor{comment}{\ *\ \}}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00126}00126\ \textcolor{comment}{\ *\ @endcode}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00127}00127\ \textcolor{comment}{\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00128}\mbox{\hyperlink{group___d_e_l_a_y_s___d_e_f_i_n_e_s_gaed082c07b9fc4d1894330d885b9b5518}{00128}}\ \textcolor{preprocessor}{\#define\ msDelayWaitDone(\_ms\_,\ \_pvar\_)\ \ \ \ (HAL\_GetTick()\ -\/\ *(\_pvar\_)\ >=\ \_ms\_)}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00129}00129\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00130}00130\ \textcolor{comment}{/**\ DELAYS\_DEFINES}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00131}00131\ \textcolor{comment}{\ \ *\ @\}}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00132}00132\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00133}00133\ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00134}00134\ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00135}00135\ \textcolor{comment}{/***************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00136}00136\ \textcolor{comment}{*******************************UTIL\_DEFINES********************************/}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00137}00137\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{int}\ dummy;\textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00138}00138\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00139}00139\ \textcolor{comment}{\ \ *\ @addtogroup\ UTILS\_DEFINES\ \ \ \ \ \ Utils\ defines}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00140}00140\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ MYLIBS\_DEFINES}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00141}00141\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ Общие\ вспомогательные\ макросы}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00142}00142\ \textcolor{comment}{\ \ *\ @\{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00143}00143\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00144}00144\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00145}00145\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00146}00146\ \textcolor{comment}{\ *\ @brief\ Обнуление\ структуры.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00147}00147\ \textcolor{comment}{\ *\ @param\ \_struct\_\ Структура,\ которую\ нужно\ обнулить.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00148}00148\ \textcolor{comment}{\ *\ @details\ Макрос\ использует\ memset\ для\ обнуления\ всей\ памяти\ структуры.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00149}00149\ \textcolor{comment}{\ *\ Используется\ для\ быстрой\ и\ безопасной\ инициализации\ переменных\ структур\ до\ нуля.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00150}00150\ \textcolor{comment}{\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00151}\mbox{\hyperlink{group___u_t_i_l_s___d_e_f_i_n_e_s_gaf5e598848326d48e86167e5099a029be}{00151}}\ \textcolor{preprocessor}{\#define\ ClearStruct(\_struct\_)\ \ \ \ \ memset(\&(\_struct\_),\ 0,\ sizeof(\_struct\_))}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00152}00152\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00153}00153\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00154}00154\ \textcolor{comment}{\ \ *\ @brief\ \ Деление\ с\ округлением\ вверх}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00155}00155\ \textcolor{comment}{\ \ *\ @param\ \_val\_\ Делимое.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00156}00156\ \textcolor{comment}{\ \ *\ @param\ \_div\_\ Делитель.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00157}00157\ \textcolor{comment}{\ \ *\ @return\ Результат\ деления,\ округленный\ вверх.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00158}00158\ \textcolor{comment}{\ \ *\ @details\ \ Если\ результат\ деления\ без\ остатка:\ он\ возвращается\ как\ есть}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00159}00159\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ Если\ с\ остатком\ -\/\ округляется\ вверх}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00160}00160\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00161}00161\ \textcolor{comment}{//\#define\ Divide\_Up(\_val\_,\ \_div\_)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (((\_val\_)\%(\_div\_))?\ (\_val\_)/(\_div\_)+1\ :\ (\_val\_)/\_div\_)\ \ /*\ через\ тернарный\ оператор\ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00162}\mbox{\hyperlink{group___u_t_i_l_s___d_e_f_i_n_e_s_gabf45f2b60eedf80cf9d1dbe4302a741e}{00162}}\ \textcolor{preprocessor}{\#define\ Divide\_Up(\_val\_,\ \_div\_)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ((\_val\_\ -\/\ 1)\ /\ \_div\_)\ +\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\textcolor{comment}{/*\ через\ мат\ выражение\ */}\textcolor{preprocessor}{\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00163}00163\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00164}00164\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00165}00165\ \textcolor{comment}{\ \ *\ @brief\ \ Swap\ between\ Little\ Endian\ and\ Big\ Endian}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00166}00166\ \textcolor{comment}{\ \ *\ @param\ v\ Исходное\ 16-\/битное\ значение.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00167}00167\ \textcolor{comment}{\ \ *\ @return\ Результат\ с\ поменяными\ местами\ старшим\ и\ младшим\ байтом.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00168}00168\ \textcolor{comment}{\ \ *\ @details\ \ Переключения\ между\ двумя\ типами\ хранения\ слова:\ HI-\/LO\ байты\ и\ LO-\/HI\ байты.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00169}00169\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00170}\mbox{\hyperlink{group___u_t_i_l_s___d_e_f_i_n_e_s_ga0f22e895ac7781c3d1b68fee182c4291}{00170}}\ \textcolor{preprocessor}{\#define\ ByteSwap16(v)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (((v\&0xFF00)\ >>\ (8))\ |\ ((v\&0x00FF)\ <<\ (8)))}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00171}00171\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00172}00172\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00173}00173\ \textcolor{comment}{\ \ *\ @brief\ \ Абсолютное\ значение\ числа}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00174}00174\ \textcolor{comment}{\ \ *\ @param\ x\ Число.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00175}00175\ \textcolor{comment}{\ \ *\ @return\ Абсолютное\ значение\ числа\ x.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00176}00176\ \textcolor{comment}{\ \ *\ @details\ \ Берет\ число\ по\ модулю.\ Хз\ как\ работает\ библиотечный\ abs\ в\ stdlib.h,\ мб\ это\ быстрее,\ но\ вряд\ ли\ конечно.}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00177}00177\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00178}\mbox{\hyperlink{group___u_t_i_l_s___d_e_f_i_n_e_s_ga996f7be338ccb40d1a2a5abc1ad61759}{00178}}\ \textcolor{preprocessor}{\#define\ ABS(x)\ (\ ((x)\ >\ 0)?\ (x)\ :\ -\/(x))}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00179}00179\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00180}00180\ \textcolor{comment}{/**\ UTILS\_DEFINES}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00181}00181\ \textcolor{comment}{\ \ *\ @\}}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00182}00182\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00183}00183\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{mylibs__defs_8h_source_l00184}00184\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\_\_MYLIBS\_DEFINES\_H\_}}
|
||
|
||
\end{DoxyCode}
|