\doxysection{E\+:/.WORK/\+STM32/\+Diod\+\_\+\+Test/diode\+\_\+tester/\+Core/\+Modbus/\+\_\+\+\_\+modbus\+\_\+data.c}
\hypertarget{____modbus__data_8c_source}{}\label{____modbus__data_8c_source}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00001}00001\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00002}00002\ \textcolor{comment}{******************************************************************************}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00003}00003\ \textcolor{comment}{*\ @file\ modbus\_data.c}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Функции\ доступа\ к\ данным\ Modbus}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00005}00005\ \textcolor{comment}{******************************************************************************}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00006}00006\ \textcolor{comment}{*\ @details}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00007}00007\ \textcolor{comment}{Модуль\ реализует\ функции\ валидации\ адресов\ и\ доступа\ к\ данным:}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00008}00008\ \textcolor{comment}{-\/\ Проверка\ корректности\ запрашиваемых\ адресов}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00009}00009\ \textcolor{comment}{-\/\ Определение\ указателей\ на\ реальные\ данные\ в\ памяти}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00010}00010\ \textcolor{comment}{-\/\ Поддержка\ пользовательских\ массивов\ регистров\ и\ coils}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00011}00011\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00012}00012\ \textcolor{comment}{@section\ Валидация\ адресов:}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00013}00013\ \textcolor{comment}{-\/\ MB\_Check\_Address\_For\_Arr()\ -\/\ проверка\ принадлежности\ адреса\ массиву}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00014}00014\ \textcolor{comment}{-\/\ MB\_DefineRegistersAddress()\ -\/\ получение\ указателя\ на\ регистры}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00015}00015\ \textcolor{comment}{-\/\ MB\_DefineCoilsAddress()\ -\/\ получение\ указателя\ на\ coils}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00016}00016\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00017}00017\ \textcolor{comment}{******************************************************************************/}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00018}00018\ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00019}00019\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus__core_8h}{modbus\_core.h}}"{}}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00020}00020\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus__coils_8h}{modbus\_coils.h}}"{}}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00021}00021\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus__holdregs_8h}{modbus\_holdregs.h}}"{}}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00022}00022\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus__inputregs_8h}{modbus\_inputregs.h}}"{}}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00023}00023\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus__devid_8h}{modbus\_devid.h}}"{}}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00024}00024\ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00025}00025\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00026}00026\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00027}00027\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Check\ is\ address\ valid\ for\ certain\ array.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00028}00028\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Addr\ \ \ \ \ \ \ \ \ \ Начальный\ адресс.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00029}00029\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Qnt\ \ \ \ \ \ \ \ \ \ \ Количество\ запрашиваемых\ элементов.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00030}00030\ \textcolor{comment}{\ \ *\ @param\ \ \ \ R\_ARR\_ADDR\ \ \ \ Начальный\ адресс\ массива\ R\_ARR.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00031}00031\ \textcolor{comment}{\ \ *\ @param\ \ \ \ R\_ARR\_NUMB\ \ \ \ Количество\ элементов\ в\ массиве\ R\_ARR.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00032}00032\ \textcolor{comment}{\ \ *\ @return\ \ \ ExceptionCode\ -\/\ ET\_ILLEGAL\_DATA\_ADRESS\ если\ адресс\ недействителен,\ и\ ET\_NO\_ERRORS\ если\ все\ ок.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00033}00033\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00034}00034\ \textcolor{comment}{\ \ *\ @details\ \ Позволяет\ определить,\ принадлежит\ ли\ адресс\ Addr\ массиву\ R\_ARR:}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00035}00035\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ Если\ адресс\ Addr\ находится\ в\ диапазоне\ адрессов\ массива\ R\_ARR,\ то\ возвращаем\ NO\_ERROR.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00036}00036\ \textcolor{comment}{\ \ *\ \ \ \ \ \ \ \ \ \ \ Если\ адресс\ Addr\ находится\ за\ пределами\ адрессов\ массива\ R\_ARR\ -\/\ ET\_ILLEGAL\_DATA\_ADDRESSю.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00037}00037\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00038}\mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga278ca9791c69aef8adeb9e7c4b273c50}{00038}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga4ade64cb3fabf37f010c1e297489980c}{MB\_ExceptionTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga278ca9791c69aef8adeb9e7c4b273c50}{MB\_Check\_Address\_For\_Arr}}(uint16\_t\ Addr,\ uint16\_t\ Qnt,\ uint16\_t\ R\_ARR\_ADDR,\ uint16\_t\ R\_ARR\_NUMB)}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00039}00039\ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00040}00040\ \ \ \textcolor{comment}{//\ if\ address\ from\ this\ array}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00041}00041\ \ \ \textcolor{keywordflow}{if}(Addr\ >=\ R\_ARR\_ADDR)\ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00042}00042\ \ \ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00043}00043\ \ \ \ \ \textcolor{comment}{//\ if\ quantity\ too\ big\ return\ error}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00044}00044\ \ \ \ \ \textcolor{keywordflow}{if}\ ((Addr\ -\/\ R\_ARR\_ADDR)\ +\ Qnt\ >\ R\_ARR\_NUMB)\ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00045}00045\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00046}00046\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caea312adaf18aa7ebd17aca8883550425}{ET\_ILLEGAL\_DATA\_ADDRESS}};\ \ \textcolor{comment}{//\ return\ exception\ code}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00047}00047\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00048}00048\ \ \ \ \ \textcolor{comment}{//\ if\ all\ ok\ -\/\ return\ no\ errors}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00049}00049\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}};}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00050}00050\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00051}00051\ \ \ \textcolor{comment}{//\ if\ address\ isnt\ from\ this\ array\ return\ error}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00052}00052\ \ \ \textcolor{keywordflow}{else}\ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00053}00053\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caea312adaf18aa7ebd17aca8883550425}{ET\_ILLEGAL\_DATA\_ADDRESS}};\ \ \textcolor{comment}{//\ return\ exception\ code\ \ \ \ }}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00054}00054\ \}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00055}00055\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00056}00056\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Define\ Address\ Origin\ for\ Input/Holding\ Registers}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00057}00057\ \textcolor{comment}{\ \ *\ @param\ \ \ \ pRegs\ \ \ \ \ \ \ \ \ Указатель\ на\ указатель\ регистров.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00058}00058\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Addr\ \ \ \ \ \ \ \ \ \ Адрес\ начального\ регистра.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00059}00059\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Qnt\ \ \ \ \ \ \ \ \ \ \ Количество\ запрашиваемых\ регистров.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00060}00060\ \textcolor{comment}{\ \ *\ @param\ \ \ \ WriteFlag\ \ \ \ \ Флаг\ регистр\ нужны\ для\ чтения\ или\ записи.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00061}00061\ \textcolor{comment}{\ \ *\ @return\ \ \ ExceptionCode\ Код\ исключения\ если\ есть,\ и\ ET\_NO\_ERRORS\ если\ нет.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00062}00062\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00063}00063\ \textcolor{comment}{\ \ *\ @details\ \ Определение\ адреса\ начального\ регистра.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00064}00064\ \textcolor{comment}{\ \ *\ @note\ \ \ \ \ WriteFlag\ пока\ не\ используется.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00065}00065\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00066}\mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga1e90bb28a4cf997250daab6470d5ffe3}{00066}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga4ade64cb3fabf37f010c1e297489980c}{MB\_ExceptionTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga1e90bb28a4cf997250daab6470d5ffe3}{MB\_DefineRegistersAddress}}(uint16\_t\ **pRegs,\ uint16\_t\ Addr,\ uint16\_t\ Qnt,\ uint8\_t\ RegisterType)}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00067}00067\ \{\ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00068}00068\ \ \ \textcolor{comment}{/*\ check\ quantity\ error\ */}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00069}00069\ \ \ \textcolor{keywordflow}{if}\ (Qnt\ >\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gaf55149bc1f05cf18af067a302e31e3f9}{DATA\_SIZE}})\ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00070}00070\ \ \ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00071}00071\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980ca47d6168d0692ccb7e09e19084287aba3}{ET\_ILLEGAL\_DATA\_VALUE}};\ \ \textcolor{comment}{//\ return\ exception\ code}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00072}00072\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00073}00073\ \ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00074}00074\ \ \ \textcolor{keywordflow}{if}(RegisterType\ ==\ RegisterType\_Holding)}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00075}00075\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00076}00076\ \ \ \ \ \textcolor{comment}{//\ Default\ holding\ registers}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00077}00077\ \ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga278ca9791c69aef8adeb9e7c4b273c50}{MB\_Check\_Address\_For\_Arr}}(Addr,\ Qnt,\ \mbox{\hyperlink{modbus__data_8h_a791dfd31cc06338acdd8a2eb3b7032e6}{R\_HOLDING\_ADDR}},\ \mbox{\hyperlink{modbus__data_8h_acf40437374a3227e661db1a18bcef7d7}{R\_HOLDING\_QNT}})\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}})}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00078}00078\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00079}00079\ \ \ \ \ \ \ *pRegs\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga938b632e20454741b2a7f97928583776}{MB\_Set\_Register\_Ptr}}(\&MB\_DATA.HoldRegs,\ Addr\ -\/\ \mbox{\hyperlink{modbus__data_8h_a791dfd31cc06338acdd8a2eb3b7032e6}{R\_HOLDING\_ADDR}});\ \ \textcolor{comment}{//\ указатель\ на\ выбранный\ по\ Addr\ регистр}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00080}00080\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00081}00081\ \ \ \ \ \textcolor{comment}{//\ if\ address\ doesnt\ match\ any\ array\ -\/\ return\ illegal\ data\ address\ response}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00082}00082\ \ \ \ \ \textcolor{keywordflow}{else}\ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00083}00083\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00084}00084\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caea312adaf18aa7ebd17aca8883550425}{ET\_ILLEGAL\_DATA\_ADDRESS}};}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00085}00085\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00086}00086\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00087}00087\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(RegisterType\ ==\ RegisterType\_Input)}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00088}00088\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00089}00089\ \ \ \ \ \textcolor{comment}{//\ Default\ input\ registers}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00090}00090\ \ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga278ca9791c69aef8adeb9e7c4b273c50}{MB\_Check\_Address\_For\_Arr}}(Addr,\ Qnt,\ \mbox{\hyperlink{modbus__data_8h_a22bd1273e01d32f90a279b517d1737b6}{R\_INPUT\_ADDR}},\ \mbox{\hyperlink{modbus__data_8h_a97c0b1e20498bca34f6dfe0ac0d97b30}{R\_INPUT\_QNT}})\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}})}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00091}00091\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00092}00092\ \ \ \ \ \ \ *pRegs\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga938b632e20454741b2a7f97928583776}{MB\_Set\_Register\_Ptr}}(\&MB\_DATA.InRegs,\ Addr\ -\/\ \mbox{\hyperlink{modbus__data_8h_a22bd1273e01d32f90a279b517d1737b6}{R\_INPUT\_ADDR}});\ \ \textcolor{comment}{//\ указатель\ на\ выбранный\ по\ Addr\ регистр}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00093}00093\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00094}00094\ \ \ \ \ \textcolor{comment}{//\ if\ address\ doesnt\ match\ any\ array\ -\/\ return\ illegal\ data\ address\ response}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00095}00095\ \ \ \ \ \textcolor{keywordflow}{else}\ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00096}00096\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00097}00097\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caea312adaf18aa7ebd17aca8883550425}{ET\_ILLEGAL\_DATA\_ADDRESS}};}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00098}00098\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00099}00099\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00100}00100\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00101}00101\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00102}00102\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980cae81af967ab54904738ee391eb7478ad1}{ET\_ILLEGAL\_FUNCTION}};}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00103}00103\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00104}00104\ \ \ \textcolor{comment}{//\ if\ found\ requeried\ array\ return\ no\ err}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00105}00105\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}};\ \textcolor{comment}{//\ return\ no\ errors}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00106}00106\ \}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00107}00107\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00108}00108\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Define\ Address\ Origin\ for\ coils}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00109}00109\ \textcolor{comment}{\ \ *\ @param\ \ \ \ pCoils\ \ \ \ \ \ \ \ Указатель\ на\ указатель\ коилов.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00110}00110\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Addr\ \ \ \ \ \ \ \ \ \ Адресс\ начального\ коила.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00111}00111\ \textcolor{comment}{\ \ *\ @param\ \ \ \ Qnt\ \ \ \ \ \ \ \ \ \ \ Количество\ запрашиваемых\ коилов.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00112}00112\ \textcolor{comment}{\ \ *\ @param\ \ \ \ start\_shift\ \ \ Указатель\ на\ переменную\ содержащую\ сдвиг\ внутри\ регистра\ для\ начального\ коила.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00113}00113\ \textcolor{comment}{\ \ *\ @param\ \ \ \ WriteFlag\ \ \ \ \ Флаг\ коилы\ нужны\ для\ чтения\ или\ записи.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00114}00114\ \textcolor{comment}{\ \ *\ @return\ \ \ ExceptionCode\ Код\ исключения\ если\ есть,\ и\ ET\_NO\_ERRORS\ если\ нет.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00115}00115\ \textcolor{comment}{\ \ *}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00116}00116\ \textcolor{comment}{\ \ *\ @details\ \ Определение\ адреса\ начального\ регистра\ запрашиваемых\ коилов.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00117}00117\ \textcolor{comment}{\ \ *\ @note\ \ \ \ \ WriteFlag\ используется\ для\ определния\ регистров\ GPIO:\ ODR\ или\ IDR.}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00118}00118\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00119}\mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_gade717a6829a062a8a198bd933c8b2221}{00119}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga4ade64cb3fabf37f010c1e297489980c}{MB\_ExceptionTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_gade717a6829a062a8a198bd933c8b2221}{MB\_DefineCoilsAddress}}(uint16\_t\ **pCoils,\ uint16\_t\ Addr,\ uint16\_t\ Qnt,\ uint16\_t\ *start\_shift,\ uint8\_t\ WriteFlag)}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00120}00120\ \{\ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00121}00121\ \ \ \textcolor{comment}{/*\ check\ quantity\ error\ */}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00122}00122\ \ \ \textcolor{keywordflow}{if}\ (Qnt\ >\ 2000)\ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00123}00123\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00124}00124\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980ca47d6168d0692ccb7e09e19084287aba3}{ET\_ILLEGAL\_DATA\_VALUE}};\ \ \textcolor{comment}{//\ return\ exception\ code}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00125}00125\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00126}00126\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00127}00127\ \ \ \textcolor{comment}{//\ Default\ coils}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00128}00128\ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_o_d_b_u_s___c_m_d___p_r_o_c_e_s_s___f_u_n_c_t_i_o_n_s_ga278ca9791c69aef8adeb9e7c4b273c50}{MB\_Check\_Address\_For\_Arr}}(Addr,\ Qnt,\ \mbox{\hyperlink{modbus__data_8h_a5057c379abcae88db30ad094eceb952d}{C\_COILS\_ADDR}},\ \mbox{\hyperlink{modbus__data_8h_a438d957058fcf102c66922f0eada3af2}{C\_COILS\_QNT}})\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}})}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00129}00129\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00130}00130\ \ \ \ \ *pCoils\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga9648b00f955b16e107b901812031cee3}{MB\_Set\_Coil\_Reg\_Ptr}}(\&MB\_DATA.Coils,\ Addr\ -\/\ \mbox{\hyperlink{modbus__data_8h_a5057c379abcae88db30ad094eceb952d}{C\_COILS\_ADDR}});\ \ \textcolor{comment}{//\ указатель\ на\ выбранный\ по\ Addr\ массив\ коилов}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00131}00131\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00132}00132\ \ \ \textcolor{comment}{//\ if\ address\ doesnt\ match\ any\ array\ -\/\ return\ illegal\ data\ address\ response}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00133}00133\ \ \ \textcolor{keywordflow}{else}\ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00134}00134\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00135}00135\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caea312adaf18aa7ebd17aca8883550425}{ET\_ILLEGAL\_DATA\_ADDRESS}};}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00136}00136\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00137}00137\ \ \ }
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00138}00138\ \ \ *start\_shift\ =\ Addr\ \%\ 16;\ \textcolor{comment}{//\ set\ shift\ to\ requested\ coil}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00139}00139\ \ \ \textcolor{comment}{//\ if\ found\ requeried\ array\ return\ no\ err}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00140}00140\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga4ade64cb3fabf37f010c1e297489980caa6980c7a8d924dd975b8fa06a300eb74}{ET\_NO\_ERRORS}};\ \textcolor{comment}{//\ return\ no\ errors}}
\DoxyCodeLine{\Hypertarget{____modbus__data_8c_source_l00141}00141\ \}}

\end{DoxyCode}
