Skip to content

Instantly share code, notes, and snippets.

@wyojustin
Created October 26, 2019 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wyojustin/86bbe0f529286e8ecb0b004edbf4536c to your computer and use it in GitHub Desktop.
Save wyojustin/86bbe0f529286e8ecb0b004edbf4536c to your computer and use it in GitHub Desktop.
NavKey Test Code
Write a value to the counter register... then read it back.
Write Read
0 00000000000000000000000000000000
1 00000000000000000000000000000000
2 10000000000000000000000000000000
3 01000000000000000000000000000000
4 11000000000000000000000000000000
5 00100000000000000000000000000000
6 10100000000000000000000000000000
7 01100000000000000000000000000000
8 11100000000000000000000000000000
9 00010000000000000000000000000000
10 10010000000000000000000000000000
11 01010000000000000000000000000000
12 11010000000000000000000000000000
13 00110000000000000000000000000000
14 10110000000000000000000000000000
15 01110000000000000000000000000000
16 11110000000000000000000000000000
17 00001000000000000000000000000000
18 10001000000000000000000000000000
19 01001000000000000000000000000000
20 11001000000000000000000000000000
21 00101000000000000000000000000000
22 10101000000000000000000000000000
23 01101000000000000000000000000000
24 11101000000000000000000000000000
25 00011000000000000000000000000000
26 10011000000000000000000000000000
27 01011000000000000000000000000000
28 11011000000000000000000000000000
29 00111000000000000000000000000000
30 10111000000000000000000000000000
31 01111000000000000000000000000000
32 11111000000000000000000000000000
33 00000100000000000000000000000000
34 10000100000000000000000000000000
35 01000100000000000000000000000000
36 11000100000000000000000000000000
37 00100100000000000000000000000000
38 10100100000000000000000000000000
39 01100100000000000000000000000000
40 11100100000000000000000000000000
41 00010100000000000000000000000000
42 10010100000000000000000000000000
43 01010100000000000000000000000000
44 11010100000000000000000000000000
45 00110100000000000000000000000000
46 10110100000000000000000000000000
47 01110100000000000000000000000000
48 11110100000000000000000000000000
49 00001100000000000000000000000000
50 10001100000000000000000000000000
51 01001100000000000000000000000000
52 11001100000000000000000000000000
53 00101100000000000000000000000000
54 10101100000000000000000000000000
55 01101100000000000000000000000000
56 11101100000000000000000000000000
57 00011100000000000000000000000000
58 10011100000000000000000000000000
59 01011100000000000000000000000000
60 11011100000000000000000000000000
61 00111100000000000000000000000000
62 10111100000000000000000000000000
63 01111100000000000000000000000000
64 11111100000000000000000000000000
65 00000010000000010000000000000000
66 10000010000000010000000000000000
67 01000010000000010000000000000000
68 11000010000000010000000000000000
69 00100010000000010000000000000000
70 10100010000000010000000000000000
71 01100010000000010000000000000000
72 11100010000000010000000000000000
73 00010010000000010000000000000000
74 10010010000000010000000000000000
75 01010010000000010000000000000000
76 11010010000000010000000000000000
77 00110010000000010000000000000000
78 10110010000000010000000000000000
79 01110010000000010000000000000000
80 11110010000000010000000000000000
81 00001010000000010000000000000000
82 10001010000000010000000000000000
83 01001010000000010000000000000000
84 11001010000000010000000000000000
85 00101010000000010000000000000000
86 10101010000000010000000000000000
87 01101010000000010000000000000000
88 11101010000000010000000000000000
89 00011010000000010000000000000000
90 10011010000000010000000000000000
91 01011010000000010000000000000000
92 11011010000000010000000000000000
93 00111010000000010000000000000000
94 10111010000000010000000000000000
95 01111010000000010000000000000000
96 11111010000000010000000000000000
97 00000110000000010000000000000000
98 10000110000000010000000000000000
99 01000110000000010000000000000000
100 11000110000000010000000000000000
101 00100110000000010000000000000000
102 10100110000000010000000000000000
103 01100110000000010000000000000000
104 11100110000000010000000000000000
105 00010110000000010000000000000000
106 10010110000000010000000000000000
107 01010110000000010000000000000000
108 11010110000000010000000000000000
109 00110110000000010000000000000000
110 10110110000000010000000000000000
111 01110110000000010000000000000000
112 11110110000000010000000000000000
113 00001110000000010000000000000000
114 10001110000000010000000000000000
115 01001110000000010000000000000000
116 11001110000000010000000000000000
117 00101110000000010000000000000000
118 10101110000000010000000000000000
119 01101110000000010000000000000000
120 11101110000000010000000000000000
121 00011110000000010000000000000000
122 10011110000000010000000000000000
123 01011110000000010000000000000000
124 11011110000000010000000000000000
125 00111110000000010000000000000000
126 10111110000000010000000000000000
127 01111110000000010000000000000000
128 11111110000000010000000000000000
129 00000000000000000000000000000000
130 10000000000000000000000000000000
131 01000000000000000000000000000000
132 11000000000000000000000000000000
133 00100000000000000000000000000000
134 10100000000000000000000000000000
135 01100000000000000000000000000000
136 11100000000000000000000000000000
137 00010000000000000000000000000000
138 10010000000000000000000000000000
139 01010000000000000000000000000000
140 11010000000000000000000000000000
141 00110000000000000000000000000000
142 10110000000000000000000000000000
143 01110000000000000000000000000000
144 11110000000000000000000000000000
145 00001000000000000000000000000000
146 10001000000000000000000000000000
147 01001000000000000000000000000000
148 11001000000000000000000000000000
149 00101000000000000000000000000000
150 10101000000000000000000000000000
151 01101000000000000000000000000000
152 11101000000000000000000000000000
153 00011000000000000000000000000000
154 10011000000000000000000000000000
155 01011000000000000000000000000000
156 11011000000000000000000000000000
157 00111000000000000000000000000000
158 10111000000000000000000000000000
159 01111000000000000000000000000000
160 11111000000000000000000000000000
161 00000100000000000000000000000000
162 10000100000000000000000000000000
163 01000100000000000000000000000000
164 11000100000000000000000000000000
165 00100100000000000000000000000000
166 10100100000000000000000000000000
167 01100100000000000000000000000000
168 11100100000000000000000000000000
169 00010100000000000000000000000000
170 10010100000000000000000000000000
171 01010100000000000000000000000000
172 11010100000000000000000000000000
173 00110100000000000000000000000000
174 10110100000000000000000000000000
175 01110100000000000000000000000000
176 11110100000000000000000000000000
177 00001100000000000000000000000000
178 10001100000000000000000000000000
179 01001100000000000000000000000000
180 11001100000000000000000000000000
181 00101100000000000000000000000000
182 10101100000000000000000000000000
183 01101100000000000000000000000000
184 11101100000000000000000000000000
185 00011100000000000000000000000000
186 10011100000000000000000000000000
187 01011100000000000000000000000000
188 11011100000000000000000000000000
189 00111100000000000000000000000000
190 10111100000000000000000000000000
191 01111100000000000000000000000000
192 11111100000000000000000000000000
193 00000010000000010000000000000000
194 10000010000000010000000000000000
195 01000010000000010000000000000000
196 11000010000000010000000000000000
197 00100010000000010000000000000000
198 10100010000000010000000000000000
199 01100010000000010000000000000000
200 11100010000000010000000000000000
201 00010010000000010000000000000000
202 10010010000000010000000000000000
203 01010010000000010000000000000000
204 11010010000000010000000000000000
205 00110010000000010000000000000000
206 10110010000000010000000000000000
207 01110010000000010000000000000000
208 11110010000000010000000000000000
209 00001010000000010000000000000000
210 10001010000000010000000000000000
211 01001010000000010000000000000000
212 11001010000000010000000000000000
213 00101010000000010000000000000000
214 10101010000000010000000000000000
215 01101010000000010000000000000000
216 11101010000000010000000000000000
217 00011010000000010000000000000000
218 10011010000000010000000000000000
219 01011010000000010000000000000000
220 11011010000000010000000000000000
221 00111010000000010000000000000000
222 10111011000000010000000000000000
223 01111010000000010000000000000000
224 11111010000000010000000000000000
225 00000110000000010000000000000000
226 10000110000000010000000000000000
227 01000110000000010000000000000000
228 11000110000000010000000000000000
229 00100110000000010000000000000000
230 10100110000000010000000000000000
231 01100110000000010000000000000000
232 11100110000000010000000000000000
233 00010110000000010000000000000000
234 10010110000000010000000000000000
235 01010110000000010000000000000000
236 11010110000000010000000000000000
237 00110110000000010000000000000000
238 10110110000000010000000000000000
239 01110110000000010000000000000000
240 11110110000000010000000000000000
241 00001110000000010000000000000000
242 10001110000000010000000000000000
243 01001110000000010000000000000000
244 11001110000000010000000000000000
245 00101110000000010000000000000000
246 10101110000000010000000000000000
247 01101110000000010000000000000000
248 11101110000000010000000000000000
249 00011110000000010000000000000000
250 10011110000000010000000000000000
251 01011110000000010000000000000000
252 11011110000000010000000000000000
253 00111110000000010000000000000000
254 10111110000000010000000000000000
255 01111110000000010000000000000000
256 11111110000000010000000000000000
257 00000000000000000000000000000000
258 10000000000000000000000000000000
259 01000000000000000000000000000000
260 11000000000000000000000000000000
261 00100000000000000000000000000000
262 10100000000000000000000000000000
263 01100000000000000000000000000000
264 11100000000000000000000000000000
265 00010000000000000000000000000000
266 10010000000000000000000000000000
267 01010000000000000000000000000000
268 11010000000000000000000000000000
269 00110000000000000000000000000000
270 10110000000000000000000000000000
271 01110000000000000000000000000000
272 11110000000000000000000000000000
273 00001000000000000000000000000000
274 10001000000000000000000000000000
275 01001000000000000000000000000000
276 11001000000000000000000000000000
277 00101000000000000000000000000000
278 10101000000000000000000000000000
279 01101000000000000000000000000000
280 11101000000000000000000000000000
281 00011000000000000000000000000000
282 10011000000000000000000000000000
283 01011000000000000000000000000000
284 11011000000000000000000000000000
285 00111000000000000000000000000000
286 10111000000000000000000000000000
287 01111000000000000000000000000000
288 11111000000000000000000000000000
289 00000100000000000000000000000000
290 10000100000000000000000000000000
291 01000100000000000000000000000000
292 11000100000000000000000000000000
293 00100100000000000000000000000000
294 10100100000000000000000000000000
295 01100100000000000000000000000000
296 11100100000000000000000000000000
297 00010100000000000000000000000000
298 10010100000000000000000000000000
299 01010100000000000000000000000000
300 11010100000000000000000000000000
301 00110100000000000000000000000000
302 10110100000000000000000000000000
303 01110100000000000000000000000000
304 11110100000000000000000000000000
305 00001100000000000000000000000000
306 10001100000000000000000000000000
307 01001100000000000000000000000000
308 11001100000000000000000000000000
309 00101100000000000000000000000000
310 10101100000000000000000000000000
311 01101100000000000000000000000000
312 11101100000000000000000000000000
313 00011100000000000000000000000000
314 10011100000000000000000000000000
315 01011100000000000000000000000000
316 11011100000000000000000000000000
317 00111100000000000000000000000000
318 10111100000000000000000000000000
319 01111100000000000000000000000000
320 11111100000000000000000000000000
321 00000010000000010000000000000000
322 10000010000000010000000000000000
323 01000010000000010000000000000000
324 11000010000000010000000000000000
325 00100010000000010000000000000000
326 10100010000000010000000000000000
327 01100010000000010000000000000000
328 11100010000000010000000000000000
329 00010010000000010000000000000000
330 10010010000000010000000000000000
331 01010010000000010000000000000000
332 11010010000000010000000000000000
333 00110010000000010000000000000000
334 10110010000000010000000000000000
335 01110010000000010000000000000000
336 11110010000000010000000000000000
337 00001010000000010000000000000000
338 10001010000000010000000000000000
339 01001010000000010000000000000000
340 11001010000000010000000000000000
341 00101010000000010000000000000000
342 10101010000000010000000000000000
343 01101010000000010000000000000000
344 11101010000000010000000000000000
345 00011010000000010000000000000000
346 10011010000000010000000000000000
347 01011010000000010000000000000000
348 11011010000000010000000000000000
349 00111010000000010000000000000000
350 10111010000000010000000000000000
351 01111010000000010000000000000000
352 11111010000000010000000000000000
353 00000110000000010000000000000000
354 10000110000000010000000000000000
355 01000110000000010000000000000000
356 11000110000000010000000000000000
357 00100110000000010000000000000000
358 10100110000000010000000000000000
359 01100110000000010000000000000000
360 11100110000000010000000000000000
361 00010110000000010000000000000000
362 10010110000000010000000000000000
363 01010110000000010000000000000000
364 11010110000000010000000000000000
365 00110110000000010000000000000000
366 10110110000000010000000000000000
367 01110110000000010000000000000000
368 11110110000000010000000000000000
369 00001110000000010000000000000000
370 10001110000000010000000000000000
371 01001110000000010000000000000000
372 11001110000000010000000000000000
373 00101110000000010000000000000000
374 10101110000000010000000000000000
375 01101110000000010000000000000000
376 11101110000000010000000000000000
377 00011110000000010000000000000000
378 10011110000000010000000000000000
379 01011110000000010000000000000000
380 11011110000000010000000000000000
381 00111110000000010000000000000000
382 10111110000000010000000000000000
383 01111110000000010000000000000000
384 11111110000000010000000000000000
385 00000000000000000000000000000000
386 10000000000000000000000000000000
387 01000000000000000000000000000000
388 11000000000000000000000000000000
389 00100000000000000000000000000000
390 10100000000000000000000000000000
391 01100000000000000000000000000000
392 11100000000000000000000000000000
393 00010000000000000000000000000000
394 10010000000000000000000000000000
395 01010000000000000000000000000000
396 11010000000000000000000000000000
397 00110000000000000000000000000000
398 10110000000000000000000000000000
399 01110000000000000000000000000000
400 11110000000000000000000000000000
401 00001000000000000000000000000000
402 10001000000000000000000000000000
403 01001000000000000000000000000000
404 11001000000000000000000000000000
405 00101000000000000000000000000000
406 10101000000000000000000000000000
407 01101000000000000000000000000000
408 11101000000000000000000000000000
409 00011000000000000000000000000000
410 10011000000000000000000000000000
411 01011000000000000000000000000000
412 11011000000000000000000000000000
413 00111000000000000000000000000000
414 10111000000000000000000000000000
415 01111000000000000000000000000000
416 11111000000000000000000000000000
417 00000100000000000000000000000000
418 10000100000000000000000000000000
419 01000100000000000000000000000000
420 11000100000000000000000000000000
421 00100100000000000000000000000000
422 10100100000000000000000000000000
423 01100100000000000000000000000000
424 11100100000000000000000000000000
425 00010100000000000000000000000000
426 10010100000000000000000000000000
427 01010100000000000000000000000000
428 11010100000000000000000000000000
429 00110100000000000000000000000000
430 10110100000000000000000000000000
431 01110100000000000000000000000000
432 11110100000000000000000000000000
433 00001100000000000000000000000000
434 10001100000000000000000000000000
435 01001100000000000000000000000000
436 11001100000000000000000000000000
437 00101100000000000000000000000000
438 10101100000000000000000000000000
439 01101100000000000000000000000000
440 11101100000000000000000000000000
441 00011100000000000000000000000000
442 10011100000000000000000000000000
443 01011100000000000000000000000000
444 11011100000000000000000000000000
445 00111100000000000000000000000000
446 10111100000000000000000000000000
447 01111100000000000000000000000000
448 11111100000000000000000000000000
449 00000010000000010000000000000000
450 10000010000000010000000000000000
451 01000010000000010000000000000000
452 11000010000000010000000000000000
453 00100010000000010000000000000000
454 10100010000000010000000000000000
455 01100010000000010000000000000000
456 11100010000000010000000000000000
457 00010010000000010000000000000000
458 10010010000000010000000000000000
459 01010010000000010000000000000000
460 11010010000000010000000000000000
461 00110010000000010000000000000000
462 10110010000000010000000000000000
463 01110010000000010000000000000000
464 11110010000000010000000000000000
465 00001010000000010000000000000000
466 10001010000000010000000000000000
467 01001010000000010000000000000000
468 11001010000000010000000000000000
469 00101010000000010000000000000000
470 10101010000000010000000000000000
471 01101010000000010000000000000000
472 11101010000000010000000000000000
473 00011010000000010000000000000000
474 10011010000000010000000000000000
475 01011010000000010000000000000000
476 11011010000000010000000000000000
477 00111010000000010000000000000000
478 10111010000000010000000000000000
479 01111010000000010000000000000000
480 11111010000000010000000000000000
481 00000110000000010000000000000000
482 10000110000000010000000000000000
483 01000110000000010000000000000000
484 11000110000000010000000000000000
485 00100110000000010000000000000000
486 10100110000000010000000000000000
487 01100110000000010000000000000000
488 11100110000000010000000000000000
489 00010110000000010000000000000000
490 10010110000000010000000000000000
491 01010110000000010000000000000000
492 11010110000000010000000000000000
493 00110110000000010000000000000000
494 10110110000000010000000000000000
495 01110110000000010000000000000000
496 11110110000000010000000000000000
497 00001110000000010000000000000000
498 10001110000000010000000000000000
499 01001110000000010000000000000000
500 11001110000000010000000000000000
501 00101110000000010000000000000000
502 10101110000000010000000000000000
503 01101110000000010000000000000000
504 11101110000000010000000000000000
505 00011110000000010000000000000000
506 10011110000000010000000000000000
507 01011110000000010000000000000000
508 11011110000000010000000000000000
509 00111110000000010000000000000000
510 10111110000000010000000000000000
511 01111110000000010000000000000000
512 11111110000000010000000000000000
513 00000000000000000000000000000000
514 10000000000000000000000000000000
515 01000000000000000000000000000000
516 11000000000000000000000000000000
517 00100000000000000000000000000000
518 10100000000000000000000000000000
519 01100000000000000000000000000000
520 11100000000000000000000000000000
521 00010000000000000000000000000000
522 10010000000000000000000000000000
523 01010000000000000000000000000000
524 11010000000000000000000000000000
525 00110000000000000000000000000000
526 10110000000000000000000000000000
527 01110000000000000000000000000000
528 11110000000000000000000000000000
529 00001000000000000000000000000000
530 10001000000000000000000000000000
531 01001000000000000000000000000000
532 11001000000000000000000000000000
533 00101000000000000000000000000000
534 10101000000000000000000000000000
535 01101000000000000000000000000000
536 11101000000000000000000000000000
537 00011000000000000000000000000000
538 10011000000000000000000000000000
539 01011000000000000000000000000000
540 11011000000000000000000000000000
541 00111000000000000000000000000000
542 10111000000000000000000000000000
543 01111000000000000000000000000000
544 11111000000000000000000000000000
545 00000100000000000000000000000000
546 10000100000000000000000000000000
547 01000100000000000000000000000000
548 11000100000000000000000000000000
549 00100100000000000000000000000000
550 10100100000000000000000000000000
551 01100100000000000000000000000000
552 11100100000000000000000000000000
553 00010100000000000000000000000000
554 10010100000000000000000000000000
555 01010100000000000000000000000000
556 11010100000000000000000000000000
557 00110100000000000000000000000000
558 10110100000000000000000000000000
559 01110100000000000000000000000000
560 11110100000000000000000000000000
561 00001100000000000000000000000000
562 10001100000000000000000000000000
563 01001100000000000000000000000000
564 11001100000000000000000000000000
565 00101100000000000000000000000000
566 10101100000000000000000000000000
567 01101100000000000000000000000000
568 11101100000000000000000000000000
569 00011100000000000000000000000000
570 10011100000000000000000000000000
571 01011100000000000000000000000000
572 11011100000000000000000000000000
573 00111100000000000000000000000000
574 10111100000000000000000000000000
575 01111100000000000000000000000000
576 11111100000000000000000000000000
577 00000010000000010000000000000000
578 10000010000000010000000000000000
579 01000010000000010000000000000000
580 11000010000000010000000000000000
581 00100010000000010000000000000000
582 10100010000000010000000000000000
583 01100010000000010000000000000000
584 11100010000000010000000000000000
585 00010010000000010000000000000000
586 10010010000000010000000000000000
587 01010010000000010000000000000000
588 11010010000000010000000000000000
589 00110010000000010000000000000000
590 10110010000000010000000000000000
591 01110010000000010000000000000000
592 11110010000000010000000000000000
593 00001010000000010000000000000000
594 10001010000000010000000000000000
595 01001010000000010000000000000000
596 11001010000000010000000000000000
597 00101010000000010000000000000000
598 10101010000000010000000000000000
599 01101010000000010000000000000000
600 11101010000000010000000000000000
601 00011010000000010000000000000000
602 10011010000000010000000000000000
603 01011010000000010000000000000000
604 11011010000000010000000000000000
605 00111010000000010000000000000000
606 10111010000000010000000000000000
607 01111010000000010000000000000000
608 11111010000000010000000000000000
609 00000110000000010000000000000000
610 10000110000000010000000000000000
611 01000110000000010000000000000000
612 11000110000000010000000000000000
613 00100110000000010000000000000000
614 10100110000000010000000000000000
615 01100110000000010000000000000000
616 11100110000000010000000000000000
617 00010110000000010000000000000000
618 10010110000000010000000000000000
619 01010110000000010000000000000000
620 11010110000000010000000000000000
621 00110110000000010000000000000000
622 10110110000000010000000000000000
623 01110110000000010000000000000000
624 11110110000000010000000000000000
625 00001110000000010000000000000000
626 10001110000000010000000000000000
627 01001110000000010000000000000000
628 11001110000000010000000000000000
629 00101110000000010000000000000000
630 10101110000000010000000000000000
631 01101110000000010000000000000000
632 11101110000000010000000000000000
633 00011110000000010000000000000000
634 10011110000000010000000000000000
635 01011110000000010000000000000000
636 11011110000000010000000000000000
637 00111110000000010000000000000000
638 10111110000000010000000000000000
639 01111110000000010000000000000000
640 11111110000000010000000000000000
641 00000000000000000000000000000000
642 10000000000000000000000000000000
643 01000000000000000000000000000000
644 11000000000000000000000000000000
645 00100000000000000000000000000000
646 10100000000000000000000000000000
647 01100000000000000000000000000000
648 11100000000000000000000000000000
649 00010000000000000000000000000000
650 10010000000000000000000000000000
651 01010000000000000000000000000000
652 11010000000000000000000000000000
653 00110000000000000000000000000000
654 10110000000000000000000000000000
655 01110000000000000000000000000000
656 11110000000000000000000000000000
657 00001000000000000000000000000000
658 10001000000000000000000000000000
659 01001000000000000000000000000000
660 11001000000000000000000000000000
661 00101000000000000000000000000000
662 10101000000000000000000000000000
663 01101000000000000000000000000000
664 11101000000000000000000000000000
665 00011000000000000000000000000000
666 10011000000000000000000000000000
667 01011000000000000000000000000000
668 11011000000000000000000000000000
669 00111000000000000000000000000000
670 10111000000000000000000000000000
671 01111000000000000000000000000000
672 11111000000000000000000000000000
673 00000100000000000000000000000000
674 10000100000000000000000000000000
675 01000100000000000000000000000000
676 11000100000000000000000000000000
677 00100100000000000000000000000000
678 10100100000000000000000000000000
679 01100100000000000000000000000000
680 11100100000000000000000000000000
681 00010100000000000000000000000000
682 10010100000000000000000000000000
683 01010100000000000000000000000000
684 11010100000000000000000000000000
685 00110100000000000000000000000000
686 10110100000000000000000000000000
687 01110100000000000000000000000000
688 11110100000000000000000000000000
689 00001100000000000000000000000000
690 10001100000000000000000000000000
691 01001100000000000000000000000000
692 11001100000000000000000000000000
693 00101100000000000000000000000000
694 10101100000000000000000000000000
695 01101100000000000000000000000000
696 11101100000000000000000000000000
697 00011100000000000000000000000000
698 10011100000000000000000000000000
699 01011100000000000000000000000000
700 11011100000000000000000000000000
701 00111100000000000000000000000000
702 10111100000000000000000000000000
703 01111100000000000000000000000000
704 11111100000000000000000000000000
705 00000010000000010000000000000000
706 10000010000000010000000000000000
707 01000010000000010000000000000000
708 11000010000000010000000000000000
709 00100010000000010000000000000000
710 10100010000000010000000000000000
711 01100010000000010000000000000000
712 11100010000000010000000000000000
713 00010010000000010000000000000000
714 10010010000000010000000000000000
715 01010010000000010000000000000000
716 11010010000000010000000000000000
717 00110010000000010000000000000000
718 10110010000000010000000000000000
719 01110010000000010000000000000000
720 11110010000000010000000000000000
721 00001010000000010000000000000000
722 10001010000000010000000000000000
723 01001010000000010000000000000000
724 11001010000000010000000000000000
725 00101010000000010000000000000000
726 10101010000000010000000000000000
727 01101010000000010000000000000000
728 11101010000000010000000000000000
729 00011010000000010000000000000000
730 10011010000000010000000000000000
731 01011010000000010000000000000000
732 11011010000000010000000000000000
733 00111010000000010000000000000000
734 10111010000000010000000000000000
735 01111010000000010000000000000000
736 11111010000000010000000000000000
737 00000110000000010000000000000000
738 10000110000000010000000000000000
739 01000110000000010000000000000000
740 11000110000000010000000000000000
741 00100110000000010000000000000000
742 10100110000000010000000000000000
743 01100110000000010000000000000000
744 11100110000000010000000000000000
745 00010110000000010000000000000000
746 10010110000000010000000000000000
747 01010110000000010000000000000000
748 11010110000000010000000000000000
749 00110110000000010000000000000000
750 10110110000000010000000000000000
751 01110110000000010000000000000000
752 11110110000000010000000000000000
753 00001110000000010000000000000000
754 10001110000000010000000000000000
755 01001110000000010000000000000000
756 11001110000000010000000000000000
757 00101110000000010000000000000000
758 10101110000000010000000000000000
759 01101110000000010000000000000000
760 11101110000000010000000000000000
761 00011110000000010000000000000000
762 10011110000000010000000000000000
763 01011110000000010000000000000000
764 11011110000000010000000000000000
765 00111110000000010000000000000000
766 10111110000000010000000000000000
767 01111110000000010000000000000000
768 11111110000000010000000000000000
769 00000000000000000000000000000000
770 10000000000000000000000000000000
771 01000000000000000000000000000000
772 11000000000000000000000000000000
773 00100000000000000000000000000000
774 10100000000000000000000000000000
775 01100000000000000000000000000000
776 11100000000000000000000000000000
777 00010000000000000000000000000000
778 10010000000000000000000000000000
779 01010000000000000000000000000000
780 11010000000000000000000000000000
781 00110000000000000000000000000000
782 10110000000000000000000000000000
783 01110000000000000000000000000000
784 11110000000000000000000000000000
785 00001000000000000000000000000000
786 10001000000000000000000000000000
787 01001000000000000000000000000000
788 11001000000000000000000000000000
789 00101000000000000000000000000000
790 10101000000000000000000000000000
791 01101000000000000000000000000000
792 11101000000000000000000000000000
793 00011000000000000000000000000000
794 10011000000000000000000000000000
795 01011000000000000000000000000000
796 11011000000000000000000000000000
797 00111000000000000000000000000000
798 10111000000000000000000000000000
799 01111000000000000000000000000000
800 11111000000000000000000000000000
801 00000100000000000000000000000000
802 10000100000000000000000000000000
803 01000100000000000000000000000000
804 11000100000000000000000000000000
805 00100100000000000000000000000000
806 10100100000000000000000000000000
807 01100100000000000000000000000000
808 11100100000000000000000000000000
809 00010100000000000000000000000000
810 10010100000000000000000000000000
811 01010100000000000000000000000000
812 11010100000000000000000000000000
813 00110100000000000000000000000000
814 10110100000000000000000000000000
815 01110100000000000000000000000000
816 11110100000000000000000000000000
817 00001100000000000000000000000000
818 10001100000000000000000000000000
819 01001100000000000000000000000000
820 11001100000000000000000000000000
821 00101100000000000000000000000000
822 10101100000000000000000000000000
823 01101100000000000000000000000000
824 11101100000000000000000000000000
825 00011100000000000000000000000000
826 10011100000000000000000000000000
827 01011100000000000000000000000000
828 11011100000000000000000000000000
829 00111100000000000000000000000000
830 10111100000000000000000000000000
831 01111100000000000000000000000000
832 11111100000000000000000000000000
833 00000010000000010000000000000000
834 10000010000000010000000000000000
835 01000010000000010000000000000000
836 11000010000000010000000000000000
837 00100010000000010000000000000000
838 10100010000000010000000000000000
839 01100010000000010000000000000000
840 11100010000000010000000000000000
841 00010010000000010000000000000000
842 10010010000000010000000000000000
843 01010010000000010000000000000000
844 11010010000000010000000000000000
845 00110010000000010000000000000000
846 10110010000000010000000000000000
847 01110010000000010000000000000000
848 11110010000000010000000000000000
849 00001010000000010000000000000000
850 10001010000000010000000000000000
851 01001010000000010000000000000000
852 11001010000000010000000000000000
853 00101010000000010000000000000000
854 10101010000000010000000000000000
855 01101010000000010000000000000000
856 11101010000000010000000000000000
857 00011010000000010000000000000000
858 10011010000000010000000000000000
859 01011010000000010000000000000000
860 11011010000000010000000000000000
861 00111010000000010000000000000000
862 10111010000000010000000000000000
863 01111010000000010000000000000000
864 11111010000000010000000000000000
865 00000110000000010000000000000000
866 10000110000000010000000000000000
867 01000110000000010000000000000000
868 11000110000000010000000000000000
869 00100110000000010000000000000000
870 10100110000000010000000000000000
871 01100110000000010000000000000000
872 11100110000000010000000000000000
873 00010110000000010000000000000000
874 10010110000000010000000000000000
875 01010110000000010000000000000000
876 11010110000000010000000000000000
877 00110110000000010000000000000000
878 10110110000000010000000000000000
879 01110110000000010000000000000000
880 11110110000000010000000000000000
881 00001110000000010000000000000000
882 10001110000000010000000000000000
883 01001110000000010000000000000000
884 11001110000000010000000000000000
885 00101110000000010000000000000000
886 10101110000000010000000000000000
887 01101110000000010000000000000000
888 11101110000000010000000000000000
889 00011110000000010000000000000000
890 10011110000000010000000000000000
891 01011110000000010000000000000000
892 11011110000000010000000000000000
893 00111110000000010000000000000000
894 10111110000000010000000000000000
895 01111110000000010000000000000000
896 11111110000000010000000000000000
897 00000000000000000000000000000000
898 10000000000000000000000000000000
899 01000000000000000000000000000000
900 11000000000000000000000000000000
901 00100000000000000000000000000000
902 10100000000000000000000000000000
903 01100000000000000000000000000000
904 11100000000000000000000000000000
905 00010000000000000000000000000000
906 10010000000000000000000000000000
907 01010000000000000000000000000000
908 11010000000000000000000000000000
909 00110000000000000000000000000000
910 10110000000000000000000000000000
911 01110000000000000000000000000000
912 11110000000000000000000000000000
913 00001000000000000000000000000000
914 10001000000000000000000000000000
915 01001000000000000000000000000000
916 11001000000000000000000000000000
917 00101000000000000000000000000000
918 10101000000000000000000000000000
919 01101000000000000000000000000000
920 11101000000000000000000000000000
921 00011000000000000000000000000000
922 10011000000000000000000000000000
923 01011000000000000000000000000000
924 11011000000000000000000000000000
925 00111001000000000000000000000000
926 10111000000000000000000000000000
927 01111000000000000000000000000000
928 11111000000000000000000000000000
929 00000100000000000000000000000000
930 10000100000000000000000000000000
931 01000100000000000000000000000000
932 11000100000000000000000000000000
933 00100100000000000000000000000000
934 10100100000000000000000000000000
935 01100100000000000000000000000000
936 11100100000000000000000000000000
937 00010100000000000000000000000000
938 10010100000000000000000000000000
939 01010100000000000000000000000000
940 11010100000000000000000000000000
941 00110100000000000000000000000000
942 10110100000000000000000000000000
943 01110100000000000000000000000000
944 11110100000000000000000000000000
945 00001100000000000000000000000000
946 10001100000000000000000000000000
947 01001100000000000000000000000000
948 11001100000000000000000000000000
949 00101100000000000000000000000000
950 10101100000000000000000000000000
951 01101100000000000000000000000000
952 11101100000000000000000000000000
953 00011101000000000000000000000000
954 10011100000000000000000000000000
955 01011100000000000000000000000000
956 11011100000000000000000000000000
957 00111100000000000000000000000000
958 10111100000000000000000000000000
959 01111100000000000000000000000000
960 11111100000000000000000000000000
961 00000010000000010000000000000000
962 10000010000000010000000000000000
963 01000010000000010000000000000000
964 11000010000000010000000000000000
965 00100010000000010000000000000000
966 10100010000000010000000000000000
967 01100010000000010000000000000000
968 11100010000000010000000000000000
969 00010010000000010000000000000000
970 10010010000000010000000000000000
971 01010010000000010000000000000000
972 11010010000000010000000000000000
973 00110010000000010000000000000000
974 10110010000000010000000000000000
975 01110010000000010000000000000000
976 11110010000000010000000000000000
977 00001010000000010000000000000000
978 10001010000000010000000000000000
979 01001010000000010000000000000000
980 11001010000000010000000000000000
981 00101010000000010000000000000000
982 10101010000000010000000000000000
983 01101010000000010000000000000000
984 11101010000000010000000000000000
985 00011010000000010000000000000000
986 10011010000000010000000000000000
987 01011010000000010000000000000000
988 11011010000000010000000000000000
989 00111010000000010000000000000000
990 10111010000000010000000000000000
991 01111010000000010000000000000000
992 11111010000000010000000000000000
993 00000110000000010000000000000000
994 10000110000000010000000000000000
995 01000110000000010000000000000000
996 11000110000000010000000000000000
997 00100110000000010000000000000000
998 10100110000000010000000000000000
999 01100110000000010000000000000000
1000 11100110000000010000000000000000
1001 00010110000000010000000000000000
1002 10010110000000010000000000000000
1003 01010110000000010000000000000000
1004 11010110000000010000000000000000
1005 00110110000000010000000000000000
1006 10110110000000010000000000000000
1007 01110110000000010000000000000000
1008 11110110000000010000000000000000
1009 00001110000000010000000000000000
1010 10001110000000010000000000000000
1011 01001110000000010000000000000000
1012 11001110000000010000000000000000
1013 00101110000000010000000000000000
1014 10101110000000010000000000000000
1015 01101110000000010000000000000000
1016 11101110000000010000000000000000
1017 00011110000000010000000000000000
1018 10011110000000010000000000000000
1019 01011110000000010000000000000000
1020 11011110000000010000000000000000
1021 00111110000000010000000000000000
1022 10111110000000010000000000000000
import time
import smbus2
I2C = smbus2.SMBus(1)
NAVKEY_ADDR = 0x10
FLOAT_DATA = 0x01
INT_DATA = 0x00
WRAP_ENABLE = 0x02
WRAP_DISABLE = 0x00
DIRE_LEFT = 0x04
DIRE_RIGHT = 0x00
IPUP_DISABLE = 0x08
IPUP_ENABLE = 0x00
CLK_STRECH_ENABLE = 0x10
CLK_STRECH_DISABLE = 0x00
EEPROM_BANK1 = 0x20
EEPROM_BANK2 = 0x00
RESET = 0x80
REG_GCONF = 0x00
REG_GP1CONF = 0x01
REG_GP2CONF = 0x02
REG_GP3CONF = 0x03
REG_INTCONFB2 = 0x04
REG_INTCONFB1 = 0x05
REG_STATUSB2 = 0x06
REG_STATUSB1 = 0x07
REG_SSTATUS = 0x08
REG_FSTATUS = 0x09
REG_CVALB4 = 0x0A
REG_CVALB3 = 0x0B
REG_CVALB2 = 0x0C
REG_CVALB1 = 0x0D
REG_CMAXB4 = 0x0E
REG_CMAXB3 = 0x0F
REG_CMAXB2 = 0x10
REG_CMAXB1 = 0x11
REG_CMINB4 = 0x12
REG_CMINB3 = 0x13
REG_CMINB2 = 0x14
REG_CMINB1 = 0x15
REG_ISTEPB4 = 0x16
REG_ISTEPB3 = 0x17
REG_ISTEPB2 = 0x18
REG_ISTEPB1 = 0x19
REG_GP1REG = 0x1A
REG_GP2REG = 0x1B
REG_GP3REG = 0x1C
REG_DPPERIOD = 0x1D
REG_FADEGP = 0x1E
REG_GAMMAGP1 = 0x1F
REG_GAMMAGP2 = 0x20
REG_GAMMAGP3 = 0x21
REG_IDCODE = 0x70
REG_VERSION = 0x71
REG_EEPROMS = 0x80
def byte2bin(b):
out = ''
for i in range(8):
out += str((b >> i) & 1)
return out
def bytes2bin(bytes):
out = ''
for b in bytes:
out += byte2bin(b)
return out
class NavKey:
def __init__(self, addr):
self.addr = addr
conf = INT_DATA | WRAP_ENABLE | DIRE_RIGHT | IPUP_ENABLE
self.writeNavKey(REG_GCONF, conf);
self.writeCounter(0); #/* Reset the counter value */
self.writeMin(0); #/* Set the minimum threshold */
self.writeMax(255000); #/* Set the maximum threshold*/
self.writeStep(1); #/* Set the step to 1*/
self.autoconfigInterrupt(); #/* Enable the interrupt with the attached callback */
# /** Check if there is some attached callback and enable the corresponding interrupt **/
def autoconfigInterrupt(self):
reg = 1
self.writeInterruptConfig(reg)
def writeInterruptConfig(self, interrupt):
self.writeNavKey(REG_INTCONFB2, interrupt);
def writeCounter(self, value):
self.writeNavKey(REG_CVALB4, value);
def writeMax(self, max):
self.writeNavKey(REG_CMAXB4, max);
def writeMin(self, min):
self.writeNavKey(REG_CMAXB4, min);
def writeStep(self, step):
self.writeNavKey(REG_ISTEPB4, step);
def writeNavKey(self, reg, byte):
I2C.write_byte_data(self.addr, reg, byte)
def readNavKey(self, reg):
return I2C.read_byte_data(self.addr, reg)
def read_all(self):
return I2C.read_i2c_block_data(self.addr, 0, 32) + I2C.read_i2c_block_data(self.addr, 32, 32)
def get_events(self):
data = I2C.read_i2c_block_data(self.addr, REG_STATUSB2, 2)
data += I2C.read_i2c_block_data(self.addr, REG_CVALB4, 32)
return bytes2bin(data)
def readCounterInt(self):
return self.readNavKeyInt(REG_CVALB4)
def readNavKeyInt(self, reg):
bytes = I2C.read_i2c_block_data(self.addr, reg, 4)
print bytes2bin(bytes)
nav = NavKey(NAVKEY_ADDR)
for count in range(1023):
print '%6d' % count,
nav.readCounterInt()
nav.writeCounter(256+count); #/* Reset the counter value */
time.sleep(.01)
count += 1
continue
for i in range(0x71):
x = nav.readNavKey(i)
if x:
print '0x%02x:0x%02x' % (i, x),
print
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment