Работает Modbus, проверено на ESP32-S3-Zero
Заготовка для модбас на ИВР
This commit is contained in:
21
rs_message.h
21
rs_message.h
@@ -14,9 +14,6 @@
|
||||
- Подключить этот файл в раздел rs_message.h.
|
||||
- Определить функции для обработки сообщения: RS_Parse_Message(),
|
||||
RS_Collect_Message(), RS_Response(), RS_Define_Size_of_RX_Message()
|
||||
- Добавить UART/TIM Handler в Хендлер используемых UART/TIM.
|
||||
|
||||
Так же данный модуль использует счетчики
|
||||
**************************************************************************
|
||||
@verbatim
|
||||
Визуальное описание. Форматирование сохраняется как в коде.
|
||||
@@ -164,6 +161,7 @@ typedef struct // RS_HandleTypeDef
|
||||
|
||||
/* RS STATUS */
|
||||
unsigned long lastByteTime;
|
||||
unsigned long baudRate;
|
||||
RS_StatusTypeDef RS_STATUS; ///< RS status
|
||||
}RS_HandleTypeDef;
|
||||
extern RS_HandleTypeDef hmodbus1;
|
||||
@@ -200,11 +198,18 @@ RS_StatusTypeDef RS_Handle_Transmit_Start(RS_HandleTypeDef *hRS, RS_MsgTypeDef *
|
||||
///////////////////////////---FUNCTIONS---///////////////////////////
|
||||
|
||||
|
||||
#ifndef printf_rs_err
|
||||
#define printf_rs_err(...)
|
||||
#if RS_DEBUG
|
||||
#define RS_DEBUG_PRINT(msg) Serial.println(msg)
|
||||
#define RS_DEBUG_PRINT_HEX(val) Serial.println(val, HEX)
|
||||
#define RS_DEBUG_PRINT_DEC(val) Serial.println(val, DEC)
|
||||
#define RS_DEBUG_PRINT2_HEX(msg,val) do { Serial.print(msg); Serial.println(val, HEX); } while(0)
|
||||
#define RS_DEBUG_PRINT2_DEC(msg,val) do { Serial.print(msg); Serial.println(val, DEC); } while(0)
|
||||
#else
|
||||
#define RS_DEBUG_PRINT(msg) ((void)0)
|
||||
#define RS_DEBUG_PRINT_HEX(val) ((void)0)
|
||||
#define RS_DEBUG_PRINT_DEC(val) ((void)0)
|
||||
#define RS_DEBUG_PRINT2_HEX(msg,val) ((void)0)
|
||||
#define RS_DEBUG_PRINT2_DEC(msg,val) ((void)0)
|
||||
#endif
|
||||
|
||||
#ifndef printf_rs
|
||||
#define printf_rs(...)
|
||||
#endif
|
||||
#endif // __RS_LIB_H_
|
||||
|
||||
Reference in New Issue
Block a user