@@ -98,8 +98,8 @@ Module contents
9898
9999.. class :: struct(descriptor, layout_type)
100100
101- Create a "foreign data structure" object based on its descriptor (encoded
102- as a dictionary) and layout type.
101+ Create a "foreign data structure" class based on its descriptor (encoded
102+ as a dictionary) and layout type (see below) .
103103
104104.. data :: LITTLE_ENDIAN
105105
@@ -140,6 +140,22 @@ Module contents
140140 so it can be both written too, and you will access current value
141141 at the given memory address.
142142
143+ Structure classes and instantiating structure objects
144+ -----------------------------------------------------
145+
146+ Given structure descriptor and layout type, you can instantiate a
147+ "structure class" using uctypes.struct() factory function. From it,
148+ you can instantiate a specific structure instance at a given
149+ memory address. Memory address usually comes from following sources:
150+
151+ * Predefined address, when accessing hardware registers on a baremetal
152+ port. Lookup these addresses in datasheet for a particular MCU/SoC.
153+ * As return value from a call to some FFI (Foreign Function Interface)
154+ function.
155+ * From uctypes.addressof(), when you want to pass arguments to FFI
156+ function, or alternatively, to access some data for I/O (for example,
157+ data read from file or network socket).
158+
143159Structure objects
144160-----------------
145161
0 commit comments