762 lines
111 KiB
TeX
762 lines
111 KiB
TeX
\doxysection{modbus\+\_\+master.\+c}
|
||
\hypertarget{modbus__master_8c_source}{}\label{modbus__master_8c_source}\index{E:/.WORK/STM32/Diod\_Test/diode\_tester/Core/Modbus/Src/modbus\_master.c@{E:/.WORK/STM32/Diod\_Test/diode\_tester/Core/Modbus/Src/modbus\_master.c}}
|
||
\mbox{\hyperlink{modbus__master_8c}{Go to the documentation of this file.}}
|
||
\begin{DoxyCode}{0}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00001}00001\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00002}00002\ \textcolor{comment}{*******************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00003}00003\ \textcolor{comment}{*\ @file\ modbus\_master.c}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Модуль\ для\ реализации\ мастера\ MODBUS.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00005}00005\ \textcolor{comment}{*******************************************************************************}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00006}00006\ \textcolor{comment}{*\ @details\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00007}00007\ \textcolor{comment}{Файл\ содержит\ реализацию\ функций\ для\ работы\ Modbus\ в\ режиме\ мастера.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00008}00008\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00009}00009\ \textcolor{comment}{@section\ mast\ Функции\ и\ макросы}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00010}00010\ \textcolor{comment}{-\/\ MB\_RespGet\_RegisterAll()\ \ \ \ \ \ —\ Считать\ все\ регистра\ из\ ответа}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00011}00011\ \textcolor{comment}{-\/\ MB\_RespGet\_RegisterValue()\ \ \ \ —\ Считать\ один\ регистр\ из\ ответа}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00012}00012\ \textcolor{comment}{-\/\ MB\_RespGet\_CoilAll()\ \ \ \ \ \ \ \ \ \ —\ Считать\ все\ коилы\ из\ ответа}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00013}00013\ \textcolor{comment}{-\/\ MB\_RespGet\_CoilState()\ \ \ \ \ \ \ \ —\ Считать\ один\ коил\ из\ ответа}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00014}00014\ \textcolor{comment}{-\/\ MB\_RespGet\_NumberOfObjects()\ \ —\ Считать\ количество\ принятых\ объектов\ идентификатора}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00015}00015\ \textcolor{comment}{-\/\ MB\_RespGet\_ObjectById()\ \ \ \ \ \ \ —\ Считать\ объект\ идентификатора\ по\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00016}00016\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ его\ ID}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00017}00017\ \textcolor{comment}{-\/\ MB\_RespGet\_ObjectByIndex()\ \ \ \ —\ Считать\ объект\ идентификатора\ по\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00018}00018\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ порядковому\ номеру\ в\ сообщении}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00019}00019\ \textcolor{comment}{-\/\ MB\_RespGet\_Diagnostic()\ \ \ \ \ \ \ —\ Считать\ запрошенный\ диагностический\ счетчик}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00020}00020\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00021}00021\ \textcolor{comment}{-\/\ MB\_Master\_Collect\_Message()\ —\ Сбор\ сообщения\ в\ режиме\ мастера}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00022}00022\ \textcolor{comment}{-\/\ MB\_Master\_Parse\_Message()\ \ \ —\ Парс\ сообщения\ в\ режиме\ мастера}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00023}00023\ \textcolor{comment}{******************************************************************************/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00024}00024\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{modbus_8h}{modbus.h}}"{}}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00025}00025\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00026}00026\ \textcolor{preprocessor}{\#ifdef\ MODBUS\_ENABLE\_MASTER}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00027}00027\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00028}00028\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00029}00029\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00030}00030\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/FOR\ USER-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}\textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00031}00031\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00032}00032\ \textcolor{comment}{\ \ *\ @brief\ Получить\ значение\ ВСЕХ\ регистров\ в\ ответе}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00033}00033\ \textcolor{comment}{\ \ *\ @param\ modbus\_msg\ Указатель\ на\ структуру\ сообщения}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00034}00034\ \textcolor{comment}{\ \ *\ @param\ reg\_addr\ Адрес\ регистра,\ значение\ которого\ нужно\ получить}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00035}00035\ \textcolor{comment}{\ \ *\ @param\ reg\_arr\ \ Указатель\ для\ массив\ для\ сохранения\ значений\ регистров}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00036}00036\ \textcolor{comment}{\ \ *\ @return\ количество\ считанных\ регистров,\ 0\ -\/\ ошибка}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00037}00037\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00038}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_g_s___a_p_i_ga86160c23899d6ece041e3680ba863019}{00038}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_g_s___a_p_i_ga86160c23899d6ece041e3680ba863019}{MB\_RespGet\_RegisterAll}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ uint16\_t\ *reg\_arr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00039}00039\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00040}00040\ \ \ \textcolor{keywordflow}{if}(modbus\_msg\ ==\ NULL\ ||\ reg\_arr\ ==\ NULL)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00041}00041\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00042}00042\ \ \ \textcolor{keywordtype}{int}\ read\_cnt\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00043}00043\ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00044}00044\ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ addr\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}};\ addr\ <\ modbus\_msg-\/>Addr\ +\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}};\ addr++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00045}00045\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00046}00046\ \ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_g_s___a_p_i_ga1f80317087624a23f84224c6f2c1d596}{MB\_RespGet\_RegisterValue}}(modbus\_msg,\ addr,\ \®\_arr[i]))}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00047}00047\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00048}00048\ \ \ \ \ \ \ read\_cnt++;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00049}00049\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00050}00050\ \ \ \ \ i++;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00051}00051\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00052}00052\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00053}00053\ \ \ \textcolor{keywordflow}{return}\ read\_cnt;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00054}00054\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00055}00055\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00056}00056\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00057}00057\ \textcolor{comment}{\ \ *\ @brief\ Получить\ значение\ регистра\ в\ ответе\ по\ его\ адресу}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00058}00058\ \textcolor{comment}{\ \ *\ @param\ modbus\_msg\ Указатель\ на\ структуру\ сообщения}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00059}00059\ \textcolor{comment}{\ \ *\ @param\ reg\_addr\ Адрес\ регистра,\ значение\ которого\ нужно\ получить}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00060}00060\ \textcolor{comment}{\ \ *\ @param\ reg\_value\ Указатель\ для\ значения\ регистра}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00061}00061\ \textcolor{comment}{\ \ *\ @return\ 1\ -\/\ успех,\ 0\ -\/\ ошибка\ или\ reg\_addr\ вне\ диапазона\ запроса}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00062}00062\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00063}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_g_s___a_p_i_ga1f80317087624a23f84224c6f2c1d596}{00063}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_g_s___a_p_i_ga1f80317087624a23f84224c6f2c1d596}{MB\_RespGet\_RegisterValue}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ uint16\_t\ reg\_addr,\ uint16\_t\ *reg\_value)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00064}00064\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00065}00065\ \ \ \textcolor{keywordflow}{if}(modbus\_msg\ ==\ NULL\ ||\ reg\_value\ ==\ NULL)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00066}00066\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00067}00067\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00068}00068\ \ \ \textcolor{comment}{//\ Проверяем\ что\ ответ\ связан\ с\ регистрами}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00069}00069\ \ \ \textcolor{keywordflow}{if}((modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ !=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a438c348676901d3e0263fd1f8d94bf11}{FC\_R\_DISC\_IN}})\ \&\&}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00070}00070\ \ \ \ \ \ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ !=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2ae03921b16750ef290fdd7d19a08a29a2}{FC\_R\_HOLD\_REGS}})\ \&\&}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00071}00071\ \ \ \ \ \ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ !=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a76139e9b7ae78856fd3a297c9f751944}{FC\_R\_IN\_REGS}}))}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00072}00072\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00073}00073\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00074}00074\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00075}00075\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00076}00076\ \ \ \textcolor{comment}{//\ Проверяем\ что\ reg\_addr\ в\ пределах\ запрошенного\ диапазона}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00077}00077\ \ \ \textcolor{keywordflow}{if}(reg\_addr\ <\ modbus\_msg-\/>Addr\ ||\ reg\_addr\ >=\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}}\ +\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00078}00078\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00079}00079\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00080}00080\ \ \ \textcolor{comment}{//\ Вычисляем\ индекс\ регистра\ в\ полученных\ данных}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00081}00081\ \ \ uint16\_t\ reg\_index\ =\ reg\_addr\ -\/\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00082}00082\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00083}00083\ \ \ \textcolor{comment}{//\ Проверяем\ что\ регистр\ существует\ в\ данных}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00084}00084\ \ \ \textcolor{keywordflow}{if}(reg\_index\ >=\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ /\ 2)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00085}00085\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00086}00086\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00087}00087\ \ \ \textcolor{comment}{//\ Получаем\ значение\ регистра}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00088}00088\ \ \ *reg\_value\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[reg\_index];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00089}00089\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00090}00090\ \ \ \textcolor{keywordflow}{return}\ 1;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00091}00091\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00092}00092\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00093}00093\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00094}00094\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00095}00095\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00096}00096\ \textcolor{comment}{\ \ *\ @brief\ Получить\ состояние\ ВСЕХ\ coil\ в\ ответе}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00097}00097\ \textcolor{comment}{\ \ *\ @param\ modbus\_msg\ Указатель\ на\ структуру\ сообщения}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00098}00098\ \textcolor{comment}{\ \ *\ @param\ coil\_arr\ \ \ Указатель\ для\ массив\ доя\ сохранения\ состояний\ coil\ (1\ -\/\ ON,\ 0\ -\/\ OFF)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00099}00099\ \textcolor{comment}{\ \ *\ @return\ 1\ -\/\ успех,\ 0\ -\/\ ошибка\ или\ coil\_addr\ вне\ диапазона\ запроса}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00100}00100\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00101}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___c_o_i_l_s___a_p_i_ga14750bad3976a9fcc6bdece1c800dbf5}{00101}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___c_o_i_l_s___a_p_i_ga14750bad3976a9fcc6bdece1c800dbf5}{MB\_RespGet\_CoilAll}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ \textcolor{keywordtype}{int}\ *coil\_arr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00102}00102\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00103}00103\ \ \ \textcolor{keywordflow}{if}(modbus\_msg\ ==\ NULL\ ||\ coil\_arr\ ==\ NULL)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00104}00104\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00105}00105\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00106}00106\ \ \ \textcolor{keywordtype}{int}\ read\_cnt\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00107}00107\ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00108}00108\ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ addr\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}};\ addr\ <\ modbus\_msg-\/>Addr\ +\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}};\ addr++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00109}00109\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00110}00110\ \ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___c_o_i_l_s___a_p_i_ga643a0be1ccd587a6dfe544d9fd5ed018}{MB\_RespGet\_CoilState}}(modbus\_msg,\ addr,\ \&coil\_arr[i]))}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00111}00111\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00112}00112\ \ \ \ \ \ \ read\_cnt++;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00113}00113\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00114}00114\ \ \ \ \ i++;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00115}00115\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00116}00116\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00117}00117\ \ \ \textcolor{keywordflow}{return}\ 1;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00118}00118\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00119}00119\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00120}00120\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00121}00121\ \textcolor{comment}{\ \ *\ @brief\ Получить\ состояние\ coil\ в\ ответе\ по\ его\ адресу}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00122}00122\ \textcolor{comment}{\ \ *\ @param\ modbus\_msg\ Указатель\ на\ структуру\ сообщения}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00123}00123\ \textcolor{comment}{\ \ *\ @param\ coil\_addr\ Адрес\ coil,\ состояние\ которого\ нужно\ получить}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00124}00124\ \textcolor{comment}{\ \ *\ @param\ coil\_state\ Указатель\ для\ состояния\ coil\ (1\ -\/\ ON,\ 0\ -\/\ OFF)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00125}00125\ \textcolor{comment}{\ \ *\ @return\ 1\ -\/\ успех,\ 0\ -\/\ ошибка\ или\ coil\_addr\ вне\ диапазона\ запроса}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00126}00126\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00127}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___c_o_i_l_s___a_p_i_ga643a0be1ccd587a6dfe544d9fd5ed018}{00127}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___c_o_i_l_s___a_p_i_ga643a0be1ccd587a6dfe544d9fd5ed018}{MB\_RespGet\_CoilState}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ uint16\_t\ coil\_addr,\ \textcolor{keywordtype}{int}\ *coil\_state)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00128}00128\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00129}00129\ \ \ \textcolor{keywordflow}{if}(modbus\_msg\ ==\ NULL\ ||\ coil\_state\ ==\ NULL)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00130}00130\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00131}00131\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00132}00132\ \ \ \textcolor{comment}{//\ Проверяем\ что\ ответ\ связан\ с\ коилами}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00133}00133\ \ \ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ !=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a399bcd53bc32faca81bbc3d1ff8b5bb6}{FC\_R\_COILS}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00134}00134\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00135}00135\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00136}00136\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00137}00137\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00138}00138\ \ \ \textcolor{comment}{//\ Проверяем\ что\ coil\_addr\ в\ пределах\ запрошенного\ диапазона}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00139}00139\ \ \ \textcolor{keywordflow}{if}(coil\_addr\ <\ modbus\_msg-\/>Addr\ ||\ coil\_addr\ >=\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}}\ +\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00140}00140\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00141}00141\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00142}00142\ \ \ \textcolor{comment}{//\ Вычисляем\ индекс\ coil\ в\ полученных\ данных}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00143}00143\ \ \ uint16\_t\ coil\_index\ =\ coil\_addr\ -\/\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00144}00144\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00145}00145\ \ \ \textcolor{comment}{//\ Вычисляем\ байт\ и\ бит}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00146}00146\ \ \ uint8\_t\ byte\_index\ =\ coil\_index\ /\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00147}00147\ \ \ uint8\_t\ data\_index\ =\ coil\_index\ /\ 16;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00148}00148\ \ \ uint8\_t\ bit\_index\ =\ coil\_index\ \%\ 16;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00149}00149\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00150}00150\ \ \ \textcolor{comment}{//\ Проверяем\ что\ байт\ существует\ в\ данных}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00151}00151\ \ \ \textcolor{keywordflow}{if}(byte\_index\ >=\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00152}00152\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00153}00153\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00154}00154\ \ \ \textcolor{comment}{//\ Получаем\ байт\ и\ проверяем\ бит\ \ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00155}00155\ \ \ \textcolor{keywordflow}{if}(bit\_index\ <\ 8)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00156}00156\ \ \ \ \ *coil\_state\ =\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[data\_index]\ >>\ (bit\_index+8))\ \&\ 0x01;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00157}00157\ \ \ \textcolor{keywordflow}{else}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00158}00158\ \ \ \ \ *coil\_state\ =\ ((modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[data\_index]\&0xFF)\ >>\ (bit\_index-\/8))\ \&\ 0x01;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00159}00159\ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00160}00160\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00161}00161\ \ \ \textcolor{keywordflow}{return}\ 1;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00162}00162\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00163}00163\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00164}00164\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00165}00165\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00166}00166\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Получить\ количество\ объектов\ в\ сообщении}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00167}00167\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ Указатель\ на\ структуру\ сообщения}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00168}00168\ \textcolor{comment}{\ \ *\ @return\ \ \ int\ \ \ \ \ \ \ \ \ Количество\ объектов}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00169}00169\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00170}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___d_e_f_i_d___a_p_i_ga16b90d4a74a249514161aa4576724d1c}{00170}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___d_e_f_i_d___a_p_i_ga16b90d4a74a249514161aa4576724d1c}{MB\_RespGet\_NumberOfObjects}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00171}00171\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00172}00172\ \ \ \textcolor{keywordflow}{if}(modbus\_msg\ ==\ NULL)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00173}00173\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00174}00174\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00175}00175\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00176}00176\ \ \ \textcolor{comment}{//\ Проверяем\ что\ ответ\ связан\ с\ диагностикой}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00177}00177\ \ \ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ !=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00178}00178\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00179}00179\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00180}00180\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00181}00181\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00182}00182\ \ \ \textcolor{keywordflow}{return}\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.NumbOfObj;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00183}00183\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00184}00184\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00185}00185\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00186}00186\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Найти\ объект\ по\ ID\ в\ сообщении}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00187}00187\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ Указатель\ на\ структуру\ сообщения}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00188}00188\ \textcolor{comment}{\ \ *\ @param\ \ \ \ obj\_id\ \ \ \ \ \ ID\ искомого\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00189}00189\ \textcolor{comment}{\ \ *\ @param\ \ \ \ obj\_data\ \ \ \ Буфер\ для\ данных\ объекта\ (может\ быть\ NULL)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00190}00190\ \textcolor{comment}{\ \ *\ @param\ \ \ \ obj\_length\ \ Указатель\ для\ длины\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00191}00191\ \textcolor{comment}{\ \ *\ @return\ \ \ int\ \ \ \ \ \ \ \ \ Найден\ ли\ объект\ (1\ -\/\ да,\ 0\ -\/\ нет)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00192}00192\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00193}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___d_e_f_i_d___a_p_i_ga0dc4119c008af34d5997eab339c437be}{00193}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___d_e_f_i_d___a_p_i_ga0dc4119c008af34d5997eab339c437be}{MB\_RespGet\_ObjectById}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ uint8\_t\ obj\_id,\ \textcolor{keywordtype}{char}\ *obj\_data,\ uint8\_t\ *obj\_length)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00194}00194\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00195}00195\ \ \ \textcolor{keywordflow}{if}((modbus\_msg\ ==\ NULL)\ ||\ (obj\_data\ ==\ NULL))}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00196}00196\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00197}00197\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00198}00198\ \ \ \textcolor{comment}{//\ Проверяем\ что\ ответ\ связан\ с\ диагностикой}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00199}00199\ \ \ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ !=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00200}00200\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00201}00201\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00202}00202\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00203}00203\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00204}00204\ \ \ uint8\_t\ *data\ =\ (uint8\_t*)modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00205}00205\ \ \ \textcolor{keywordtype}{unsigned}\ ind\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00206}00206\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00207}00207\ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.NumbOfObj;\ i++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00208}00208\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00209}00209\ \ \ \ \ uint8\_t\ current\_id\ =\ data[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00210}00210\ \ \ \ \ uint8\_t\ current\_length\ =\ data[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00211}00211\ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00212}00212\ \ \ \ \ \textcolor{keywordflow}{if}(current\_id\ ==\ obj\_id)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00213}00213\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00214}00214\ \ \ \ \ \ \ \textcolor{keywordflow}{if}(obj\_length)\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00215}00215\ \ \ \ \ \ \ \ \ *obj\_length\ =\ current\_length;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00216}00216\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00217}00217\ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ current\_length;\ j++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00218}00218\ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00219}00219\ \ \ \ \ \ \ \ \ obj\_data[j]\ =\ data[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00220}00220\ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00221}00221\ \ \ \ \ \ \ obj\_data[current\_length]\ =\ \textcolor{charliteral}{'\(\backslash\)0'};\ \textcolor{comment}{//\ добавляем\ \(\backslash\)0}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00222}00222\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00223}00223\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 1;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00224}00224\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00225}00225\ \ \ \ \ \textcolor{keywordflow}{else}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00226}00226\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00227}00227\ \ \ \ \ \ \ \textcolor{comment}{//\ Пропускаем\ данные\ этого\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00228}00228\ \ \ \ \ \ \ ind\ +=\ current\_length;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00229}00229\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00230}00230\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00231}00231\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00232}00232\ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00233}00233\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00234}00234\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00235}00235\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00236}00236\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Получить\ объект\ по\ индексу\ в\ сообщении}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00237}00237\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ Указатель\ на\ структуру\ сообщения}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00238}00238\ \textcolor{comment}{\ \ *\ @param\ \ \ \ index\ \ \ \ \ \ \ Индекс\ объекта\ (0..N-\/1)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00239}00239\ \textcolor{comment}{\ \ *\ @param\ \ \ \ obj\_id\ \ \ \ \ \ Указатель\ для\ ID\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00240}00240\ \textcolor{comment}{\ \ *\ @param\ \ \ \ obj\_data\ \ \ \ Буфер\ для\ данных\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00241}00241\ \textcolor{comment}{\ \ *\ @param\ \ \ \ obj\_length\ \ Указатель\ для\ длины\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00242}00242\ \textcolor{comment}{\ \ *\ @return\ \ \ int\ \ \ \ \ \ \ \ \ Успешность\ получения\ (1\ -\/\ получен,\ 0\ -\/\ не\ найден)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00243}00243\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00244}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___d_e_f_i_d___a_p_i_ga3fc5fc5abfe4f8767ccee5c11ea3d5d5}{00244}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___d_e_f_i_d___a_p_i_ga3fc5fc5abfe4f8767ccee5c11ea3d5d5}{MB\_RespGet\_ObjectByIndex}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ \textcolor{keywordtype}{int}\ index,\ uint8\_t\ *obj\_id,\ \textcolor{keywordtype}{char}\ *obj\_data,\ uint8\_t\ *obj\_length)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00245}00245\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00246}00246\ \ \ \textcolor{keywordflow}{if}((modbus\_msg\ ==\ NULL)\ ||\ (obj\_data\ ==\ NULL))}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00247}00247\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00248}00248\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00249}00249\ \ \ \textcolor{comment}{//\ Проверяем\ что\ ответ\ связан\ с\ диагностикой}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00250}00250\ \ \ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ !=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00251}00251\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00252}00252\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00253}00253\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00254}00254\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00255}00255\ \ \ \textcolor{keywordflow}{if}(index\ >=\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.NumbOfObj)\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00256}00256\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00257}00257\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00258}00258\ \ \ uint8\_t\ *data\ =\ (uint8\_t*)modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00259}00259\ \ \ \textcolor{keywordtype}{unsigned}\ ind\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00260}00260\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00261}00261\ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <=\ index;\ i++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00262}00262\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00263}00263\ \ \ \ \ uint8\_t\ current\_id\ =\ data[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00264}00264\ \ \ \ \ uint8\_t\ current\_length\ =\ data[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00265}00265\ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00266}00266\ \ \ \ \ \textcolor{keywordflow}{if}(obj\_id)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00267}00267\ \ \ \ \ \ \ *obj\_id\ =\ current\_id;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00268}00268\ \ \ \ \ \textcolor{keywordflow}{if}(obj\_length)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00269}00269\ \ \ \ \ \ \ *obj\_length\ =\ current\_length;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00270}00270\ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00271}00271\ \ \ \ \ \textcolor{keywordflow}{if}(i\ ==\ index)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00272}00272\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00273}00273\ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ current\_length;\ j++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00274}00274\ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00275}00275\ \ \ \ \ \ \ \ \ obj\_data[j]\ =\ data[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00276}00276\ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00277}00277\ \ \ \ \ \ \ obj\_data[current\_length]\ =\ \textcolor{charliteral}{'\(\backslash\)0'};\ \textcolor{comment}{//\ добавляем\ \(\backslash\)0}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00278}00278\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 1;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00279}00279\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00280}00280\ \ \ \ \ \textcolor{keywordflow}{else}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00281}00281\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00282}00282\ \ \ \ \ \ \ \textcolor{comment}{//\ Пропускаем\ данные\ этого\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00283}00283\ \ \ \ \ \ \ ind\ +=\ current\_length;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00284}00284\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00285}00285\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00286}00286\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00287}00287\ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00288}00288\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00289}00289\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00290}00290\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00291}00291\ \textcolor{comment}{/**}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00292}00292\ \textcolor{comment}{\ \ *\ @brief\ Получить\ данные\ диагностики\ из\ сообщения\ (MbData[1])}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00293}00293\ \textcolor{comment}{\ \ *\ @param\ modbus\_msg\ Указатель\ на\ структуру\ сообщения}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00294}00294\ \textcolor{comment}{\ \ *\ @param\ data\ Указатель\ куда\ положить\ данные}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00295}00295\ \textcolor{comment}{\ \ *\ @return\ 1\ -\/\ успех,\ 0\ -\/\ ошибка}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00296}00296\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00297}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___d_i_a_g___a_p_i_ga46a9650ec68832e6f95eda579f4d9ded}{00297}}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q___d_i_a_g___a_p_i_ga46a9650ec68832e6f95eda579f4d9ded}{MB\_RespGet\_Diagnostic}}(\mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ uint16\_t\ *data)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00298}00298\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00299}00299\ \ \ \textcolor{keywordflow}{if}(modbus\_msg\ ==\ NULL\ ||\ data\ ==\ NULL)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00300}00300\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00301}00301\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00302}00302\ \ \ \textcolor{comment}{//\ Проверяем\ что\ ответ\ связан\ с\ диагностикой}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00303}00303\ \ \ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ !=\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2aa6423de9e908dc38ce9f1c8027ad72ec}{FC\_R\_DIAGNOSTICS}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00304}00304\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00305}00305\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00306}00306\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00307}00307\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00308}00308\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00309}00309\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00310}00310\ \ \ *data\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00311}00311\ \ \ \textcolor{keywordflow}{return}\ 1;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00312}00312\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00313}00313\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00314}00314\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00315}00315\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00316}00316\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00317}00317\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00318}00318\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/INTERNAL-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}\textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00319}00319\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00320}00320\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Определить\ размер\ модбас\ запроса\ (МАСТЕР\ версия).}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00321}00321\ \textcolor{comment}{\ \ *\ @param\ \ \ \ hRS\ \ \ \ \ \ \ \ \ \ \ Указатель\ на\ хендлер\ RS.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00322}00322\ \textcolor{comment}{\ \ *\ @param\ \ \ \ rx\_data\_size\ \ Указатель\ на\ переменную\ для\ записи\ кол-\/ва\ байт\ для\ принятия.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00323}00323\ \textcolor{comment}{\ \ *\ @return\ \ \ RS\_RES\ \ \ \ \ \ \ \ Статус\ о\ корректности\ рассчета\ кол-\/ва\ байт\ для\ принятия.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00324}00324\ \textcolor{comment}{\ \ *\ @details\ \ Определение\ сколько\ байтов\ надо\ принять\ по\ протоколу.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00325}00325\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00326}\mbox{\hyperlink{modbus__master_8c_a79e3f84b9daba8a42c8ca6026133acc5}{00326}}\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{modbus__master_8c_a79e3f84b9daba8a42c8ca6026133acc5}{MB\_Define\_Size\_of\_Function}}(\mbox{\hyperlink{struct_r_s___handle_type_def}{RS\_HandleTypeDef}}\ *hmodbus,\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00327}00327\ \{\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00328}00328\ \ \ \mbox{\hyperlink{group___r_s___t_o_o_l_s_ga727154b368397b4796aa892de12a2289}{RS\_StatusTypeDef}}\ MB\_RES\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00329}00329\ \ \ \textcolor{keywordtype}{int}\ mb\_func\_size\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00330}00330\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00331}00331\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00332}00332\ \ \ \textcolor{comment}{//\ Master\ mode\ -\/\ calculating\ response\ size\ from\ slave}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00333}00333\ \ \ \textcolor{keywordflow}{if}\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ \&\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga822b0fd9ae9ff25dfa6748473e8e8627}{FC\_ERR\_VALUES\_START}})\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00334}00334\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00335}00335\ \ \ \ \ \textcolor{comment}{//\ Error\ response:\ [Addr][Func|0x80][ExceptCode][CRC]}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00336}00336\ \ \ \ \ mb\_func\_size\ =\ -\/1;\ \textcolor{comment}{//\ Only\ Exception\ Code}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00337}00337\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00338}00338\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2aa6423de9e908dc38ce9f1c8027ad72ec}{FC\_R\_DIAGNOSTICS}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00339}00339\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00340}00340\ \ \ \ \ \textcolor{comment}{//\ Diagnostics\ response:\ [SubFunc\_HI][SubFunc\_LO][Data\_HI][Data\_LO]}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00341}00341\ \ \ \ \ mb\_func\_size\ =\ 1;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00342}00342\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00343}00343\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00344}00344\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00345}00345\ \ \ \ \ \textcolor{comment}{//\ Device\ identifications:\ variable\ size,\ need\ to\ read\ first\ to\ determine}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00346}00346\ \ \ \ \ mb\_func\_size\ =\ 0;\ \textcolor{comment}{//\ Will\ be\ determined\ after\ reading\ header}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00347}00347\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00348}00348\ \ \ \textcolor{keywordflow}{else}\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00349}00349\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00350}00350\ \ \ \ \ \textcolor{keywordflow}{switch}\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ \&\ \string~\mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga822b0fd9ae9ff25dfa6748473e8e8627}{FC\_ERR\_VALUES\_START}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00351}00351\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00352}00352\ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ 0x01:\ \textcolor{comment}{//\ Read\ Coils}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00353}00353\ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ 0x02:\ \textcolor{comment}{//\ Read\ Discrete\ Inputs}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00354}00354\ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ 0x03:\ \textcolor{comment}{//\ Read\ Holding\ Registers\ \ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00355}00355\ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ 0x04:\ \textcolor{comment}{//\ Read\ Input\ Registers}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00356}00356\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Response:\ [ByteCount][Data...]}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00357}00357\ \ \ \ \ \ \ \ \ mb\_func\_size\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ +\ 2;\ \textcolor{comment}{//\ ByteCount\ +\ variable\ data}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00358}00358\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00359}00359\ \ \ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00360}00360\ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ 0x05:\ \textcolor{comment}{//\ Write\ Single\ Coil}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00361}00361\ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ 0x06:\ \textcolor{comment}{//\ Write\ Single\ Register}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00362}00362\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Echo\ response:\ [Addr][Value][CRC]}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00363}00363\ \ \ \ \ \ \ \ \ mb\_func\_size\ =\ 4;\ \textcolor{comment}{//\ Address(2)\ +\ Value(2)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00364}00364\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00365}00365\ \ \ \ \ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00366}00366\ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ 0x0F:\ \textcolor{comment}{//\ Write\ Multiple\ Coils}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00367}00367\ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ 0x10:\ \textcolor{comment}{//\ Write\ Multiple\ Registers}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00368}00368\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Echo\ response:\ [Addr][Qty][CRC]\ \ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00369}00369\ \ \ \ \ \ \ \ \ mb\_func\_size\ =\ 4;\ \textcolor{comment}{//\ Address(2)\ +\ Quantity(2)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00370}00370\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00371}00371\ \ \ \ \ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00372}00372\ \ \ \ \ \ \ \textcolor{keywordflow}{default}:}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00373}00373\ \ \ \ \ \ \ \ \ mb\_func\_size\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00374}00374\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00375}00375\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00376}00376\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00377}00377\ \ \ mb\_func\_size\ =\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga18eb6d0d9fdb6274341e892e2b41d88b}{RX\_FIRST\_PART\_SIZE}}\ +\ mb\_func\_size;\ \textcolor{comment}{//\ size\ of\ whole\ message}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00378}00378\ \ \ \textcolor{keywordflow}{return}\ mb\_func\_size;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00379}00379\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00380}00380\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00381}00381\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00382}00382\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Сбор\ сообщения\ в\ буфер\ UART\ в\ режиме\ мастер\ (фрейм\ мастера\ из\ msg\ -\/>\ uart).}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00383}00383\ \textcolor{comment}{\ \ *\ @param\ \ \ \ hmodbus\ \ \ \ \ \ \ \ \ \ \ Указатель\ на\ хендлер\ RS.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00384}00384\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ \ \ \ \ \ \ Указатель\ на\ структуру\ сообщения.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00385}00385\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_uart\_buff\ \ Указатель\ на\ буффер\ UART.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00386}00386\ \textcolor{comment}{\ \ *\ @return\ \ \ RS\_RES\ \ \ \ \ \ \ \ Статус\ о\ результате\ заполнения\ буфера.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00387}00387\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00388}\mbox{\hyperlink{group___m_o_d_b_u_s___m_a_s_t_e_r_ga096d2790ab887eb815e17d8cd9ede125}{00388}}\ \mbox{\hyperlink{group___r_s___t_o_o_l_s_ga727154b368397b4796aa892de12a2289}{RS\_StatusTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_a_s_t_e_r_ga096d2790ab887eb815e17d8cd9ede125}{MB\_Master\_Collect\_Message}}(\mbox{\hyperlink{struct_r_s___handle_type_def}{RS\_HandleTypeDef}}\ *hmodbus,\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ uint8\_t\ *modbus\_uart\_buff)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00389}00389\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00390}00390\ \ \ \textcolor{keywordtype}{int}\ ind\ =\ 0;\ \textcolor{comment}{//\ ind\ for\ modbus-\/uart\ buffer}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00391}00391\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00392}00392\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/INFO\ ABOUT\ DATA/MESSAGE-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00393}00393\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/[first\ bytes]-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00394}00394\ \ \ \textcolor{comment}{//\ set\ ID\ of\ slave\ device}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00395}00395\ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a277ed439b65aedbf03bd112c073e6a32}{MbAddr}};\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00396}00396\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00397}00397\ \ \ \textcolor{comment}{//\ set\ function\ code}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00398}00398\ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}};\ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00399}00399\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00400}00400\ \ \ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ <\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga822b0fd9ae9ff25dfa6748473e8e8627}{FC\_ERR\_VALUES\_START}})\ \textcolor{comment}{//\ if\ no\ error\ occur}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00401}00401\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00402}00402\ \ \ \ \ \textcolor{comment}{//\ fill\ modbus\ header}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00403}00403\ \ \ \ \ \textcolor{keywordflow}{if}(0)\ \{\}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00404}00404\ \textcolor{preprocessor}{\#ifdef\ MODBUS\_ENABLE\_DEVICE\_IDENTIFICATIONS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00405}00405\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}})\ \textcolor{comment}{//\ device\ identifications\ request}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00406}00406\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00407}00407\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.\mbox{\hyperlink{struct_m_b___dev_id_msg_type_def_aefb693da9f6b86a6da833c4177302092}{MEI\_Type}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00408}00408\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.ReadDevId;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00409}00409\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.NextObjId;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00410}00410\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00411}00411\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//MODBUS\_ENABLE\_DEVICE\_IDENTIFICATIONS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00412}00412\ \textcolor{preprocessor}{\#ifdef\ MODBUS\_ENABLE\_DIAGNOSTICS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00413}00413\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2aa6423de9e908dc38ce9f1c8027ad72ec}{FC\_R\_DIAGNOSTICS}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00414}00414\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00415}00415\ \ \ \ \ \ \ \textcolor{comment}{//\ Diagnostics:\ [SubFunc\_HI][SubFunc\_LO][Data\_HI][Data\_LO]}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00416}00416\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ >>\ 8;\ \ \ \textcolor{comment}{//\ Sub-\/function\ HI}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00417}00417\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ \&\ 0xFF;\ \textcolor{comment}{//\ Sub-\/function\ LO}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00418}00418\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ >>\ 8;\ \ \ \textcolor{comment}{//\ Data\ HI}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00419}00419\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ \&\ 0xFF;\ \textcolor{comment}{//\ Data\ LO}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00420}00420\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00421}00421\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//MODBUS\_ENABLE\_DIAGNOSTICS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00422}00422\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{comment}{//\ classic\ modbus\ request}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00423}00423\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00424}00424\ \ \ \ \ \ \ \textcolor{comment}{//\ set\ address}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00425}00425\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}}\ >>\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00426}00426\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}}\ \&\ 0xFF;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00427}00427\ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00428}00428\ \ \ \ \ \ \ \textcolor{comment}{//\ set\ quantity}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00429}00429\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}}\ >>\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00430}00430\ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}}\ \&\ 0xFF;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00431}00431\ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00432}00432\ \ \ \ \ \ \ \textcolor{comment}{//\ for\ write\ multiple\ functions}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00433}00433\ \ \ \ \ \ \ \textcolor{keywordflow}{if}((modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x0F)\ ||\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x10))}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00434}00434\ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00435}00435\ \ \ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00436}00436\ \ \ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00437}00437\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ write\ data\ bytes}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00438}00438\ \ \ \ \ \ \ \ \ uint8\_t\ *tmp\_data\_addr\ =\ (uint8\_t\ *)modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00439}00439\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}};\ i++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00440}00440\ \ \ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00441}00441\ \ \ \ \ \ \ \ \ \ \ modbus\_uart\_buff[ind++]\ =\ tmp\_data\_addr[i];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00442}00442\ \ \ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00443}00443\ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00444}00444\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00445}00445\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00446}00446\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00447}00447\ \ \ \textcolor{keywordflow}{if}(ind\ <\ 0)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00448}00448\ \ \ \ \ \textcolor{keywordflow}{return}\ RS\_COLLECT\_MSG\_ERR;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00449}00449\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00450}00450\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/CRC-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00451}00451\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/[last\ 2\ bytes]-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00452}00452\ \ \ uint16\_t\ CRC\_VALUE\ =\ crc16(modbus\_uart\_buff,\ ind);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00453}00453\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a423ab838d4c113fd6392452fd44dc1c0}{MbCRC}}\ =\ CRC\_VALUE;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00454}00454\ \ \ modbus\_uart\_buff[ind++]\ =\ CRC\_VALUE\ \&\ 0xFF;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00455}00455\ \ \ modbus\_uart\_buff[ind++]\ =\ CRC\_VALUE\ >>\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00456}00456\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00457}00457\ \ \ hmodbus-\/>\mbox{\hyperlink{struct_r_s___handle_type_def_a495a29011412451e53459f9e1513814d}{RS\_Message\_Size}}\ =\ ind;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00458}00458\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00459}00459\ \ \ \textcolor{keywordflow}{return}\ RS\_OK;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00460}00460\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00461}00461\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00462}00462\ \textcolor{comment}{/**\ }}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00463}00463\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ Парс\ сообщения\ в\ режиме\ мастер\ (фрейм\ слейва\ из\ uart\ -\/>\ msg).}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00464}00464\ \textcolor{comment}{\ \ *\ @param\ \ \ \ hmodbus\ \ \ \ \ \ \ \ \ \ \ Указатель\ на\ хендлер\ RS.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00465}00465\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_msg\ \ \ \ \ \ \ \ Указатель\ на\ структуру\ сообщения.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00466}00466\ \textcolor{comment}{\ \ *\ @param\ \ \ \ modbus\_uart\_buff\ \ Указатель\ на\ буффер\ UART.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00467}00467\ \textcolor{comment}{\ \ *\ @return\ \ \ RS\_RES\ \ \ \ \ \ \ \ Статус\ о\ результате\ заполнения\ структуры.}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00468}00468\ \textcolor{comment}{\ \ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00469}\mbox{\hyperlink{group___m_o_d_b_u_s___m_a_s_t_e_r_ga461e77fe31ce64c7ee5f1a932dc1183f}{00469}}\ \mbox{\hyperlink{group___r_s___t_o_o_l_s_ga727154b368397b4796aa892de12a2289}{RS\_StatusTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_a_s_t_e_r_ga461e77fe31ce64c7ee5f1a932dc1183f}{MB\_Master\_Parse\_Message}}(\mbox{\hyperlink{struct_r_s___handle_type_def}{RS\_HandleTypeDef}}\ *hmodbus,\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ *modbus\_msg,\ uint8\_t\ *modbus\_uart\_buff)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00470}00470\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00471}00471\ \ \ \textcolor{keywordtype}{int}\ ind\ =\ 0;\ \textcolor{comment}{//\ ind\ for\ modbus-\/uart\ buffer}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00472}00472\ \ \ \textcolor{keywordtype}{int}\ expected\_size\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00473}00473\ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00474}00474\ \ \ \textcolor{comment}{//\ get\ ID\ of\ slave\ device}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00475}00475\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a277ed439b65aedbf03bd112c073e6a32}{MbAddr}}\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00476}00476\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00477}00477\ \ \ \textcolor{comment}{//\ get\ function\ code\ (check\ if\ error\ response)}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00478}00478\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00479}00479\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00480}00480\ \ \ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ \&\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga822b0fd9ae9ff25dfa6748473e8e8627}{FC\_ERR\_VALUES\_START}})\ \textcolor{comment}{//\ error\ response}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00481}00481\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00482}00482\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a3dab5eaf3a1dd5719b8bfec1adad0d39}{Except\_Code}}\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00483}00483\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00484}00484\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ <\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_ga822b0fd9ae9ff25dfa6748473e8e8627}{FC\_ERR\_VALUES\_START}})\ \textcolor{comment}{//\ normal\ response}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00485}00485\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00486}00486\ \ \ \ \ \textcolor{keywordflow}{if}(0)\ \{\}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00487}00487\ \textcolor{preprocessor}{\#ifdef\ MODBUS\_ENABLE\_DEVICE\_IDENTIFICATIONS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00488}00488\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}})\ \textcolor{comment}{//\ device\ identifications\ response}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00489}00489\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00490}00490\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.\mbox{\hyperlink{struct_m_b___dev_id_msg_type_def_aefb693da9f6b86a6da833c4177302092}{MEI\_Type}}\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00491}00491\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.ReadDevId\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00492}00492\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.\mbox{\hyperlink{struct_m_b___dev_id_msg_type_def_a1ef4b6db2785f723b26b0d9abe6f371e}{Conformity}}\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00493}00493\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.MoreFollows\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00494}00494\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.NextObjId\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00495}00495\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.NumbOfObj\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00496}00496\ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00497}00497\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00498}00498\ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00499}00499\ \ \ \ \ \ \ \textcolor{comment}{//\ Парсинг\ объектов\ идентификации\ устройства}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00500}00500\ \ \ \ \ \ \ uint8\_t\ *tmp\_data\_addr\ =\ (uint8\_t\ *)modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00501}00501\ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ data\_index\ =\ 0;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00502}00502\ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00503}00503\ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ obj\ =\ 0;\ obj\ <\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a51c020dacb24e4ffcff28b1d3c6a01ae}{DevId}}.NumbOfObj;\ obj++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00504}00504\ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00505}00505\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Читаем\ ID\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00506}00506\ \ \ \ \ \ \ \ \ uint8\_t\ object\_id\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00507}00507\ \ \ \ \ \ \ \ \ tmp\_data\_addr[data\_index++]\ =\ object\_id;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00508}00508\ \ \ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00509}00509\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Читаем\ длину\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00510}00510\ \ \ \ \ \ \ \ \ uint8\_t\ object\_length\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00511}00511\ \ \ \ \ \ \ \ \ tmp\_data\_addr[data\_index++]\ =\ object\_length;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00512}00512\ \ \ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00513}00513\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Читаем\ данные\ объекта}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00514}00514\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ object\_length;\ i++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00515}00515\ \ \ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00516}00516\ \ \ \ \ \ \ \ \ \ \ tmp\_data\_addr[data\_index++]\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00517}00517\ \ \ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00518}00518\ \ \ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00519}00519\ \ \ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ +=\ (2\ +\ object\_length);\ \textcolor{comment}{//\ ID\ +\ длина\ +\ данные}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00520}00520\ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00521}00521\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00522}00522\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//MODBUS\_ENABLE\_DEVICE\_IDENTIFICATIONS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00523}00523\ \textcolor{preprocessor}{\#ifdef\ MODBUS\_ENABLE\_DIAGNOSTICS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00524}00524\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2aa6423de9e908dc38ce9f1c8027ad72ec}{FC\_R\_DIAGNOSTICS}})}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00525}00525\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00526}00526\ \ \ \ \ \ \ \textcolor{comment}{//\ Diagnostics\ response:\ [SubFunc\_HI][SubFunc\_LO][Data\_HI][Data\_LO]}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00527}00527\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ =\ modbus\_uart\_buff[ind++]\ <<\ 8;\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00528}00528\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[0]\ |=\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00529}00529\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ =\ modbus\_uart\_buff[ind++]\ <<\ 8;\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00530}00530\ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[1]\ |=\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00531}00531\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00532}00532\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//MODBUS\_ENABLE\_DIAGNOSTICS}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00533}00533\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{comment}{//\ classic\ modbus\ response}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00534}00534\ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00535}00535\ \ \ \ \ \ \ \textcolor{comment}{//\ get\ byte\ count\ for\ read\ functions}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00536}00536\ \ \ \ \ \ \ \textcolor{keywordflow}{if}((modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x01)\ ||\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x02)\ ||\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00537}00537\ \ \ \ \ \ \ \ \ \ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x03)\ ||\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x04))}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00538}00538\ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00539}00539\ \ \ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00540}00540\ \ \ \ \ \ \ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00541}00541\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ read\ data\ bytes}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00542}00542\ \ \ \ \ \ \ \ \ uint16\_t\ *tmp\_data\_addr\ =\ (uint16\_t\ *)modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00543}00543\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}};\ i++)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00544}00544\ \ \ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00545}00545\ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(i\ \%\ 2\ ==\ 0)\ \ \ \textcolor{comment}{//\ HI\ byte}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00546}00546\ \ \ \ \ \ \ \ \ \ \ \ \ tmp\_data\_addr[i/2]\ =\ (uint16\_t)modbus\_uart\_buff[ind++]\ <<\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00547}00547\ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ LO\ byte}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00548}00548\ \ \ \ \ \ \ \ \ \ \ \ \ tmp\_data\_addr[i/2]\ |=\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00549}00549\ \ \ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00550}00550\ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00551}00551\ \ \ \ \ \ \ \textcolor{comment}{//\ for\ write\ functions\ -\/\ echo\ address\ and\ quantity}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00552}00552\ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}((modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x05)\ ||\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x06)\ ||}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00553}00553\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x0F)\ ||\ (modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a176d779ab0d7fd06a4303e6e6acb6ca9}{FuncCode}}\ ==\ 0x10))}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00554}00554\ \ \ \ \ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00555}00555\ \ \ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}}\ =\ modbus\_uart\_buff[ind++]\ <<\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00556}00556\ \ \ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_af99048a71119ba4c17772bd5544b3eef}{Addr}}\ |=\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00557}00557\ \ \ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}}\ =\ modbus\_uart\_buff[ind++]\ <<\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00558}00558\ \ \ \ \ \ \ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a1ccb2bf492218a6ae3a5b6ad5cd4c82f}{Qnt}}\ |=\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00559}00559\ \ \ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00560}00560\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00561}00561\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00562}00562\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00563}00563\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00564}00564\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/CRC-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00565}00565\ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/[last\ 2\ bytes]-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00566}00566\ \ \ uint16\_t\ CRC\_VALUE\ =\ crc16(modbus\_uart\_buff,\ ind);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00567}00567\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a423ab838d4c113fd6392452fd44dc1c0}{MbCRC}}\ =\ modbus\_uart\_buff[ind++];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00568}00568\ \ \ modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a423ab838d4c113fd6392452fd44dc1c0}{MbCRC}}\ |=\ modbus\_uart\_buff[ind++]\ <<\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00569}00569\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00570}00570\ \ \ \textcolor{keywordflow}{if}(modbus\_msg-\/>\mbox{\hyperlink{struct_r_s___msg_type_def_a423ab838d4c113fd6392452fd44dc1c0}{MbCRC}}\ !=\ CRC\_VALUE)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00571}00571\ \ \ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00572}00572\ \ \ \ \ \mbox{\hyperlink{group___r_s___d_e_b_u_g_ga49af29ab3927cad105c1d2b018a767e9}{TrackerCnt\_Err}}(hmodbus-\/>rs\_err);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00573}00573\ \ \ \ \ \textcolor{keywordflow}{return}\ RS\_PARSE\_MSG\_ERR;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00574}00574\ \ \ \}\ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00575}00575\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00576}00576\ \ \ \textcolor{keywordflow}{return}\ RS\_OK;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00577}00577\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00578}00578\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00579}00579\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00580}00580\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00581}00581\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00582}00582\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00583}00583\ \textcolor{comment}{/**\ @brief\ Сформировать\ запрос\ на\ чтение\ коилов\ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00584}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_gadb1b59bd6832b017b7ff4f5d694f59aa}{00584}}\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_gadb1b59bd6832b017b7ff4f5d694f59aa}{MB\_REQUEST\_READ\_COILS}}(uint8\_t\ slave\_addr,\ uint16\_t\ start\_addr,\ uint16\_t\ quantity)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00585}00585\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00586}00586\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a399bcd53bc32faca81bbc3d1ff8b5bb6}{FC\_R\_COILS}},\ \{0\},\ start\_addr,\ quantity,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00587}00587\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00588}00588\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00589}00589\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00590}00590\ \textcolor{comment}{/**\ @brief\ Сформировать\ запрос\ на\ чтение\ дискретных\ регистров\ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00591}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga85028c4de63ca63cb04e332a3fdcd676}{00591}}\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga85028c4de63ca63cb04e332a3fdcd676}{MB\_REQUEST\_READ\_DISCRETE\_INPUTS}}(uint8\_t\ slave\_addr,\ uint16\_t\ start\_addr,\ uint16\_t\ quantity)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00592}00592\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00593}00593\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a438c348676901d3e0263fd1f8d94bf11}{FC\_R\_DISC\_IN}},\ \{0\},\ start\_addr,\ quantity,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00594}00594\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00595}00595\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00596}00596\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00597}00597\ \textcolor{comment}{/**\ @brief\ Сформировать\ запрос\ на\ чтение\ холдинг\ регистров\ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00598}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga4a4798a15608f3aac04150115a628f8e}{00598}}\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga4a4798a15608f3aac04150115a628f8e}{MB\_REQUEST\_READ\_HOLDING\_REGS}}(uint8\_t\ slave\_addr,\ uint16\_t\ start\_addr,\ uint16\_t\ quantity)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00599}00599\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00600}00600\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2ae03921b16750ef290fdd7d19a08a29a2}{FC\_R\_HOLD\_REGS}},\ \{0\},\ start\_addr,\ quantity,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00601}00601\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00602}00602\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00603}00603\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00604}00604\ \textcolor{comment}{/**\ @brief\ Сформировать\ запрос\ на\ чтение\ инпут\ регистров\ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00605}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga72f91a70586546171fe9190a4e0e5518}{00605}}\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga72f91a70586546171fe9190a4e0e5518}{MB\_REQUEST\_READ\_INPUT\_REGS}}(uint8\_t\ slave\_addr,\ uint16\_t\ start\_addr,\ uint16\_t\ quantity)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00606}00606\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00607}00607\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a76139e9b7ae78856fd3a297c9f751944}{FC\_R\_IN\_REGS}},\ \{0\},\ start\_addr,\ quantity,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00608}00608\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00609}00609\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00610}00610\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00611}00611\ \textcolor{comment}{/**\ @brief\ Сформировать\ запрос\ на\ запись\ одного\ коила\ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00612}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga1ac5f38ac244039a63b2714044778ffc}{00612}}\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga1ac5f38ac244039a63b2714044778ffc}{MB\_REQUEST\_WRITE\_SINGLE\_COIL}}(uint8\_t\ slave\_addr,\ uint16\_t\ coil\_addr,\ uint8\_t\ value)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00613}00613\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00614}00614\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a832b94af2c427d0daae721da2528f44a}{FC\_W\_COIL}},\ \{0\},\ coil\_addr,\ (value\ ?\ 0xFF00\ :\ 0x0000),\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00615}00615\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00616}00616\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00617}00617\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00618}00618\ \textcolor{comment}{/**\ @brief\ Сформировать\ запрос\ на\ запись\ одного\ регистра\ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00619}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga0126cfaf44c73d84d521b16c0f6ab7b6}{00619}}\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga0126cfaf44c73d84d521b16c0f6ab7b6}{MB\_REQUEST\_WRITE\_SINGLE\_REG}}(uint8\_t\ slave\_addr,\ uint16\_t\ reg\_addr,\ uint16\_t\ value)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00620}00620\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00621}00621\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a1b66683f704ef9072329e997312e3b83}{FC\_W\_HOLD\_REG}},\ \{0\},\ reg\_addr,\ value,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00622}00622\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00623}00623\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00624}00624\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00625}00625\ \textcolor{comment}{/**\ @brief\ Сформировать\ запрос\ на\ запись\ нескольких\ регистров\ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00626}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga92c7c61bc6b3e249350d93d20b530fa3}{00626}}\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga92c7c61bc6b3e249350d93d20b530fa3}{MB\_REQUEST\_WRITE\_MULTIPLE\_COILS}}(uint8\_t\ slave\_addr,\ uint16\_t\ start\_addr,\ uint16\_t\ quantity,\ uint8\_t\ *coils\_data)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00627}00627\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00628}00628\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a43a1b810697ea15ef91008dbc0187127}{FC\_W\_COILS}},\ \{0\},\ start\_addr,\ quantity,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00629}00629\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00630}00630\ \ \ \textcolor{comment}{//\ Calculate\ byte\ count\ and\ prepare\ data}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00631}00631\ \ \ uint8\_t\ byte\_count\ =\ (quantity\ +\ 7)\ /\ 8;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00632}00632\ \ \ msg.\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ byte\_count;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00633}00633\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00634}00634\ \ \ \textcolor{comment}{//\ Copy\ coil\ data\ to\ message\ MbData\ array}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00635}00635\ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ byte\_count;\ i++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00636}00636\ \ \ \ \ \textcolor{keywordflow}{if}(i\ <\ \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__master_8c_source_l00637}00637\ \ \ \ \ \ \ msg.\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[i]\ =\ coils\_data[i];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00638}00638\ \ \ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00639}00639\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00640}00640\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00641}00641\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00642}00642\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00643}00643\ \textcolor{comment}{}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00644}00644\ \textcolor{comment}{/**\ @brief\ Сформировать\ запрос\ на\ запись\ нескольких\ коилов\ */}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00645}\mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga9b89a034f1c5ed96572621b2ebe7f6af}{00645}}\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ \mbox{\hyperlink{group___m_o_d_b_u_s___r_e_q_u_e_s_t___m_s_g_ga9b89a034f1c5ed96572621b2ebe7f6af}{MB\_REQUEST\_WRITE\_MULTIPLE\_REGS}}(uint8\_t\ slave\_addr,\ uint16\_t\ start\_addr,\ uint16\_t\ quantity,\ uint16\_t\ *regs\_data)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00646}00646\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00647}00647\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2affa24c54ee0b59e9810f1dbdc949e684}{FC\_W\_HOLD\_REGS}},\ \{0\},\ start\_addr,\ quantity,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00648}00648\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00649}00649\ \ \ msg.\mbox{\hyperlink{struct_r_s___msg_type_def_a5c69bf212dc5e7dc2eaa50971e27e2a6}{ByteCnt}}\ =\ quantity\ *\ 2;\ \textcolor{comment}{//\ Each\ register\ is\ 2\ bytes}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00650}00650\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00651}00651\ \ \ \textcolor{comment}{//\ Copy\ register\ data\ to\ message\ MbData\ array}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00652}00652\ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ quantity\ \&\&\ i\ <\ \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}};\ i++)\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00653}00653\ \ \ \ \ msg.\mbox{\hyperlink{struct_r_s___msg_type_def_aacbc6754621bd84742cd6c2ba65ad094}{MbData}}[i]\ =\ regs\_data[i];}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00654}00654\ \ \ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00655}00655\ \ \ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00656}00656\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00657}00657\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00658}00658\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00659}00659\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/ДИАГНОСТИЧЕСКИЕ\ ДАННЫЕ-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00660}00660\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(uint8\_t\ slave\_addr,\ uint16\_t\ sub\_function,\ uint16\_t\ data)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00661}00661\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00662}00662\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2aa6423de9e908dc38ce9f1c8027ad72ec}{FC\_R\_DIAGNOSTICS}},\ \{0\},\ 0,\ 0,\ 0,\ \{sub\_function,\ data\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00663}00663\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00664}00664\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00665}00665\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_QUERY\_DATA(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00666}00666\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00667}00667\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x0000,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00668}00668\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00669}00669\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00670}00670\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RESTART\_COMMUNICATIONS(uint8\_t\ slave\_addr,\ uint16\_t\ data)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00671}00671\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00672}00672\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x0001,\ data);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00673}00673\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00674}00674\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00675}00675\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_DIAGNOSTIC\_REGISTER(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00676}00676\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00677}00677\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x0002,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00678}00678\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00679}00679\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00680}00680\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_FORCE\_LISTEN\_ONLY\_MODE(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00681}00681\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00682}00682\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x0004,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00683}00683\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00684}00684\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00685}00685\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_CLEAR\_COUNTERS\_AND\_DIAGNOSTIC\_REGISTER(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00686}00686\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00687}00687\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x000A,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00688}00688\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00689}00689\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00690}00690\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_BUS\_MESSAGE\_COUNT(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00691}00691\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00692}00692\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x000B,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00693}00693\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00694}00694\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00695}00695\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_BUS\_COMMUNICATION\_ERROR\_COUNT(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00696}00696\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00697}00697\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x000C,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00698}00698\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00699}00699\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00700}00700\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_SLAVE\_EXCEPTION\_ERROR\_COUNT(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00701}00701\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00702}00702\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x000D,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00703}00703\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00704}00704\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00705}00705\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_SLAVE\_MESSAGE\_COUNT(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00706}00706\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00707}00707\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x000E,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00708}00708\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00709}00709\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00710}00710\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_SLAVE\_NO\_RESPONSE\_COUNT(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00711}00711\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00712}00712\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x000F,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00713}00713\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00714}00714\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00715}00715\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_SLAVE\_NAK\_COUNT(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00716}00716\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00717}00717\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x0010,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00718}00718\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00719}00719\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00720}00720\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_SLAVE\_BUSY\_COUNT(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00721}00721\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00722}00722\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x0011,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00723}00723\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00724}00724\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00725}00725\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_RETURN\_BUS\_CHARACTER\_OVERRUN\_COUNT(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00726}00726\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00727}00727\ \ \ \textcolor{keywordflow}{return}\ MB\_REQUEST\_DIAGNOSTIC\_QUERY(slave\_addr,\ 0x0012,\ 0x0000);}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00728}00728\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00729}00729\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00730}00730\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/ИДЕНТИФИКАТОРЫ\ МОДБАС-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00731}00731\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_READ\_DEVICE\_ID\_BASIC(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00732}00732\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00733}00733\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}},\ \{0x0E,\ 0x01,\ 0x00,\ 0,\ 0,\ 0\},\ 0,\ 0,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00734}00734\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00735}00735\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00736}00736\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00737}00737\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_READ\_DEVICE\_ID\_REGULAR(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00738}00738\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00739}00739\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}},\ \{0x0E,\ 0x02,\ 0x00,\ 0,\ 0,\ 0\},\ 0,\ 0,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00740}00740\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00741}00741\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00742}00742\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00743}00743\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_READ\_DEVICE\_ID\_EXTENDED(uint8\_t\ slave\_addr)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00744}00744\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00745}00745\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}},\ \{0x0E,\ 0x03,\ 0x00,\ 0,\ 0,\ 0\},\ 0,\ 0,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00746}00746\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00747}00747\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00748}00748\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00749}00749\ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ MB\_REQUEST\_READ\_DEVICE\_ID\_SPECIFIC(uint8\_t\ slave\_addr,\ uint8\_t\ object\_id)}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00750}00750\ \{}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00751}00751\ \ \ \mbox{\hyperlink{struct_r_s___msg_type_def}{RS\_MsgTypeDef}}\ msg\ =\ \{slave\_addr,\ \mbox{\hyperlink{group___m_o_d_b_u_s___m_e_s_s_a_g_e___d_e_f_i_n_e_s_gga38d42495bf262b70048e6d6a7af175d2a37ddf147e08b6d205319c31e6750d47c}{FC\_R\_DEVICE\_ID}},\ \{0x0E,\ 0x04,\ object\_id,\ 0,\ 0,\ 0\},\ 0,\ 0,\ 0,\ \{0\},\ 0,\ 0\};}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00752}00752\ \ \ \textcolor{keywordflow}{return}\ msg;}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00753}00753\ \}}
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00754}00754\ }
|
||
\DoxyCodeLine{\Hypertarget{modbus__master_8c_source_l00755}00755\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//MODBUS\_ENABLE\_MASTER}}
|
||
|
||
\end{DoxyCode}
|