Skip to content

Commit dd1a58a

Browse files
authored
Merge pull request #10 from adafruit/fix-timings
Fix bit timing
2 parents 4014a09 + afad71d commit dd1a58a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

adafruit_neopxl8.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@
3030
pull block ; wait for fresh data
3131
out y, 32 ; get count of NeoPixel bits
3232
33-
; NeoPixels are 800khz bit streams. We are choosing zeros as <312ns hi, 936 lo>
34-
; and ones as <700 ns hi, 546 ns lo> and a clock of 16*800kHz, so the always-high
33+
; NeoPixels are 800khz bit streams and we run at 16*800kHz.
34+
; We are choosing zeros as [4,12] ~= <312ns hi, 938 lo>
35+
; and ones as [9,7] ~= <700ns hi, 546ns lo> and a clock of 16*800kHz, so the always-high
3536
; time is 4 cycles, the variable time is 5 cycles, and the always-low time is 7 cycles
3637
bitloop:
37-
pull ifempty [1] ; don't start outputting HIGH unless data is available (always-low part)
38-
mov pins, ~ null [3] ; always-high part
38+
pull ifempty [4] ; don't start outputting HIGH unless data is available (always-low part) ; low 7
39+
mov pins, ~ null [3] ; always-high part ; high 4
3940
{} ; variable part
40-
mov pins, null ; always-low part (last cycle is the 'pull ifempty' after wrap)
41+
mov pins, null ; always-low part (last cycle is the 'pull ifempty' after wrap) ; low: 1
4142
42-
jmp y--, bitloop ; always-low part
43+
jmp y--, bitloop ; always-low part ; low: 2
4344
4445
; A minimum delay is required so that the next pixel starts refreshing the front of the strands
4546
pull block

0 commit comments

Comments
 (0)