diff options
Diffstat (limited to 'inkplate-display')
-rwxr-xr-x | inkplate-display | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/inkplate-display b/inkplate-display new file mode 100755 index 0000000..0186198 --- /dev/null +++ b/inkplate-display @@ -0,0 +1,116 @@ +#!/usr/bin/env guile +;; -*- mode: scheme; -*- +!# +;; Copyright (C) 2023 Tom Willemse + +;; This program is free software: you can redistribute it and/or modify it under +;; the terms of the GNU General Public License as published by the Free Software +;; Foundation, either version 3 of the License, or (at your option) any later +;; version. + +;; This program is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +;; details. + +;; You should have received a copy of the GNU General Public License along with +;; this program. If not, see <https://www.gnu.org/licenses/>. + +(use-modules ((inkplate) #:prefix inkplate:) + (srfi srfi-19)) + +(let* ((my-dev (inkplate:open "/dev/ttyUSB0")) + (date (current-date)) + (day-of-week (date-week-day date))) + (inkplate:clear-screen my-dev) + (inkplate:set-display-mode my-dev 1) + + (inkplate:draw-rectangle my-dev 5 5 250 590 3) + (inkplate:draw-rectangle my-dev 6 6 248 588 3) + (inkplate:draw-rectangle my-dev 7 7 246 586 3) + + (inkplate:set-cursor my-dev 15 15) + (inkplate:set-text-size my-dev 10) + (inkplate:print my-dev (inkplate:convert-string-to-hex (date->string date "~Y"))) + + (inkplate:set-cursor my-dev 15 95) + (inkplate:set-text-size my-dev 8) + (inkplate:print my-dev (inkplate:convert-string-to-hex (date->string date "~m-~d"))) + + (let ((x 20) + (y 160)) + (inkplate:set-cursor my-dev x y) + (when (= 1 day-of-week) + (inkplate:draw-rectangle my-dev (- x 6) (- y 3) 32 34 1) + (inkplate:draw-rectangle my-dev (- x 5) (- y 2) 30 32 1)) + (inkplate:set-text-size my-dev 4) + (inkplate:print my-dev (inkplate:convert-string-to-hex "M"))) + + (let ((x 53) + (y 160)) + (inkplate:set-cursor my-dev x y) + (when (= 2 day-of-week) + (inkplate:draw-rectangle my-dev (- x 6) (- y 3) 32 34 1) + (inkplate:draw-rectangle my-dev (- x 5) (- y 2) 30 32 1)) + (inkplate:set-text-size my-dev 4) + (inkplate:print my-dev (inkplate:convert-string-to-hex "T"))) + + (let ((x 86) + (y 160)) + (inkplate:set-cursor my-dev x y) + (when (= 3 day-of-week) + (inkplate:draw-rectangle my-dev (- x 6) (- y 3) 32 34 1) + (inkplate:draw-rectangle my-dev (- x 5) (- y 2) 30 32 1)) + (inkplate:set-text-size my-dev 4) + (inkplate:print my-dev (inkplate:convert-string-to-hex "W"))) + + (let ((x 119) + (y 160)) + (inkplate:set-cursor my-dev x y) + (when (= 4 day-of-week) + (inkplate:draw-rectangle my-dev (- x 6) (- y 3) 32 34 1) + (inkplate:draw-rectangle my-dev (- x 5) (- y 2) 30 32 1)) + (inkplate:set-text-size my-dev 4) + (inkplate:print my-dev (inkplate:convert-string-to-hex "T"))) + + (let ((x 152) + (y 160)) + (inkplate:set-cursor my-dev x y) + (when (= 5 day-of-week) + (inkplate:draw-rectangle my-dev (- x 6) (- y 3) 32 34 1) + (inkplate:draw-rectangle my-dev (- x 5) (- y 2) 30 32 1)) + (inkplate:set-text-size my-dev 4) + (inkplate:print my-dev (inkplate:convert-string-to-hex "F"))) + + (let ((x 185) + (y 160)) + (inkplate:set-cursor my-dev x y) + (when (= 6 day-of-week) + (inkplate:draw-rectangle my-dev (- x 6) (- y 3) 32 34 1) + (inkplate:draw-rectangle my-dev (- x 5) (- y 2) 30 32 1)) + (inkplate:set-text-size my-dev 4) + (inkplate:print my-dev (inkplate:convert-string-to-hex "S"))) + + (let ((x 218) + (y 160)) + (inkplate:set-cursor my-dev x y) + (when (= 0 day-of-week) + (inkplate:draw-rectangle my-dev (- x 6) (- y 3) 32 34 1) + (inkplate:draw-rectangle my-dev (- x 5) (- y 2) 30 32 1)) + (inkplate:set-text-size my-dev 4) + (inkplate:print my-dev (inkplate:convert-string-to-hex "S"))) + + (inkplate:set-cursor my-dev 265 15) + (inkplate:set-text-size my-dev 3) + (inkplate:set-text-wrap my-dev #f) + (inkplate:print my-dev (inkplate:convert-string-to-hex "Choose your own tempo for an")) + (inkplate:set-cursor my-dev 265 45) + (inkplate:set-text-size my-dev 3) + (inkplate:set-text-wrap my-dev #f) + (inkplate:print my-dev (inkplate:convert-string-to-hex "email conversation")) + + + (inkplate:partial-update my-dev 15 800 600) + (inkplate:send my-dev) + + (inkplate:close my-dev)) |