20 lines
716 B
Scheme
20 lines
716 B
Scheme
|
(module (menu led)
|
||
|
(enable-led
|
||
|
disable-led)
|
||
|
(import (scheme)
|
||
|
(chicken base)
|
||
|
(chicken process))
|
||
|
|
||
|
;; Investigate: there are the kernel modules ledtrig_timer and ledtrig_heartbeat.
|
||
|
;; The latter, when `echo heartbeat` to `trigger`, does what one would expect.
|
||
|
|
||
|
(define (enable-led colour)
|
||
|
(process-run (string-append "echo 255 | sudo tee /sys/class/leds/"
|
||
|
(symbol->string colour)
|
||
|
"_led/brightness")))
|
||
|
|
||
|
(define (disable-led colour)
|
||
|
(process-run (string-append "echo 0 | sudo tee /sys/class/leds/"
|
||
|
(symbol->string colour)
|
||
|
"_led/brightness"))))
|