slowtec / tokio-modbus

A tokio-based modbus library
Apache License 2.0
379 stars 117 forks source link

How to turn 'tokio_serial::SerialStream' into global static to save it for reuse #224

Open xiaguangbo opened 9 months ago

xiaguangbo commented 9 months ago

image

main

I want to pass the obtained 'SerialStream' to 'PORT' in 'match 0', and then pass 'PORT' to 'attach_slave()' in 'match 1'. This way you don’t have to reopen the serial port every time you read.

other

What should I write in 'tauri::async_runtime::Mutex::new()'?