Skip to content
Snippets Groups Projects
Commit ce9f8634 authored by Marcus Greiff's avatar Marcus Greiff
Browse files

Update docs

parent 5eecc9b1
Branches
No related tags found
No related merge requests found
Pipeline #
......@@ -32,8 +32,7 @@ end
@doc """ closedev(dev_name::String, i::Int32)
Closes down a currently active device of type 'dev_name' at index 'i' on the BeagleBone,
and removes it from the dict of currently active devices.
""" ->
and removes it from the dict of currently active devices."""->
function closedev(dev_name::String, i::Int32)
active_device = try
active_devices[dev_name][i]
......@@ -48,10 +47,8 @@ function closedev(dev_name::String, i::Int32)
delete!(active_devices[dev_name], i)
end
"""
dev = getdev(dev_name::String, i::Int32)
Retrieves the active device of type `dev_name` at index 'i'
"""
@doc """ dev = getdev(dev_name::String, i::Int32)
Retrieves the active device of type `dev_name` at index 'i'"""->
function getdev(dev_name::String, i::Int32)
dev = try
active_devices[dev_name][i]
......@@ -61,10 +58,8 @@ function getdev(dev_name::String, i::Int32)
return dev
end
"""
message = listdev()
Lists all the active devices as an insidence array for testing
"""
@doc """ message = listdev()
Lists all the active devices as an insidence array for testing"""->
function listdev()
message = "Complete overview of active devices"
count = zeros(length(keys(DEVICES)))
......@@ -74,10 +69,8 @@ function listdev()
return count
end
"""
message = printdev()
Prints all the active devices and writes out specifics of a single devices
"""
@doc """ message = printdev()
Prints all the active devices and writes out specifics of a single devices"""->
function printdev(dev_name::String, i::Int32)
println("Complete overview of active devices")
for (index, key) in enumerate(keys(DEVICES))
......@@ -91,10 +84,8 @@ function printdev(dev_name::String, i::Int32)
end
end
"""
bbparse(cmd)
Parse and execute the command `cmd`
"""
@doc """ bbparse(cmd)
Parse and execute the command `cmd`"""->
bbparse(any) = error("Unexpected input: $any")
......@@ -102,16 +93,14 @@ function bbsend(sock, vals)#, timestamps)
serialize(sock, vals)#, (timestamps...)))
end
"""
bbparse(l::Tuple, sock)
@doc """ bbparse(l::Tuple, sock)
Parse input on the form `l=(iswrite, ndev, cmd1, cmd2, ..., cmdn)`
where if `iswrite`
`cmdi = (devname, id, val)`
and if not `iswrite`
`cmdi = (devname, id)`
and send back on socket (vals, timestamps)
"""
and send back on socket (vals, timestamps)"""->
function bbparse(l::Tuple, sock)
iswrite = l[1]::Bool #True if write command, false if read
ndev = l[2]::Int32 #Number of devices/commands
......@@ -138,11 +127,9 @@ function bbparse(l::Tuple, sock)
end
global __waiting_first_connection__ = false
"""
run_server(port=2001; debug=false)
@doc""" run_server(port=2001; debug=false)
Run a server on `port` that listens for commands from computer
Optional debug keyword disables blinking system leds
"""
Optional debug keyword disables blinking system leds"""->
function run_server(port=2001; debug=false)
global __waiting_first_connection__ = true
server = listen(port)
......
"""
@doc"""
Debug()
Type for debugging and precompile
"""
"""->
type Debug <: IO_Object
i::Int32
end
......
"""
@doc """
GPIO()
Lowest form of communication with the GPIO pins. The available pins are
listed in the "channel" parameter, and appear as directories in /sys/class/gpio
after being exported.
For instance, to setup a GPIO on "gpio112", configure it as an output pin and set
after being exported. For instance, to setup a GPIO on "gpio112", configure it as an output pin and set
it to high, the following code would be used.
gpio = GPIO(1)
......@@ -15,7 +14,7 @@ The operation of reading the current output value of the GPIO is done by
read(gpio, 1)
See the test/BeagleBone/GPIO_test.jl for more examples.
"""
"""->
type GPIO <: IO_Object
i::Int32
basedir::String
......@@ -36,10 +35,10 @@ type GPIO <: IO_Object
end
end
"""
@doc"""
write!(gpio::GPIO, args::Tuple{Int32,String}, debug::Bool=false)
Writes an entry to an operation on a GPIO, of the form args = (operation, entry).
"""
"""->
function write!(gpio::GPIO, args::Tuple{Int32,String}, debug::Bool=false)
debug && return
operation, entry = args[1], args[2]
......@@ -54,10 +53,10 @@ function write!(gpio::GPIO, args::Tuple{Int32,String}, debug::Bool=false)
end
end
"""
@doc"""
l = read(gpio::GPIO, operation::Int32, debug::Bool=false)
Reads the current value from an operation on a GPIO.
"""
"""->
function read(gpio::GPIO, operation::Int32, debug::Bool=false)
debug && return
# Filestreams 1, 2 and 3 are readable
......@@ -95,10 +94,10 @@ function teardown(gpio::GPIO, debug::Bool=false)
end
end
"""
@doc"""
export_gpio(i::Int32, debug::Bool=false)
Export the GPIO file system, either for real-time or testing usecases.
"""
"""->
function export_gpio(i::Int32)
if isdefined(:RUNNING_TESTS)
# Export a dummy file system for testing
......@@ -123,10 +122,10 @@ function export_gpio(i::Int32)
return basedir
end
"""
@doc"""
to_string(gpio::GPIO, debug::Bool=false)
Generates a string representation of the GPIO device.
"""
"""->
function to_string(gpio::GPIO, debug::Bool=false)
debug && return
message = "\nID: $(gpio.i)\n\nAvailable filestreams:\n"
......
"""
@doc"""
Define abstract type for pins/LEDS on the BeagleBone
"""
"""->
abstract type IO_Object end
"""
GPIO interfaces
"""
const gpio_operations = [
["1", "0"],
["in", "out"],
......
"""
This script allows for low level PWM control of selected pins
The valid pins dictionary relates to memory adresses in of the
AM3359 chip, see p.182 in
www.ti.com/product/AM3359/technicaldocuments
PWM()
This device allows for low level PWM control of selected pins. The valid pins
dictionary pwm_pins relates to memory adresses in of the AM3359 chip, see p.182
in www.ti.com/product/AM3359/technicaldocuments.
"""
type PWM <: IO_Object
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment