Commit 926b8563 authored by Marcus Greiff's avatar Marcus Greiff

Update docs

parent 395392c3
Pipeline #602 passed with stage
in 26 seconds
......@@ -43,8 +43,8 @@
- [`Base.read`](lib/functions.md#Base.read)
- [`Base.read`](lib/functions.md#Base.read)
- [`LabConnections.BeagleBone.assert_pwm_write`](lib/functions.md#LabConnections.BeagleBone.assert_pwm_write-Tuple{Int32,String})
- [`LabConnections.BeagleBone.bbparse`](lib/functions.md#LabConnections.BeagleBone.bbparse-Tuple{Tuple,Any})
- [`LabConnections.BeagleBone.bbparse`](lib/functions.md#LabConnections.BeagleBone.bbparse-Tuple{Any})
- [`LabConnections.BeagleBone.bbparse`](lib/functions.md#LabConnections.BeagleBone.bbparse-Tuple{Tuple,Any})
- [`LabConnections.BeagleBone.closedev`](lib/functions.md#LabConnections.BeagleBone.closedev-Tuple{String,Int32})
- [`LabConnections.BeagleBone.export_gpio`](lib/functions.md#LabConnections.BeagleBone.export_gpio-Tuple{Int32})
- [`LabConnections.BeagleBone.export_led`](lib/functions.md#LabConnections.BeagleBone.export_led)
......
......@@ -2,8 +2,8 @@
- [`Base.read`](functions.md#Base.read)
- [`Base.read`](functions.md#Base.read)
- [`LabConnections.BeagleBone.assert_pwm_write`](functions.md#LabConnections.BeagleBone.assert_pwm_write-Tuple{Int32,String})
- [`LabConnections.BeagleBone.bbparse`](functions.md#LabConnections.BeagleBone.bbparse-Tuple{Tuple,Any})
- [`LabConnections.BeagleBone.bbparse`](functions.md#LabConnections.BeagleBone.bbparse-Tuple{Any})
- [`LabConnections.BeagleBone.bbparse`](functions.md#LabConnections.BeagleBone.bbparse-Tuple{Tuple,Any})
- [`LabConnections.BeagleBone.closedev`](functions.md#LabConnections.BeagleBone.closedev-Tuple{String,Int32})
- [`LabConnections.BeagleBone.export_gpio`](functions.md#LabConnections.BeagleBone.export_gpio-Tuple{Int32})
- [`LabConnections.BeagleBone.export_led`](functions.md#LabConnections.BeagleBone.export_led)
......@@ -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(led::SysLED, debug::Bool=false)
```
Reads the current brightness value from the LED 'SysLED'.
l = read(pwm::PWM, operation::Int32, debug::Bool=false) Reads the current value from an operation on a GPIO.
<a id='Base.read' href='#Base.read'>#</a>
**`Base.read`** &mdash; *Function*.
......@@ -58,7 +58,11 @@ l = read(gpio::GPIO, operation::Int32, debug::Bool=false) Reads the current valu
l = read(pwm::PWM, 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='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*.
......@@ -76,23 +80,33 @@ 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)
```
and send back on socket (vals, timestamps)
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).
<a id='LabConnections.BeagleBone.closedev-Tuple{String,Int32}' href='#LabConnections.BeagleBone.closedev-Tuple{String,Int32}'>#</a>
**`LabConnections.BeagleBone.closedev`** &mdash; *Method*.
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.
```
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.
<a id='LabConnections.BeagleBone.export_gpio-Tuple{Int32}' href='#LabConnections.BeagleBone.export_gpio-Tuple{Int32}'>#</a>
**`LabConnections.BeagleBone.export_gpio`** &mdash; *Method*.
......@@ -124,28 +138,44 @@ 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*.
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'.
```
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'.
<a id='LabConnections.BeagleBone.listdev-Tuple{}' href='#LabConnections.BeagleBone.listdev-Tuple{}'>#</a>
**`LabConnections.BeagleBone.listdev`** &mdash; *Method*.
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*.
......@@ -202,6 +232,13 @@ to_string(led::SysLED, debug::Bool=false) Generates a string representation of t
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).
<a id='LabConnections.BeagleBone.write!' href='#LabConnections.BeagleBone.write!'>#</a>
**`LabConnections.BeagleBone.write!`** &mdash; *Function*.
```
write!(pwm::PWM, args::Tuple{Int32,String}, debug::Bool=false)
```
......@@ -219,10 +256,3 @@ 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!(gpio::GPIO, args::Tuple{Int32,String}, debug::Bool=false) Writes an entry to an operation on a GPIO, of the form args = (operation, entry).
......@@ -18,7 +18,7 @@
Debug(i::Int32)
```
Type for debugging and precompile
Type for debugging and precompile.
<a id='LabConnections.BeagleBone.GPIO' href='#LabConnections.BeagleBone.GPIO'>#</a>
**`LabConnections.BeagleBone.GPIO`** &mdash; *Type*.
......@@ -39,7 +39,9 @@ write!(gpio, (1, "1"))
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.
......
......@@ -11,10 +11,12 @@ 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}())
""" 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 +32,11 @@ function initdev(dev_name::String, i::Int32)
return active_device
end
""" 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 +51,10 @@ 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'"""
"""
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 +64,10 @@ function getdev(dev_name::String, i::Int32)
return dev
end
""" 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 +77,10 @@ function listdev()
return count
end
""" 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,23 +94,25 @@ function printdev(dev_name::String, i::Int32)
end
end
""" bbparse(cmd)
Parse and execute the command `cmd`"""
"""
bbparse(cmd)
Parse and execute the command `cmd`.
"""
bbparse(any) = error("Unexpected input: $any")
function bbsend(sock, vals)#, timestamps)
serialize(sock, vals)#, (timestamps...)))
end
""" 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 +139,11 @@ function bbparse(l::Tuple, sock)
end
global __waiting_first_connection__ = false
""" 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)
......
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