Device
- class pyrogue.Device(*, name=None, description='', memBase=None, offset=0, hidden=False, groups=None, expand=False, enabled=True, defaults=None, enableDeps=None, hubMin=0, hubMax=0, guiGroup=None)[source]
Base class for PyRogue devices.
- Parameters:
name (str, optional) – Device name, defaults to the class name.
description (str, optional (default = "")) – Human-readable description.
memBase (rim.MemorySlave, optional) – Optional memory interface base, inherited from parent if not provided.
offset (int, optional (default = 0)) – Memory offset for the device.
hidden (bool, optional (default = False)) – If True, add the device to the
Hiddengroup.expand (bool, optional (default = False)) – Default GUI expand state.
enabled (bool, optional (default = True)) – Initial enable state.
defaults (dict, optional) – Default variable values keyed by name.
enableDeps (iterable, optional) – Enable dependency variables.
hubMin (int, optional (default = 0)) – Hub minimum access size.
hubMax (int, optional (default = 0)) – Hub maximum access size.
guiGroup (str, optional) – GUI grouping label.
- addRemoteVariables(number, stride, pack=False, **kwargs)[source]
Add a repeating block of remote variables.
- writeBlocks(*, force=False, recurse=True, variable=None, checkEach=False, index=-1, **kwargs)[source]
Write all blocks held by this device.
- Parameters:
force (
bool, default:False) – Force the write even if values are unchanged.recurse (
bool, default:True) – If True, recurse into child devices.variable (
Any|None, default:None) – Optional variable to write.checkEach (
bool, default:False) – Perform per-variable verification checks.index (
int, default:-1) – Optional index for array variables.**kwargs (
Any) – Additional arguments passed through to the transaction.
- Return type:
- verifyBlocks(*, recurse=True, variable=None, checkEach=False, **kwargs)[source]
Verify blocks in the background.
- Parameters:
- Return type:
- readBlocks(*, recurse=True, variable=None, checkEach=False, index=-1, **kwargs)[source]
Read blocks in the background.
- Parameters:
recurse (
bool, default:True) – If True, recurse into child devices.variable (
Any|None, default:None) – Optional variable to read.checkEach (
bool, default:False) – Perform per-variable verification checks.index (
int, default:-1) – Optional index for array variables.**kwargs (
Any) – Additional arguments passed through to the transaction.
- Return type:
- checkBlocks(*, recurse=True, variable=None, **kwargs)[source]
Check block transactions and notify variable listeners.
- writeAndVerifyBlocks(force=False, recurse=True, variable=None, checkEach=False)[source]
Write, verify, and check all blocks.
- Parameters:
- Return type:
- readAndCheckBlocks(recurse=True, variable=None, checkEach=False)[source]
Read and check all blocks.
- command(**kwargs)[source]
Decorator to add inline methods as commands.
The decorated function is used as
LocalCommand(function=...). The command wrapper supplies keyword argumentsroot,dev,cmd, andarg; the function may accept any subset.
- linkVariableGet(**kwargs)[source]
Decorator to add inline
linkedGetfunctions.The decorated function is used as
LinkVariable(linkedGet=...). The linked-get wrapper supplies keyword argumentsdev,var,read,index, andcheck; the function may accept any subset.
- genDocuments(path, incGroups=None, excGroups=None)[source]
Generate Sphinx documentation pages for this device.
- addNode(nodeClass, **kwargs)
Construct and add a node of
nodeClass.
- addNodes(nodeClass, number, stride, **kwargs)
Add a series of nodes with indexed names.
- addToGroup(group)
Add this node to a group and propagate to children.
- callRecursive(func, nodeTypes=None, **kwargs)
Call a named method on this node and matching children.
- property commands: OrderedDict[str, BaseCommand]
Return direct child commands.
- commandsByGroup(incGroups=None, excGroups=None)
Return commands filtered by group.
- Return type:
- Parameters:
- property devices: OrderedDict[str, Device]
Return direct child devices.
- devicesByGroup(incGroups=None, excGroups=None)
Return devices filtered by group.
- filterByGroup(incGroups, excGroups)
Return True if the node passes include/exclude filters.
- find(*, recurse=True, typ=None, **kwargs)
Find all child nodes that are a base class of ‘typ’ and whose properties match all of the kwargs. For string properties, accepts regexes.
- getNodes(typ, excTyp=None, incGroups=None, excGroups=None)
Get a filtered ordered dictionary of nodes. pass a class to typ to receive a certain type of node exc is a class type to exclude, incGroups is an optional group or list of groups that this node must be part of excGroups is an optional group or list of groups that this node must not be part of
- Parameters:
- Returns:
Ordered dictionary of nodes.
- Return type:
- getYaml(readFirst=False, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=None, recurse=True)
Return current values as YAML text.
- Parameters:
readFirst (
bool, default:False) – If True, perform a full hardware read before exporting.modes (
list[str], default:['RW', 'RO', 'WO']) – Variable modes to include. Allowed values are'RW','WO', and'RO'.incGroups (
str|list[str] |None, default:None) – Group name or group names to include.excGroups (
str|list[str] |None, default:None) – Group name or group names to exclude.recurse (
bool, default:True) – If True, recurse into child devices.
- Returns:
YAML-formatted representation of the node subtree.
- Return type:
Return True if the node is hidden.
- inGroup(group)
Return True if the node is in the provided group or groups.
- isinstance(typ)
Return True if this node is an instance of
typ.
- makeRecursive(func, nodeTypes=None)
Create a recursive wrapper for a named method.
- node(name)
Return a direct child node by name.
- nodeMatch(name)
Match a node name, including array-style accessors.
- property nodes: OrderedDict[str, Node]
Return an ordered dictionary of direct child nodes.
- printYaml(readFirst=False, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=None, recurse=False)
Print the YAML representation to stdout.
- Parameters:
readFirst (
bool, default:False) – If True, perform a full hardware read before exporting.modes (
list[str], default:['RW', 'RO', 'WO']) – Variable modes to include. Allowed values are'RW','WO', and'RO'.incGroups (
str|list[str] |None, default:None) – Group name or group names to include.excGroups (
str|list[str] |None, default:None) – Group name or group names to exclude.recurse (
bool, default:False) – If True, recurse into child devices.
- Return type:
- removeFromGroup(group)
Remove this node from a group.
- setName((Slave)arg1, (str)arg2) None :
- C++ signature :
void setName(rogue::interfaces::memory::Slave {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
- property variableList: list[BaseVariable]
Return a recursive list of variables and commands.
- property variables: OrderedDict[str, BaseVariable]
Return direct child variables (excluding commands).
- variablesByGroup(incGroups=None, excGroups=None)
Return variables filtered by group.
- Return type:
- Parameters: