Skip to content

Commit

Permalink
edtlib: move ControllerAndData
Browse files Browse the repository at this point in the history
This is just moving the class definition higher in the file
to make it easier to type annotate the module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
  • Loading branch information
mbolivar-nordic committed Apr 17, 2023
1 parent ea4db57 commit a5d8233
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions scripts/dts/python-devicetree/src/devicetree/edtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,49 @@ def __repr__(self):
return "<Range, {}>".format(", ".join(fields))


class ControllerAndData:
"""
Represents an entry in an 'interrupts' or 'type: phandle-array' property
value, e.g. <&ctrl-1 4 0> in
cs-gpios = <&ctrl-1 4 0 &ctrl-2 3 4>;
These attributes are available on ControllerAndData objects:
node:
The Node instance the property appears on
controller:
The Node instance for the controller (e.g. the controller the interrupt
gets sent to for interrupts)
data:
A dictionary that maps names from the *-cells key in the binding for the
controller to data values, e.g. {"pin": 4, "flags": 0} for the example
above.
'interrupts = <1 2>' might give {"irq": 1, "level": 2}.
name:
The name of the entry as given in
'interrupt-names'/'gpio-names'/'pwm-names'/etc., or None if there is no
*-names property
basename:
Basename for the controller when supporting named cells
"""
def __repr__(self):
fields = []

if self.name is not None:
fields.append("name: " + self.name)

fields.append(f"controller: {self.controller}")
fields.append(f"data: {self.data}")

return "<ControllerAndData, {}>".format(", ".join(fields))


class EDT:
"""
Represents a devicetree augmented with information from bindings.
Expand Down Expand Up @@ -2170,49 +2213,6 @@ def _named_cells(self, controller, data, basename):
return dict(zip(cell_names, data_list))


class ControllerAndData:
"""
Represents an entry in an 'interrupts' or 'type: phandle-array' property
value, e.g. <&ctrl-1 4 0> in
cs-gpios = <&ctrl-1 4 0 &ctrl-2 3 4>;
These attributes are available on ControllerAndData objects:
node:
The Node instance the property appears on
controller:
The Node instance for the controller (e.g. the controller the interrupt
gets sent to for interrupts)
data:
A dictionary that maps names from the *-cells key in the binding for the
controller to data values, e.g. {"pin": 4, "flags": 0} for the example
above.
'interrupts = <1 2>' might give {"irq": 1, "level": 2}.
name:
The name of the entry as given in
'interrupt-names'/'gpio-names'/'pwm-names'/etc., or None if there is no
*-names property
basename:
Basename for the controller when supporting named cells
"""
def __repr__(self):
fields = []

if self.name is not None:
fields.append("name: " + self.name)

fields.append(f"controller: {self.controller}")
fields.append(f"data: {self.data}")

return "<ControllerAndData, {}>".format(", ".join(fields))


class PinCtrl:
"""
Represents a pin control configuration for a set of pins on a device,
Expand Down

0 comments on commit a5d8233

Please sign in to comment.