Skip to content

Commit

Permalink
Init work on updating client docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
nHackel committed Jun 23, 2022
1 parent 9e97cb0 commit f670c6c
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 18 deletions.
37 changes: 19 additions & 18 deletions docs/src/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@ RedPitayaDAQServer.RedPitaya(::String, ::Int64, ::Int64, ::Bool)
RedPitayaDAQServer.send(::RedPitaya, ::String)
RedPitayaDAQServer.query
RedPitayaDAQServer.receive
RedPitayaDAQServer.ServerMode
RedPitayaDAQServer.serverMode
RedPitayaDAQServer.serverMode!
RedPitayaDAQServer.ScpiBatch
RedPitayaDAQServer.@add_batch
RedPitayaDAQServer.execute!
RedPitayaDAQServer.push!(::ScpiBatch, ::Pair{K, T}) where {K<:Function, T<:Tuple}
RedPitayaDAQServer.pop!(::ScpiBatch)
RedPitayaDAQServer.clear!(::ScpiBatch)
RedPitayaDAQServer.RedPitayaCluster
RedPitayaDAQServer.RedPitayaCluster(::Vector{String}, ::Int64, ::Int64)
RedPitayaDAQServer.length(::RedPitayaCluster)
RedPitayaDAQServer.master
```
## ADC Configuration
Expand All @@ -22,11 +32,14 @@ RedPitayaDAQServer.keepAliveReset
RedPitayaDAQServer.keepAliveReset!
RedPitayaDAQServer.decimation
RedPitayaDAQServer.decimation!
RedPitayaDAQServer.numChan
RedPitayaDAQServer.samplesPerPeriod
RedPitayaDAQServer.samplesPerPeriod!
RedPitayaDAQServer.periodsPerFrame
RedPitayaDAQServer.periodsPerFrame!
RedPitayaDAQServer.calibADCOffset
RedPitayaDAQServer.calibADCOffset!
RedPitayaDAQServer.calibADCScale
RedPitayaDAQServer.calibADCScale!
```
## DAC Configuration
```@docs
Expand All @@ -38,8 +51,6 @@ RedPitayaDAQServer.frequencyDAC
RedPitayaDAQServer.frequencyDAC!
RedPitayaDAQServer.phaseDAC
RedPitayaDAQServer.phaseDAC!
RedPitayaDAQServer.jumpSharpnessDAC
RedPitayaDAQServer.jumpSharpnessDAC!
RedPitayaDAQServer.SignalType
RedPitayaDAQServer.signalTypeDAC
RedPitayaDAQServer.signalTypeDAC!
Expand All @@ -48,35 +59,25 @@ RedPitayaDAQServer.numSeqChan!
RedPitayaDAQServer.samplesPerStep
RedPitayaDAQServer.samplesPerStep!
RedPitayaDAQServer.stepsPerFrame!
RedPitayaDAQServer.AbstractSequence
RedPitayaDAQServer.appendSequence!
RedPitayaDAQServer.prepareSequence!
RedPitayaDAQServer.clearSequences!
RedPitayaDAQServer.popSequence!
RedPitayaDAQServer.length(::AbstractSequence)
RedPitayaDAQServer.start
RedPitayaDAQServer.ArbitrarySequence
RedPitayaDAQServer.ArbitrarySequence(lut, enable, repetitions, upSteps, upTotalSteps, downSteps, downTotalSteps, reset)
RedPitayaDAQServer.calibDACOffset
RedPitayaDAQServer.calibDACOffset!
RedPitayaDAQServer.calibDACScale
RedPitayaDAQServer.calibDACScale!
```
## Measurement and Transmission
```@docs
RedPitayaDAQServer.ServerMode
RedPitayaDAQServer.serverMode
RedPitayaDAQServer.serverMode!
RedPitayaDAQServer.masterTrigger
RedPitayaDAQServer.masterTrigger!
RedPitayaDAQServer.currentWP
RedPitayaDAQServer.currentFrame
RedPitayaDAQServer.currentPeriod
RedPitayaDAQServer.SampleChunk
RedPitayaDAQServer.PerformanceData
RedPitayaDAQServer.readPipelinedSamples
RedPitayaDAQServer.readSamples
RedPitayaDAQServer.readFrames
RedPitayaDAQServer.convertSamplesToFrames
RedPitayaDAQServer.calibDACOffset
RedPitayaDAQServer.calibDACOffset!
RedPitayaDAQServer.calibADCOffset
RedPitayaDAQServer.calibADCOffset!
RedPitayaDAQServer.calibADCScale
RedPitayaDAQServer.calibADCScale!
```
14 changes: 14 additions & 0 deletions src/client/julia/src/Cluster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,20 @@ function execute!(rpc::RedPitayaCluster, batch::ScpiBatch)
return results
end

"""
execute!(f::Function, rp::Union{RedPitaya, RedPitayaCluster})
Open a `ScpiBatch` and evaluate the function `f`. If no exception was thrown, execute the opened batch.
See also [`ScpiBatch`](@ref), [`push!`](@ref), [`@add_batch`](@ref)
# Examples
```julia
julia> execute!(rp) do b
@add_batch b serverMode!(rp, CONFIGURATION)
@add_batch b amplitudeDAC!(rp, 1, 1, 0.2)
end
```
"""
function execute!(f::Function, rp::Union{RedPitaya, RedPitayaCluster})
scpiBatch = ScpiBatch()
try
Expand Down
36 changes: 36 additions & 0 deletions src/client/julia/src/RedPitayaDAQServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,31 @@ struct ScpiBatch
end
ScpiBatch() = ScpiBatch([])

"""
push!(batch::ScpiBatch, cmd::Pair{K, T}) where {K<:Function, T<:Tuple}
Add the given function and arguments to the batch
# Examples
```julia
julia> batch = ScpiBatch()
julia> push!(batch, amplitudeDAC! => (1, 1, 0.2))
```
"""
push!(batch::ScpiBatch, cmd::Pair{K, T}) where {K<:Function, T<:Tuple} = push!(batch.cmds, cmd)
push!(batch::ScpiBatch, cmd::Pair{K, T}) where {K<:Function, T<:Any} = push!(batch, cmd.first => (cmd.second,))
"""
pop!(batch::ScpiBatch)
Remove the last added command from the batch
"""
pop!(batch::ScpiBatch) = pop!(batch.cmds)

"""
clear!(batch::ScpiBatch)
Remove all commands from the batch
"""
function clear!(batch::ScpiBatch)
batch.cmds = []
end
Expand Down Expand Up @@ -306,6 +328,20 @@ function execute!(rp::RedPitaya, batch::ScpiBatch)
return result
end

"""
@add_batch batch cmd
Append a usual RedPitaya function to the given batch instead of evaluating it directly.
See also [`ScpiBatch`](@ref), [`push!`](@ref), [`execute!`](@ref)
# Examples
```julia
julia> execute!(rp) do b
@add_batch b serverMode!(rp, CONFIGURATION)
end
```
"""
macro add_batch(batch::Symbol, expr::Expr)
if expr.head != :call
throw(ArgumentError("$expr is not a function call"))
Expand Down

0 comments on commit f670c6c

Please sign in to comment.