diff --git a/docs/build/lib/functions.md b/docs/build/lib/functions.md index 9c5e667ac9a1048f5ba69e398417b90bd211a601..873f4860e37d2584ef13d321fd815253f4c39b81 100644 --- a/docs/build/lib/functions.md +++ b/docs/build/lib/functions.md @@ -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`** — *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`** — *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`** — *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`** — *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`** — *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`** — *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`** — *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!`** — *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). diff --git a/docs/build/lib/io_devices.md b/docs/build/lib/io_devices.md index ad6bf2fcfddf1bb39168e263ef1fd75d45cd6213..e43120c99fc49daea6d4e4d8e1bee88b62cd3a87 100644 --- a/docs/build/lib/io_devices.md +++ b/docs/build/lib/io_devices.md @@ -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`** — *Type*. diff --git a/src/BeagleBone/BeagleBone.jl b/src/BeagleBone/BeagleBone.jl index 52c244eb0dee728d3c85bd423a56d01214dea3e5..ee465e1e6abffedde52730207395a1dbc7722b18 100644 --- a/src/BeagleBone/BeagleBone.jl +++ b/src/BeagleBone/BeagleBone.jl @@ -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) diff --git a/src/BeagleBone/Debug.jl b/src/BeagleBone/Debug.jl index c018fa66f8cac548d9e687c27e16b0e9171f4167..9c3b0337cde30719fddf6674a4835afe9a8d8a8c 100644 --- a/src/BeagleBone/Debug.jl +++ b/src/BeagleBone/Debug.jl @@ -1,7 +1,7 @@ -@doc""" +""" Debug() Type for debugging and precompile -"""-> +""" type Debug <: IO_Object i::Int32 end diff --git a/src/BeagleBone/GPIO.jl b/src/BeagleBone/GPIO.jl index f79fb8e73e21e040ab00222eef5cbb1752517fa8..52e36abca4c55e9e6c347b03a10687755fe0c4f6 100644 --- a/src/BeagleBone/GPIO.jl +++ b/src/BeagleBone/GPIO.jl @@ -1,4 +1,4 @@ -@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" diff --git a/src/BeagleBone/IO_Object.jl b/src/BeagleBone/IO_Object.jl index 87ad44c0b7adf067bac68e7b0b59752dbeced027..9215ea2189e76697d5781172f3d8260cd9226d5c 100644 --- a/src/BeagleBone/IO_Object.jl +++ b/src/BeagleBone/IO_Object.jl @@ -1,6 +1,6 @@ -@doc""" +""" Define abstract type for pins/LEDS on the BeagleBone -"""-> +""" abstract type IO_Object end const gpio_operations = [