]> gitweb.factorcode.org Git - factor.git/blob - extra/io/serial/unix/unix-tests.factor
Use flags{ instead of flags all over the place
[factor.git] / extra / io / serial / unix / unix-tests.factor
1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel math.bitwise io.serial io.serial.unix
4 literals ;
5 IN: io.serial.unix
6
7 : serial-obj ( -- obj )
8     serial new
9     "/dev/ttyS0" >>path ! linux
10     ! "/dev/dty00" >>path ! netbsd
11     ! "/dev/ttyd0" >>path ! freebsd
12     ! "/dev/ttyU0" >>path ! openbsd
13     19200 >>baud
14     flags{ IGNPAR ICRNL } >>iflag
15     flags{ } >>oflag
16     flags{ CS8 CLOCAL CREAD } >>cflag
17     flags{ ICANON } >>lflag ;
18
19 : serial-test ( -- serial )
20     serial-obj
21     open-serial
22     dup get-termios >>termios
23     dup configure-termios
24     dup tciflush
25     dup apply-termios ;