-
Notifications
You must be signed in to change notification settings - Fork 126
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
Pulse distance encoding #140
Conversation
5955c32
to
46d68aa
Compare
uint32_t separator; | ||
}; | ||
|
||
std::map<uint32_t, PDESettings> bcm2835_pin_settings_map = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dependency on map makes it C incompatible... Not sure how to sanely get around it without dropping in a whole map replacement or consuming way more memory than necessary.
6ab472e
to
af03d12
Compare
bcm2835_delayMicroseconds(bcm2835_pin_settings_map[pin].separatorDuration); | ||
|
||
for(uint32_t index = 0; index < len; index++) { | ||
// TODO: LSB. Should allow customizing for MSB as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Allow for LSB/MSB setting.
bcm2835_gpio_clr(pin); | ||
} | ||
|
||
// TODO: should these be renamed? long is actually "high", short is actually "low" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Rename long -> high, short -> low.
|
||
void sunxi_delayMicroseconds(uint64_t micros) | ||
{ | ||
// TODO: Implement this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Implement delayMicroseconds on sunxi hardware.
af03d12
to
f31ab41
Compare
So, I confirmed with an oscilloscope that - at least on a raspi zero W - the new busy wait strategy is accurate +/- 3 microseconds when sleeping for 400 & 1200 microseconds. This is well within my application's error tolerance! However, it still doesn't work to drive the IR device I'd like to drive, and I don't know why. Some possible theories:
I think my next step is to find the highest clock-rate arduino I have, hook an IR receiver to it, and send it messages to see if I can spot anything wrong with them. |
Ok, I've done a little more research, and I suspect the issue is that my separators (LED HIGH) aren't on a 38khz carrier wave. It appears that's incredibly standard for IR equipment, and most sensors filter for it to avoid being turned on by sunlight, bright lights, etc. Ugh. Modulating my separator on a 38khz carrier wave is going to complicate this a lot. I think I'm going to try pigpio's node bindings and see if sending a waveform that way works. If it doesn't, I'll be back to explore modulating the separator for this PR. Either way, leaving this up as a historical record. Feel free to close it whenever. :) |
Ok, so pigpio worked great for this. I'm closing this PR. |
Hey! This is a WIP (it doesn't work right now), but I figured I'd open the PR in case you have feedback. I haven't used C/C++ in nearly 10 years, so very much welcome advice.
Closes #139.