Compare commits
3 commits
17e45127e1
...
27cbc844de
Author | SHA1 | Date | |
---|---|---|---|
27cbc844de | |||
05d734c903 | |||
b86754cb92 |
5 changed files with 20 additions and 7 deletions
|
@ -23,7 +23,7 @@ if test "x$GUILD" = "x"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Hall auto-generated guile-module dependencies
|
dnl Hall auto-generated guile-module dependencies
|
||||||
|
GUILE_MODULE_REQUIRED([termios])
|
||||||
|
|
||||||
dnl Installation directories for .scm and .go files.
|
dnl Installation directories for .scm and .go files.
|
||||||
guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
|
guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(use-modules ((inkplate lowlevel) #:prefix inkplate:)
|
(use-modules ((inkplate) #:prefix inkplate:)
|
||||||
(srfi srfi-19))
|
(srfi srfi-19))
|
||||||
|
|
||||||
(let ((my-dev (inkplate:open "/dev/ttyUSB0")))
|
(let ((my-dev (inkplate:open "/dev/ttyUSB0")))
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
(inkplate:draw-rectangle my-dev 269 89 252 157 3)
|
(inkplate:draw-rectangle my-dev 269 89 252 157 3)
|
||||||
(inkplate:draw-rectangle my-dev 268 88 254 159 3)
|
(inkplate:draw-rectangle my-dev 268 88 254 159 3)
|
||||||
|
|
||||||
(inkplate:update my-dev)
|
(inkplate:partial-update my-dev 15 800 600)
|
||||||
(inkplate:send my-dev)
|
(inkplate:send my-dev)
|
||||||
|
|
||||||
(inkplate:close my-dev))
|
(inkplate:close my-dev))
|
||||||
|
|
3
guix.scm
3
guix.scm
|
@ -23,7 +23,8 @@
|
||||||
("pkg-config" ,pkg-config)
|
("pkg-config" ,pkg-config)
|
||||||
("texinfo" ,texinfo)))
|
("texinfo" ,texinfo)))
|
||||||
(inputs `(("guile" ,guile-3.0)))
|
(inputs `(("guile" ,guile-3.0)))
|
||||||
(propagated-inputs `())
|
(propagated-inputs
|
||||||
|
`(("guile-termios" ,guile-termios)))
|
||||||
(synopsis "")
|
(synopsis "")
|
||||||
(description "")
|
(description "")
|
||||||
(home-page "")
|
(home-page "")
|
||||||
|
|
2
hall.scm
2
hall.scm
|
@ -8,7 +8,7 @@
|
||||||
(description "")
|
(description "")
|
||||||
(home-page "")
|
(home-page "")
|
||||||
(license gpl3+)
|
(license gpl3+)
|
||||||
(dependencies `())
|
(dependencies `(("guile-termios" (termios) ,guile-termios)))
|
||||||
(skip ())
|
(skip ())
|
||||||
(files (libraries ((scheme-file "inkplate")))
|
(files (libraries ((scheme-file "inkplate")))
|
||||||
(tests ((directory "tests" ((scheme-file "inkplate")))))
|
(tests ((directory "tests" ((scheme-file "inkplate")))))
|
||||||
|
|
14
inkplate.scm
14
inkplate.scm
|
@ -1,6 +1,13 @@
|
||||||
(define-module (inkplate)
|
(define-module (inkplate)
|
||||||
#:use-module ((ice-9 format) #:select (format))
|
#:use-module ((ice-9 format) #:select (format))
|
||||||
#:use-module ((srfi srfi-9) #:select (define-record-type))
|
#:use-module ((srfi srfi-9) #:select (define-record-type))
|
||||||
|
#:use-module ((termios system) #:select (termios-B115200))
|
||||||
|
#:use-module ((termios with-exceptions)
|
||||||
|
#:select (make-termios-struct
|
||||||
|
tc-get-attr!
|
||||||
|
tc-set-attr
|
||||||
|
cf-make-raw!
|
||||||
|
cf-set-speed!))
|
||||||
|
|
||||||
#:export (<inkplate>
|
#:export (<inkplate>
|
||||||
make-inkplate
|
make-inkplate
|
||||||
|
@ -62,7 +69,12 @@
|
||||||
|
|
||||||
(define (open device-path)
|
(define (open device-path)
|
||||||
"Open a connection to an Inkplate on the named DEVICE-PATH."
|
"Open a connection to an Inkplate on the named DEVICE-PATH."
|
||||||
(let ((port (open-file device-path "r+")))
|
(let ((port (open-file device-path "r+"))
|
||||||
|
(termios (make-termios-struct)))
|
||||||
|
(tc-get-attr! port termios)
|
||||||
|
(cf-make-raw! termios)
|
||||||
|
(cf-set-speed! termios termios-B115200)
|
||||||
|
(tc-set-attr port termios)
|
||||||
(make-inkplate port port)))
|
(make-inkplate port port)))
|
||||||
|
|
||||||
(define (close device)
|
(define (close device)
|
||||||
|
|
Loading…
Reference in a new issue