Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CleanSerial
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mart Lubbers
CleanSerial
Commits
ad5a279b
Commit
ad5a279b
authored
Feb 20, 2017
by
Mart Lubbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add devicepath to TTYSettings
parent
2d370b44
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
9 deletions
+11
-9
TTY.dcl
TTY.dcl
+2
-1
TTY.icl
TTY.icl
+4
-3
iTasksTTY.dcl
iTasksTTY.dcl
+1
-1
iTasksTTY.icl
iTasksTTY.icl
+3
-3
test.icl
test.icl
+1
-1
No files found.
TTY.dcl
View file @
ad5a279b
...
...
@@ -11,6 +11,7 @@ from StdClass import class zero
B115200
|
B230400
::
TTYSettings
=
{
devicePath
::
String
,
baudrate
::
BaudRate
,
bytesize
::
ByteSize
,
parity
::
Parity
,
...
...
@@ -22,7 +23,7 @@ instance zero TTYSettings
TTYclose
::
!*
TTY
!*
env
->
(!
Bool
,
!*
env
)
TTYerror
::
!*
env
->
(!
String
,
!*
env
)
TTYopen
::
!
String
!
TTYSettings
!*
env
->
(!
Bool
,!*
TTY
,!*
env
)
TTYopen
::
!
TTYSettings
!*
env
->
(!
Bool
,!*
TTY
,!*
env
)
TTYread
::
!*
TTY
->
(!
Int
,
!*
TTY
)
TTYreadline
::
!*
TTY
->
(!
String
,
!*
TTY
)
TTYavailable
::
!*
TTY
->
(!
Bool
,
!*
TTY
)
...
...
TTY.icl
View file @
ad5a279b
...
...
@@ -11,6 +11,7 @@ import code from "ctty."
instance
zero
TTYSettings
where
zero
=
{
TTYSettings
|
devicePath
=
"/dev/ttyACM0"
,
baudrate
=
B9600
,
bytesize
=
BytesizeEight
,
parity
=
ParityNone
,
...
...
@@ -33,9 +34,9 @@ instance toInt Parity where
ParityNone
=
0
;
ParityOdd
=
1
;
ParityEven
=
2
;
ParitySpace
=
3
;
ParityMark
=
4
TTYopen
::
!
String
!
TTYSettings
!*
env
->
(!
Bool
,
!*
TTY
,
!*
env
)
TTYopen
fn
ts
w
=
TTYopen2
fn
TTYopen
::
!
TTYSettings
!*
env
->
(!
Bool
,
!*
TTY
,
!*
env
)
TTYopen
ts
w
=
TTYopen2
ts
.
devicePath
(
toInt
ts
.
baudrate
)
(
toInt
ts
.
bytesize
)
(
toInt
ts
.
parity
)
...
...
iTasksTTY.dcl
View file @
ad5a279b
...
...
@@ -7,4 +7,4 @@ derive class iTask TTYSettings
getTTYDevices
::
!*
env
->
*(![
String
],
!*
env
)
syncSerialChannel
::
String
TTYSettings
(
b
->
String
)
(
String
->
a
)
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
syncSerialChannel
::
TTYSettings
(
b
->
String
)
(
String
->
a
)
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
iTasksTTY.icl
View file @
ad5a279b
...
...
@@ -31,11 +31,11 @@ getTTYDevices w = case readDirectory "/dev" w of
isTTY
s
=
not
(
isEmpty
(
filter
(
flip
startsWith
s
)
prefixes
))
prefixes
=
[
"ttyS"
,
"ttyACM"
,
"ttyUSB"
,
"tty.usbserial"
]
syncSerialChannel
::
String
TTYSettings
(
b
->
String
)
(
String
->
a
)
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
syncSerialChannel
dev
opts
enc
dec
rw
=
Task
eval
syncSerialChannel
::
TTYSettings
(
b
->
String
)
(
String
->
a
)
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
syncSerialChannel
opts
enc
dec
rw
=
Task
eval
where
eval
event
evalOpts
tree
=:(
TCInit
taskId
ts
)
iworld
=:{
IWorld
|
world
}
=
case
TTYopen
dev
opts
world
of
=
case
TTYopen
opts
world
of
(
False
,
_,
world
)
#
(
err
,
world
)
=
TTYerror
world
=
(
ExceptionResult
(
exception
err
),
{
iworld
&
world
=
world
})
...
...
test.icl
View file @
ad5a279b
...
...
@@ -14,7 +14,7 @@ TTYerrorclose f w
Start
::
*
World
->
*
World
Start
w
#
(
io
,
w
)
=
stdio
w
#
(
ok
,
tty
,
w
)
=
TTYopen
"/dev/ttyUSB0"
zero
w
#
(
ok
,
tty
,
w
)
=
TTYopen
{
zero
&
devicePath
=
"/dev/ttyUSB0"
}
w
|
not
ok
=
TTYerrorclose
io
w
#!
tty
=
TTYwrite
"echo123
\n
"
tty
#!
(
av
,
tty
)
=
TTYavailable
tty
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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