Hey, please see alpha release of Serial I/O package.
I am looking for any comments on code style, usability, naming etc. Also, it would be great if people could reply on which platforms they successfully (and not, which is more important) tested it. Sorry but Windows is not yet supported. Currently open flags are hardcoded to: O_RDWR | O_NOCTTY | O_SYNC, as I yet to decide what is the best way to maintain cross-platformability and ease of use (e.g. using string for parity setting and then doing switch according to platform being used instead of making the same flags from different platforms global to Octave), comments are welcome. Also, a simple example to get started (for testing adapter's RX and TX lines are connected together): s0 = serial() # Opens default serial port ttyUSB0 in default configuration of 115200, 8-N-1 s1 = serial("/dev/ttyUSB1", 115200) # Opens serial port ttyUSB1 with baudrate of 115200 (config defaults to 8-N-1) srl_flush(s1); # Flush input and output buffers srl_write(s1, "Hello world!") # Blocking write call, currently only accepts strings data = srl_read(s1, 11) # Blocking read call, returns uint8 array of exactly 11 bytes read (data = [72 101 108 108 111 32 119 111 114 108 100]) char(data) # Converts uint8 array to string, (ans = "Hello world", note: no exclamation mark) srl_baudrate(s1, 9600) # Change baudrate srl_bytesize(s1, 5) # Change byte size (config becomes 5-N-1) srl_parity(s1, "E") # Changes parity checking (config becomes 5-E-1), possible values [E]ven, [O]dd, [N]one. srl_stopbits(s1, 2) # Changes stop bits (config becomes 5-E-2), possible values 1, 2. s2 = serial("/dev/ttyS0", 9600, 6, "odd", 2) # Opens serial port ttyS0 in 9600, 6-O-2 configuration srl_close(s0) # Closes and releases file descriptor
serial-0.1.tar.gz
Description: GNU Zip compressed data
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev