forked from espressif/esp-modbus
feat(uart): update uart driver for esp32s2beta
* Original commit: espressif/esp-idf@4cc962353c
This commit is contained in:
@@ -22,10 +22,10 @@
|
||||
#define MB_CONTROLLER_PRIORITY (CONFIG_FMB_SERIAL_TASK_PRIO - 1) // priority of MB controller task
|
||||
|
||||
// Default port defines
|
||||
#define MB_DEVICE_ADDRESS (1) // Default slave device address in Modbus
|
||||
#define MB_DEVICE_SPEED (115200) // Default Modbus speed for now hard defined
|
||||
#define MB_UART_PORT (UART_NUM_2) // Default UART port number
|
||||
#define MB_PAR_INFO_TOUT (10) // Timeout for get parameter info
|
||||
#define MB_DEVICE_ADDRESS (1) // Default slave device address in Modbus
|
||||
#define MB_DEVICE_SPEED (115200) // Default Modbus speed for now hard defined
|
||||
#define MB_UART_PORT (UART_NUM_MAX - 1) // Default UART port number
|
||||
#define MB_PAR_INFO_TOUT (10) // Timeout for get parameter info
|
||||
#define MB_PARITY_NONE (UART_PARITY_DISABLE)
|
||||
|
||||
// The Macros below handle the endianness while transfer N byte data into buffer
|
||||
|
@@ -78,7 +78,7 @@ static TaskHandle_t xMbTaskHandle;
|
||||
static const CHAR *TAG = "MB_SERIAL";
|
||||
|
||||
// The UART hardware port number
|
||||
static UCHAR ucUartNumber = UART_NUM_2;
|
||||
static UCHAR ucUartNumber = UART_NUM_MAX - 1;
|
||||
|
||||
static BOOL bRxStateEnabled = FALSE; // Receiver enabled flag
|
||||
static BOOL bTxStateEnabled = FALSE; // Transmitter enabled flag
|
||||
|
@@ -73,7 +73,7 @@ static QueueHandle_t xMbUartQueue;
|
||||
static TaskHandle_t xMbTaskHandle;
|
||||
|
||||
// The UART hardware port number
|
||||
static UCHAR ucUartNumber = UART_NUM_2;
|
||||
static UCHAR ucUartNumber = UART_NUM_MAX - 1;
|
||||
|
||||
static BOOL bRxStateEnabled = FALSE; // Receiver enabled flag
|
||||
static BOOL bTxStateEnabled = FALSE; // Transmitter enabled flag
|
||||
|
@@ -83,7 +83,7 @@ static esp_err_t mbc_serial_master_setup(void* comm_info)
|
||||
MB_MASTER_CHECK(((comm_info_ptr->mode == MB_MODE_RTU) || (comm_info_ptr->mode == MB_MODE_ASCII)),
|
||||
ESP_ERR_INVALID_ARG, "mb incorrect mode = (0x%x).",
|
||||
(uint32_t)comm_info_ptr->mode);
|
||||
MB_MASTER_CHECK((comm_info_ptr->port <= UART_NUM_2), ESP_ERR_INVALID_ARG,
|
||||
MB_MASTER_CHECK((comm_info_ptr->port < UART_NUM_MAX), ESP_ERR_INVALID_ARG,
|
||||
"mb wrong port to set = (0x%x).", (uint32_t)comm_info_ptr->port);
|
||||
MB_MASTER_CHECK((comm_info_ptr->parity <= UART_PARITY_EVEN), ESP_ERR_INVALID_ARG,
|
||||
"mb wrong parity option = (0x%x).", (uint32_t)comm_info_ptr->parity);
|
||||
|
@@ -69,7 +69,7 @@ static esp_err_t mbc_serial_slave_setup(void* comm_info)
|
||||
MB_SLAVE_CHECK((comm_settings->slave_addr <= MB_ADDRESS_MAX),
|
||||
ESP_ERR_INVALID_ARG, "mb wrong slave address = (0x%x).",
|
||||
(uint32_t)comm_settings->slave_addr);
|
||||
MB_SLAVE_CHECK((comm_settings->port <= UART_NUM_2), ESP_ERR_INVALID_ARG,
|
||||
MB_SLAVE_CHECK((comm_settings->port < UART_NUM_MAX), ESP_ERR_INVALID_ARG,
|
||||
"mb wrong port to set = (0x%x).", (uint32_t)comm_settings->port);
|
||||
MB_SLAVE_CHECK((comm_settings->parity <= UART_PARITY_EVEN), ESP_ERR_INVALID_ARG,
|
||||
"mb wrong parity option = (0x%x).", (uint32_t)comm_settings->parity);
|
||||
|
Reference in New Issue
Block a user