Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mart Lubbers
CleanSerial
Commits
1b85b495
Commit
1b85b495
authored
Mar 21, 2017
by
Mart Lubbers
Browse files
update remove debug
parent
1b51061d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
1b85b495
...
...
@@ -12,9 +12,9 @@ endif
Clean\ System\ Files/ctty.o
:
tty.c
mkdir
-p
Clean
\
System
\
Files
ifeq
"$(GCCVERSIONGTEQ6)" "1"
gcc-5
-DDEBUG
-c
$<
-o
"
$@
"
gcc-5
-c
$<
-o
"
$@
"
else
gcc
-DDEBUG
-c
$<
-o
"
$@
"
gcc
-c
$<
-o
"
$@
"
endif
clean
:
...
...
iTasksTTY.icl
View file @
1b85b495
...
...
@@ -32,17 +32,23 @@ getTTYDevices w = case readDirectory "/dev" w of
(
Ok
entries
,
w
)
=
(
map
((+++)
"/dev/"
)
(
filter
isTTY
entries
),
w
)
where
isTTY
s
=
not
(
isEmpty
(
filter
(
flip
startsWith
s
)
prefixes
))
prefixes
=
[
"ttyS"
,
"ttyACM"
,
"ttyUSB"
,
"tty.usbserial"
]
prefixes
=
[
"ttyS"
,
"ttyACM"
,
"ttyUSB"
,
"tty.usbserial"
,
"rfcomm"
]
enterTTYSettings
::
Task
TTYSettings
enterTTYSettings
=
accWorld
getTTYDevices
>>=
\
ds
->(((((
enterChoice
"Device"
[]
ds
-&&-
updateInformation
"Baudrate"
[]
B9600
)
-&&-
updateInformation
"Bytesize"
[]
BytesizeEight
)
-&&-
updateInformation
"Parity"
[]
ParityNone
)
-&&-
updateInformation
"Stop2bits"
[]
False
)
-&&-
updateInformation
"Xonoff"
[]
False
)
@
(
uncurry
o
uncurry
o
uncurry
o
uncurry
o
uncurry
)
makeTTYSettings
>>=
\
ds
->(
enterChoice
"Device"
[]
ds
-&&-
updateInformation
"Baudrate"
[]
B9600
<<@
ArrangeHorizontal
)
-&&-
(
updateInformation
"Bytesize"
[]
BytesizeEight
-&&-
updateInformation
"Parity"
[]
ParityNone
<<@
ArrangeHorizontal
)
-&&-
(
updateInformation
"Stop2bits"
[]
False
-&&-
updateInformation
"Xonoff"
[]
False
<<@
ArrangeHorizontal
)
@
\((
dev
,
br
),
((
bs
,
pr
),
(
st
,
xo
)))->
makeTTYSettings
dev
br
bs
pr
st
xo
syncSerialChannel
::
TTYSettings
(
b
->
String
)
(
String
->
a
)
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
syncSerialChannel
opts
enc
dec
rw
=
Task
eval
...
...
@@ -80,16 +86,10 @@ serialDeviceBackgroundTask enc dec rw iworld
(
Ok
(
r
,
s
,
ss
),
iworld
)
#
(
Just
(
TTYd
tty
bgid
))
=
iworld
.
resources
#
tty
=
writet
(
map
enc
s
)
tty
#
tty
=
foldr
TTYwrite
tty
$
map
enc
s
#
(
ml
,
tty
)
=
case
TTYavailable
tty
of
(
False
,
tty
)
=
([],
tty
)
(_,
tty
)
=
appFst
(
pure
o
dec
)
$
TTYreadline
tty
#
iworld
=
{
iworld
&
resources
=
Just
(
TTYd
tty
bgid
)}
|
isEmpty
ml
&&
isEmpty
s
=
(
Ok
(),
iworld
)
=
case
write
(
r
++
ml
,[],
False
)
rw
iworld
of
(
Error
e
,
iworld
)
=
(
Error
$
exception
"share couldn't be written"
,
iworld
)
(
Ok
_,
iworld
)
=
(
Ok
(),
iworld
)
where
writet
::
[
String
]
->
(*
TTY
->
*
TTY
)
writet
[]
=
id
writet
[
x
:
xs
]
=
writet
xs
o
TTYwrite
x
=
write
(
r
++
ml
,[],
False
)
rw
iworld
tty.c
View file @
1b85b495
...
...
@@ -182,7 +182,6 @@ void ttyread(int fd, int *ch, int *fdo)
if
(
read
(
fd
,
&
c
,
1
)
==
-
1
){
die
(
"read"
);
}
printf
(
"read: %o
\n
"
,
c
);
*
ch
=
(
int
)
c
;
*
fdo
=
fd
;
debug
(
"ttyread done"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment