Skip to content
Snippets Groups Projects

Rewrote devices on Beaglebone. Passes precompile, but needs proper testing.

Files

+ 8
7
@@ -5,7 +5,7 @@ i ∈ [1,2,3,4].
"""
type SysLED <: IO_Object
i::Int32
brightness_filestream::IOStream
filestream::IOStream
function SysLED(i::Int32)
i [1,2,3,4] && error("Invalid SysLED index: $i")
#Note, in the future we should interface to config and retrieve IOStream from there
@@ -18,10 +18,11 @@ end
write!(led::SysLED, val::Bool, debug::Bool=false)
Turns the LED 'SysLed' on/off for val = true/false respectively.
"""
function write!(led::SysLED, val::Bool, debug::Bool=false)
function write!(led::SysLED, entry::String, debug::Bool=false)
debug && return
write(led.brightness_filestream, val ? "1" : "0")
seekstart(led.brightness_filestream)
entry ["0", "1"] && error("Invalid SysLED entry $(entry), valid options are 0 and 1 (string)")
write(led.filestream, entry)
seekstart(led.filestream)
end
"""
@@ -30,9 +31,9 @@ Reads the current brightness value from the LED 'SysLED'.
"""
function read(led::SysLED, debug::Bool=false)
debug && return
l = read(led.brightness_filestream, Char)
l = read(filestream, Char)
(l != '1' && l != '0') && error("Invalid value \"$l\" read from SysLed")
seekstart(led.brightness_filestream)
seekstart(led.filestream)
return l
end
@@ -42,5 +43,5 @@ Closes all open filestreams for the SysLED 'led'.
"""
function teardown(led::SysLED, debug::Bool=false)
debug && return
close(led.brightness_filestream)
close(led.filestream)
end
Loading