Skip to content

Commit a8a3e56

Browse files
committed
make init seq raw
1 parent 6d448c2 commit a8a3e56

File tree

1 file changed

+93
-94
lines changed

1 file changed

+93
-94
lines changed

adafruit_vl53l4cd.py

Lines changed: 93 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -80,100 +80,99 @@ def __init__(self, i2c, address=41):
8080

8181
def _sensor_init(self):
8282
# pylint: disable=line-too-long
83-
init_seq = bytes(
84-
[ # value addr : description
85-
0x12, # 0x2d : set bit 2 and 5 to 1 for fast plus mode (1MHz I2C), else don't touch
86-
0x00, # 0x2e : bit 0 if I2C pulled up at 1.8V, else set bit 0 to 1 (pull up at AVDD)
87-
0x00, # 0x2f : bit 0 if GPIO pulled up at 1.8V, else set bit 0 to 1 (pull up at AVDD)
88-
0x11, # 0x30 : set bit 4 to 0 for active high interrupt and 1 for active low (bits 3:0 must be 0x1)
89-
0x02, # 0x31 : bit 1 = interrupt depending on the polarity
90-
0x00, # 0x32 : not user-modifiable
91-
0x02, # 0x33 : not user-modifiable
92-
0x08, # 0x34 : not user-modifiable
93-
0x00, # 0x35 : not user-modifiable
94-
0x08, # 0x36 : not user-modifiable
95-
0x10, # 0x37 : not user-modifiable
96-
0x01, # 0x38 : not user-modifiable
97-
0x01, # 0x39 : not user-modifiable
98-
0x00, # 0x3a : not user-modifiable
99-
0x00, # 0x3b : not user-modifiable
100-
0x00, # 0x3c : not user-modifiable
101-
0x00, # 0x3d : not user-modifiable
102-
0xFF, # 0x3e : not user-modifiable
103-
0x00, # 0x3f : not user-modifiable
104-
0x0F, # 0x40 : not user-modifiable
105-
0x00, # 0x41 : not user-modifiable
106-
0x00, # 0x42 : not user-modifiable
107-
0x00, # 0x43 : not user-modifiable
108-
0x00, # 0x44 : not user-modifiable
109-
0x00, # 0x45 : not user-modifiable
110-
0x20, # 0x46 : interrupt configuration 0->level low detection, 1-> level high, 2-> Out of window, 3->In window, 0x20-> New sample ready , TBC
111-
0x0B, # 0x47 : not user-modifiable
112-
0x00, # 0x48 : not user-modifiable
113-
0x00, # 0x49 : not user-modifiable
114-
0x02, # 0x4a : not user-modifiable
115-
0x14, # 0x4b : not user-modifiable
116-
0x21, # 0x4c : not user-modifiable
117-
0x00, # 0x4d : not user-modifiable
118-
0x00, # 0x4e : not user-modifiable
119-
0x05, # 0x4f : not user-modifiable
120-
0x00, # 0x50 : not user-modifiable
121-
0x00, # 0x51 : not user-modifiable
122-
0x00, # 0x52 : not user-modifiable
123-
0x00, # 0x53 : not user-modifiable
124-
0xC8, # 0x54 : not user-modifiable
125-
0x00, # 0x55 : not user-modifiable
126-
0x00, # 0x56 : not user-modifiable
127-
0x38, # 0x57 : not user-modifiable
128-
0xFF, # 0x58 : not user-modifiable
129-
0x01, # 0x59 : not user-modifiable
130-
0x00, # 0x5a : not user-modifiable
131-
0x08, # 0x5b : not user-modifiable
132-
0x00, # 0x5c : not user-modifiable
133-
0x00, # 0x5d : not user-modifiable
134-
0x01, # 0x5e : not user-modifiable
135-
0xCC, # 0x5f : not user-modifiable
136-
0x07, # 0x60 : not user-modifiable
137-
0x01, # 0x61 : not user-modifiable
138-
0xF1, # 0x62 : not user-modifiable
139-
0x05, # 0x63 : not user-modifiable
140-
0x00, # 0x64 : Sigma threshold MSB (mm in 14.2 format for MSB+LSB), default value 90 mm
141-
0xA0, # 0x65 : Sigma threshold LSB
142-
0x00, # 0x66 : Min count Rate MSB (MCPS in 9.7 format for MSB+LSB)
143-
0x80, # 0x67 : Min count Rate LSB
144-
0x08, # 0x68 : not user-modifiable
145-
0x38, # 0x69 : not user-modifiable
146-
0x00, # 0x6a : not user-modifiable
147-
0x00, # 0x6b : not user-modifiable
148-
0x00, # 0x6c : Intermeasurement period MSB, 32 bits register
149-
0x00, # 0x6d : Intermeasurement period
150-
0x0F, # 0x6e : Intermeasurement period
151-
0x89, # 0x6f : Intermeasurement period LSB
152-
0x00, # 0x70 : not user-modifiable
153-
0x00, # 0x71 : not user-modifiable
154-
0x00, # 0x72 : distance threshold high MSB (in mm, MSB+LSB)
155-
0x00, # 0x73 : distance threshold high LSB
156-
0x00, # 0x74 : distance threshold low MSB ( in mm, MSB+LSB)
157-
0x00, # 0x75 : distance threshold low LSB
158-
0x00, # 0x76 : not user-modifiable
159-
0x01, # 0x77 : not user-modifiable
160-
0x07, # 0x78 : not user-modifiable
161-
0x05, # 0x79 : not user-modifiable
162-
0x06, # 0x7a : not user-modifiable
163-
0x06, # 0x7b : not user-modifiable
164-
0x00, # 0x7c : not user-modifiable
165-
0x00, # 0x7d : not user-modifiable
166-
0x02, # 0x7e : not user-modifiable
167-
0xC7, # 0x7f : not user-modifiable
168-
0xFF, # 0x80 : not user-modifiable
169-
0x9B, # 0x81 : not user-modifiable
170-
0x00, # 0x82 : not user-modifiable
171-
0x00, # 0x83 : not user-modifiable
172-
0x00, # 0x84 : not user-modifiable
173-
0x01, # 0x85 : not user-modifiable
174-
0x00, # 0x86 : clear interrupt, 0x01=clear
175-
0x00, # 0x87 : ranging, 0x00=stop, 0x40=start
176-
]
83+
init_seq = (
84+
# value addr : description
85+
b"\x12" # 0x2d : set bit 2 and 5 to 1 for fast plus mode (1MHz I2C), else don't touch
86+
b"\x00" # 0x2e : bit 0 if I2C pulled up at 1.8V, else set bit 0 to 1 (pull up at AVDD)
87+
b"\x00" # 0x2f : bit 0 if GPIO pulled up at 1.8V, else set bit 0 to 1 (pull up at AVDD)
88+
b"\x11" # 0x30 : set bit 4 to 0 for active high interrupt and 1 for active low (bits 3:0 must be 0x1)
89+
b"\x02" # 0x31 : bit 1 = interrupt depending on the polarity
90+
b"\x00" # 0x32 : not user-modifiable
91+
b"\x02" # 0x33 : not user-modifiable
92+
b"\x08" # 0x34 : not user-modifiable
93+
b"\x00" # 0x35 : not user-modifiable
94+
b"\x08" # 0x36 : not user-modifiable
95+
b"\x10" # 0x37 : not user-modifiable
96+
b"\x01" # 0x38 : not user-modifiable
97+
b"\x01" # 0x39 : not user-modifiable
98+
b"\x00" # 0x3a : not user-modifiable
99+
b"\x00" # 0x3b : not user-modifiable
100+
b"\x00" # 0x3c : not user-modifiable
101+
b"\x00" # 0x3d : not user-modifiable
102+
b"\xFF" # 0x3e : not user-modifiable
103+
b"\x00" # 0x3f : not user-modifiable
104+
b"\x0F" # 0x40 : not user-modifiable
105+
b"\x00" # 0x41 : not user-modifiable
106+
b"\x00" # 0x42 : not user-modifiable
107+
b"\x00" # 0x43 : not user-modifiable
108+
b"\x00" # 0x44 : not user-modifiable
109+
b"\x00" # 0x45 : not user-modifiable
110+
b"\x20" # 0x46 : interrupt configuration 0->level low detection, 1-> level high, 2-> Out of window, 3->In window, 0x20-> New sample ready , TBC
111+
b"\x0B" # 0x47 : not user-modifiable
112+
b"\x00" # 0x48 : not user-modifiable
113+
b"\x00" # 0x49 : not user-modifiable
114+
b"\x02" # 0x4a : not user-modifiable
115+
b"\x14" # 0x4b : not user-modifiable
116+
b"\x21" # 0x4c : not user-modifiable
117+
b"\x00" # 0x4d : not user-modifiable
118+
b"\x00" # 0x4e : not user-modifiable
119+
b"\x05" # 0x4f : not user-modifiable
120+
b"\x00" # 0x50 : not user-modifiable
121+
b"\x00" # 0x51 : not user-modifiable
122+
b"\x00" # 0x52 : not user-modifiable
123+
b"\x00" # 0x53 : not user-modifiable
124+
b"\xC8" # 0x54 : not user-modifiable
125+
b"\x00" # 0x55 : not user-modifiable
126+
b"\x00" # 0x56 : not user-modifiable
127+
b"\x38" # 0x57 : not user-modifiable
128+
b"\xFF" # 0x58 : not user-modifiable
129+
b"\x01" # 0x59 : not user-modifiable
130+
b"\x00" # 0x5a : not user-modifiable
131+
b"\x08" # 0x5b : not user-modifiable
132+
b"\x00" # 0x5c : not user-modifiable
133+
b"\x00" # 0x5d : not user-modifiable
134+
b"\x01" # 0x5e : not user-modifiable
135+
b"\xCC" # 0x5f : not user-modifiable
136+
b"\x07" # 0x60 : not user-modifiable
137+
b"\x01" # 0x61 : not user-modifiable
138+
b"\xF1" # 0x62 : not user-modifiable
139+
b"\x05" # 0x63 : not user-modifiable
140+
b"\x00" # 0x64 : Sigma threshold MSB (mm in 14.2 format for MSB+LSB), default value 90 mm
141+
b"\xA0" # 0x65 : Sigma threshold LSB
142+
b"\x00" # 0x66 : Min count Rate MSB (MCPS in 9.7 format for MSB+LSB)
143+
b"\x80" # 0x67 : Min count Rate LSB
144+
b"\x08" # 0x68 : not user-modifiable
145+
b"\x38" # 0x69 : not user-modifiable
146+
b"\x00" # 0x6a : not user-modifiable
147+
b"\x00" # 0x6b : not user-modifiable
148+
b"\x00" # 0x6c : Intermeasurement period MSB, 32 bits register
149+
b"\x00" # 0x6d : Intermeasurement period
150+
b"\x0F" # 0x6e : Intermeasurement period
151+
b"\x89" # 0x6f : Intermeasurement period LSB
152+
b"\x00" # 0x70 : not user-modifiable
153+
b"\x00" # 0x71 : not user-modifiable
154+
b"\x00" # 0x72 : distance threshold high MSB (in mm, MSB+LSB)
155+
b"\x00" # 0x73 : distance threshold high LSB
156+
b"\x00" # 0x74 : distance threshold low MSB ( in mm, MSB+LSB)
157+
b"\x00" # 0x75 : distance threshold low LSB
158+
b"\x00" # 0x76 : not user-modifiable
159+
b"\x01" # 0x77 : not user-modifiable
160+
b"\x07" # 0x78 : not user-modifiable
161+
b"\x05" # 0x79 : not user-modifiable
162+
b"\x06" # 0x7a : not user-modifiable
163+
b"\x06" # 0x7b : not user-modifiable
164+
b"\x00" # 0x7c : not user-modifiable
165+
b"\x00" # 0x7d : not user-modifiable
166+
b"\x02" # 0x7e : not user-modifiable
167+
b"\xC7" # 0x7f : not user-modifiable
168+
b"\xFF" # 0x80 : not user-modifiable
169+
b"\x9B" # 0x81 : not user-modifiable
170+
b"\x00" # 0x82 : not user-modifiable
171+
b"\x00" # 0x83 : not user-modifiable
172+
b"\x00" # 0x84 : not user-modifiable
173+
b"\x01" # 0x85 : not user-modifiable
174+
b"\x00" # 0x86 : clear interrupt, 0x01=clear
175+
b"\x00" # 0x87 : ranging, 0x00=stop, 0x40=start
177176
)
178177
self._wait_for_boot()
179178
self._write_register(0x002D, init_seq)

0 commit comments

Comments
 (0)