Skip to content

Fix bit timing #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions adafruit_neopxl8.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
pull block ; wait for fresh data
out y, 32 ; get count of NeoPixel bits

; NeoPixels are 800khz bit streams. We are choosing zeros as <312ns hi, 936 lo>
; and ones as <700 ns hi, 546 ns lo> and a clock of 16*800kHz, so the always-high
; NeoPixels are 800khz bit streams and we run at 16*800kHz.
; We are choosing zeros as [4,12] ~= <312ns hi, 938 lo>
; and ones as [9,7] ~= <700ns hi, 546ns lo> and a clock of 16*800kHz, so the always-high
; time is 4 cycles, the variable time is 5 cycles, and the always-low time is 7 cycles
bitloop:
pull ifempty [1] ; don't start outputting HIGH unless data is available (always-low part)
mov pins, ~ null [3] ; always-high part
pull ifempty [4] ; don't start outputting HIGH unless data is available (always-low part) ; low 7
mov pins, ~ null [3] ; always-high part ; high 4
{} ; variable part
mov pins, null ; always-low part (last cycle is the 'pull ifempty' after wrap)
mov pins, null ; always-low part (last cycle is the 'pull ifempty' after wrap) ; low: 1

jmp y--, bitloop ; always-low part
jmp y--, bitloop ; always-low part ; low: 2

; A minimum delay is required so that the next pixel starts refreshing the front of the strands
pull block
Expand Down