File: SerialComm.m

package info (click to toggle)
psychtoolbox-3 3.0.14.20170103%2Bgit6-g605ff5c.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,044 kB
  • ctags: 69,483
  • sloc: ansic: 167,371; cpp: 11,232; objc: 4,708; sh: 1,875; python: 383; php: 344; makefile: 207; java: 113
file content (49 lines) | stat: -rwxr-xr-x 2,184 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function y = SerialComm(op, port, data)
% SerialComm -- Serial port interface for OSX
%
% CAUTION: SerialComm() is deprecated! Not supported on Linux, Windows or
% 64-Bit versions of Psychtoolbox for OSX, totally unsupported by us. Use
% IOPort() instead as a future-proof, much more capable cross-platform
% solution.
%
%  SerialComm( 'open', PORT, CONFIG ) opens comm port number PORT for reading and
%    writing. The CONFIG string specifies the basic serial port (baud rate, 
%    parity, #data bits, #stop bits) in standard DOS format. CONFIG defaults 
%    to '19200,n,8,1'.
%
%  STR = SerialComm( 'readl', PORT, EOL ) reads one line of ASCII text from PORT
%    and returns the line in the string array STR. If a complete line is 
%    not available, STR is empty. If supplied, EOL defines the End-of-Line 
%    character which remains in effect until changed. On open, the EOL 
%    character is the ASCII line-feed (0xA). Non-blocking.
%   
%  DATA = SerialComm( 'read', PORT, N ) reads upto N bytes from PORT and returns 
%    the uint8 array in DATA. If no data is available, DATA is empty. If N is
%    not specified, all available bytes are returned. Non-blocking.
%
%  PORT = SerialComm( 'name2number', PORTNAME) converts a port in string
%    form, eg. /dev/cu.KeySerial1, to an actual port number for use in the
%    other functinos.
%   
%  SerialComm( 'write', PORT, DATA ) writes contents of the matrix DATA to PORT. 
%    The matrix DATA can be of class "double" or "char".
%   
%  SerialComm( 'purge', PORT ) purges read and write buffers for the PORT.
%	
%  SerialComm( 'hshake', PORT, HSHAKE ) set hardware 'h' and/or software 's' hand-
%    shaking. 'n' sets handshaking to none.
%	
%  SerialComm( 'break', PORT ) sends a break.
%	
%  SerialComm( 'close', PORT ) closes the PORT. 
%
%  SerialComm( 'status', PORT ) prints some status info.
%
% Author: Tom Davis (tomldavis@comcast.net)
% Date: October, 2006
% 
% SerialComm was generously donated to the Psychtoolbox by Tom Davis.  You
% can find more of his Matlab creations at
% http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectType=author&objectId=1093697

AssertMex('SerialComm.m');