-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmachine.py
76 lines (50 loc) · 993 Bytes
/
machine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import sys
import os
import random
import time
PWRON_RESET = 1
HARD_RESET = 2
WDT_RESET = 3
DEEPSLEEP_RESET = 4
SOFT_RESET = 0
_RESET_CAUSE = random.randint(0, 4)
def unique_id():
return os.urandom(8)
def reset():
sys.exit(1)
def deepsleep(n=0):
if not n:
sys.exit(1)
else:
time.sleep_ms(n)
class Pin:
OUT = 0
IN = 1
def __init__(self, *args, **kwargs):
self._value = 0
...
def on(self):
return
def off(self):
return
def value(self, x=0):
self._value = x
return self._value
class I2C:
def __init__(self, *args, **kwargs):
...
class WDT:
def __init__(self, *args, **kwargs):
...
def feed(self):
return
class ADC:
ATTN_11DB = 0
def __init__(self, *args, **kwargs):
...
def atten(self, n):
return
def read(self):
return random.randint(1024, 2500)
def reset_cause():
return _RESET_CAUSE