We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 76abb2e commit 0589c19Copy full SHA for 0589c19
tests/extmod/machine1.py
@@ -0,0 +1,33 @@
1
+# test machine module
2
+
3
+import machine
4
+import uctypes
5
6
+print(machine.mem8)
7
8
+buf = bytearray(8)
9
+addr = uctypes.addressof(buf)
10
11
+machine.mem8[addr] = 123
12
+print(machine.mem8[addr])
13
14
+machine.mem16[addr] = 12345
15
+print(machine.mem16[addr])
16
17
+machine.mem32[addr] = 123456789
18
+print(machine.mem32[addr])
19
20
+try:
21
+ machine.mem16[1]
22
+except ValueError:
23
+ print("ValueError")
24
25
26
+ machine.mem16[1] = 1
27
28
29
30
31
+ del machine.mem8[0]
32
+except TypeError:
33
+ print("TypeError")
tests/extmod/machine1.py.exp
@@ -0,0 +1,7 @@
+<8-bit memory>
+123
+12345
+123456789
+ValueError
+TypeError
0 commit comments