diff --git a/src/BeagleBone/BeagleBone.jl b/src/BeagleBone/BeagleBone.jl index 3038aae44afad252697fd26bb585e08a5769c7cf..52c244eb0dee728d3c85bd423a56d01214dea3e5 100644 --- a/src/BeagleBone/BeagleBone.jl +++ b/src/BeagleBone/BeagleBone.jl @@ -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) diff --git a/src/BeagleBone/Debug.jl b/src/BeagleBone/Debug.jl index 9c3b0337cde30719fddf6674a4835afe9a8d8a8c..c018fa66f8cac548d9e687c27e16b0e9171f4167 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 1dca4909b3272c920f9ca73c885fa94ed8dd7968..f79fb8e73e21e040ab00222eef5cbb1752517fa8 100644 --- a/src/BeagleBone/GPIO.jl +++ b/src/BeagleBone/GPIO.jl @@ -1,21 +1,20 @@ -""" +@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) - 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 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 @@ -69,7 +68,7 @@ end @doc """ 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 @@ -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" diff --git a/src/BeagleBone/IO_Object.jl b/src/BeagleBone/IO_Object.jl index 3a53ab5502cbe8ce8a4530d77a35f162d80ac4c0..87ad44c0b7adf067bac68e7b0b59752dbeced027 100644 --- a/src/BeagleBone/IO_Object.jl +++ b/src/BeagleBone/IO_Object.jl @@ -1,11 +1,8 @@ -""" +@doc""" Define abstract type for pins/LEDS on the BeagleBone -""" +"""-> abstract type IO_Object end -""" -GPIO interfaces -""" const gpio_operations = [ ["1", "0"], ["in", "out"], diff --git a/src/BeagleBone/PWM.jl b/src/BeagleBone/PWM.jl index 9689e89c7be8653f72b6aec79b5ed6260095fd56..395fcb04dc017d6819a5c1d914a054499405f908 100644 --- a/src/BeagleBone/PWM.jl +++ b/src/BeagleBone/PWM.jl @@ -1,9 +1,8 @@ """ -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