Files
luban-lite-t3e-pro/packages/third-party/awtk-ui/awtk/tests/fscripts/demo_serial.fs
刘可亮 3b4064f334 v1.0.2
2023-11-30 19:48:02 +08:00

19 lines
394 B
GLSL

//
// start serial echo server first
// ./bin/serial_recv 4000
//
var a = iostream_serial_create("/dev/ttys001", 0)
var b = iostream_get_ostream(a)
var c = iostream_get_istream(a)
assert(ostream_write_uint32(b, 6) == 4)
assert(ostream_write_string(b, "hello\n") == 6)
assert(istream_read_uint32(c, 3000) == 6)
assert(istream_read_string(c, 6, 3000) == "hello\n")
unset(c)
unset(b)
unset(a)