Skip to content
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

Lack of documentation: Why 0b11100011? #23

Open
mrusme opened this issue Apr 24, 2019 · 2 comments
Open

Lack of documentation: Why 0b11100011? #23

mrusme opened this issue Apr 24, 2019 · 2 comments
Labels

Comments

@mrusme
Copy link

mrusme commented Apr 24, 2019

As I simply could not find any documentation on this, I'm misusing GItHub issues to ask this question and also suggest documenting this:

https://github.com/pimoroni/keybow-firmware/blob/master/keybow/lights.c#L108

What's that magic number? Why not 255 instead of 227? 255 seems to do the job as well. And what's that field in first place? I first thought it's the brightness, however, while it does seem to make the LEDs brighter when running at 255 instead of 227, it does not seem to support all numbers.

Could you please give some insights on this?

@Gadgetoid
Copy link
Member

I'd suggest reading https://cpldcpu.wordpress.com/2014/08/27/apa102/ if you're interested in driving APA102 LEDs.

This magic number is the LED frame marker, which is indicated by 3 high bits set to 1: 0b11100000 plus 5 bits of global (applies to R, G and B LEds in a package) brightness: 0b00011111 (giving an 0-31 brightness range). Since we don't want to drive at maximum brightness, but still want colours to have the full 255255255 range, we use global brightness to handle the dimming across the LEDs.

From the above article:
image

@mrusme
Copy link
Author

mrusme commented Apr 24, 2019

@Gadgetoid thank you for clarification! This information is a great piece of documentation.

mrusme added a commit to mrusme/kiwi that referenced this issue Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants