Commit aca78699 authored by Marcus Greiff's avatar Marcus Greiff

Update docs

parent 6406f94e
Pipeline #600 passed with stage
in 27 seconds
......@@ -33,18 +33,18 @@
```
run_server(port=2001; debug=false)
```
Run a server on `port` that listens for commands from computer Optional debug keyword disables blinking system leds
run_server(port=2001; debug=false) Run a server on `port` that listens for commands from computer Optional debug keyword disables blinking system leds
<a id='Base.read' href='#Base.read'>#</a>
**`Base.read`** &mdash; *Function*.
l = read(gpio::GPIO, operation::Int32, debug::Bool=false) Reads the current value from an operation on a GPIO.
```
l = read(led::SysLED, debug::Bool=false)
```
Reads the current brightness value from the LED 'SysLED'.
<a id='Base.read' href='#Base.read'>#</a>
**`Base.read`** &mdash; *Function*.
......@@ -58,11 +58,7 @@ l = read(pwm::PWM, operation::Int32, debug::Bool=false) Reads the current value
```
l = read(led::SysLED, debug::Bool=false)
```
Reads the current brightness value from the LED 'SysLED'.
l = read(gpio::GPIO, operation::Int32, debug::Bool=false) Reads the current value from an operation on a GPIO.
<a id='LabConnections.BeagleBone.assert_pwm_write-Tuple{Int32,String}' href='#LabConnections.BeagleBone.assert_pwm_write-Tuple{Int32,String}'>#</a>
**`LabConnections.BeagleBone.assert_pwm_write`** &mdash; *Method*.
......@@ -80,22 +76,14 @@ Assertsion for the PWM input data
```
bbparse(cmd)
```
Parse and execute the command `cmd`
bbparse(cmd) Parse and execute the command `cmd`
<a id='LabConnections.BeagleBone.bbparse-Tuple{Tuple,Any}' href='#LabConnections.BeagleBone.bbparse-Tuple{Tuple,Any}'>#</a>
**`LabConnections.BeagleBone.bbparse`** &mdash; *Method*.
```
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)`
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)
......@@ -136,11 +124,7 @@ export_gpio(i::Int32, debug::Bool=false) Export the GPIO file system, either for
```
dev = getdev(dev_name::String, i::Int32)
```
Retrieves the active device of type `dev_name` at index 'i'
dev = getdev(dev_name::String, i::Int32) Retrieves the active device of type `dev_name` at index 'i'
<a id='LabConnections.BeagleBone.initdev-Tuple{String,Int32}' href='#LabConnections.BeagleBone.initdev-Tuple{String,Int32}'>#</a>
**`LabConnections.BeagleBone.initdev`** &mdash; *Method*.
......@@ -154,22 +138,14 @@ active_device = initdev(dev_name::String, i:Int32) Initializes a new device of t
```
message = listdev()
```
Lists all the active devices as an insidence array for testing
message = listdev() Lists all the active devices as an insidence array for testing
<a id='LabConnections.BeagleBone.printdev-Tuple{String,Int32}' href='#LabConnections.BeagleBone.printdev-Tuple{String,Int32}'>#</a>
**`LabConnections.BeagleBone.printdev`** &mdash; *Method*.
```
message = printdev()
```
Prints all the active devices and writes out specifics of a single devices
message = printdev() Prints all the active devices and writes out specifics of a single devices
<a id='LabConnections.BeagleBone.teardown' href='#LabConnections.BeagleBone.teardown'>#</a>
**`LabConnections.BeagleBone.teardown`** &mdash; *Function*.
......@@ -237,16 +213,16 @@ Writes an entry to an operation on the PWM, of the form args = (operation, entry
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).
```
write!(led::SysLED, val::Bool, debug::Bool=false)
```
Turns the LED 'SysLed' on/off for val = true/false respectively.
<a id='LabConnections.BeagleBone.write!' href='#LabConnections.BeagleBone.write!'>#</a>
**`LabConnections.BeagleBone.write!`** &mdash; *Function*.
```
write!(led::SysLED, val::Bool, debug::Bool=false)
```
Turns the LED 'SysLed' on/off for val = true/false respectively.
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).
......@@ -25,11 +25,17 @@ Type for debugging and precompile
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.
```
GPIO()
```
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.
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 it to high, the following code would be used.
gpio = GPIO(1) write!(gpio, (2,"out")) write!(gpio, (1, "1"))
```
gpio = GPIO(1)
write!(gpio, (2,"out"))
write!(gpio, (1, "1"))
```
The operation of reading the current output value of the GPIO is done by
......@@ -49,12 +55,12 @@ Define abstract type for pins/LEDS on the BeagleBone
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.
<a id='LabConnections.BeagleBone.SysLED' href='#LabConnections.BeagleBone.SysLED'>#</a>
**`LabConnections.BeagleBone.SysLED`** &mdash; *Type*.
......
......@@ -11,10 +11,10 @@ const DEVICES = Dict("debug" => Debug, "sysled" => SysLED, "gpio" => GPIO, "pwm"
active_devices = Dict{String,Dict{Int32,IO_Object}}("debug" => Dict{Int32,Debug}(), "sysled" => Dict{Int32,SysLED}(),
"gpio" => Dict{Int32,GPIO}(), "pwm" => Dict{Int32,PWM}())
@doc """ active_device = initdev(dev_name::String, i:Int32)
""" active_device = initdev(dev_name::String, i:Int32)
Initializes a new device of type 'dev_name' at index 'i' on the BeagleBone,
and adds it to the dict of currently active devices. Returns the initialized
device 'active_device'."""->
device 'active_device'."""
function initdev(dev_name::String, i::Int32)
#Check if the type of device is valid
dev_constr = try
......@@ -30,9 +30,9 @@ function initdev(dev_name::String, i::Int32)
return active_device
end
@doc """ closedev(dev_name::String, i::Int32)
""" 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]
......@@ -47,8 +47,8 @@ function closedev(dev_name::String, i::Int32)
delete!(active_devices[dev_name], i)
end
@doc """ dev = getdev(dev_name::String, i::Int32)
Retrieves the active device of type `dev_name` at index 'i'"""->
""" 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]
......@@ -58,8 +58,8 @@ function getdev(dev_name::String, i::Int32)
return dev
end
@doc """ message = listdev()
Lists all the active devices as an insidence array for testing"""->
""" 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)))
......@@ -69,8 +69,8 @@ function listdev()
return count
end
@doc """ message = printdev()
Prints all the active devices and writes out specifics of a single devices"""->
""" 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))
......@@ -84,8 +84,8 @@ function printdev(dev_name::String, i::Int32)
end
end
@doc """ bbparse(cmd)
Parse and execute the command `cmd`"""->
""" bbparse(cmd)
Parse and execute the command `cmd`"""
bbparse(any) = error("Unexpected input: $any")
......@@ -93,14 +93,14 @@ function bbsend(sock, vals)#, timestamps)
serialize(sock, vals)#, (timestamps...)))
end
@doc """ bbparse(l::Tuple, sock)
""" 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
......@@ -127,9 +127,9 @@ function bbparse(l::Tuple, sock)
end
global __waiting_first_connection__ = false
@doc""" run_server(port=2001; debug=false)
""" 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
......@@ -14,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
......@@ -35,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]
......@@ -53,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
......@@ -66,9 +66,9 @@ function read(gpio::GPIO, operation::Int32, debug::Bool=false)
return l
end
@doc """ teardown(gpio::GPIO, debug::Bool=false)
""" teardown(gpio::GPIO, debug::Bool=false)
Closes all open streams on the GPIO, and unexports it from the file system.
"""->
"""
function teardown(gpio::GPIO, debug::Bool=false)
debug && return
......@@ -94,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
......@@ -122,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 typeIO_Object end
const gpio_operations = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment