-
Notifications
You must be signed in to change notification settings - Fork 80
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
Set board property on AVRRunner class? #67
Comments
Hi Elliot! That's a good piece of feedback! Let's address each point individually:
Thoughts? |
This all sounds great. This is definitely a much larger project than just the WS2812B emulation I'm using it for. I think the real answer here is probably for me to make a separate little wrapper library that just does the LED stuff I want. That way I can match it with a version of avr8js and keep the execution code out of the apps. I use the runner in a couple of places, including on the server for generating GIFs, so it'll be worth it to have a consistent interface.
Good question! I don't actually know whether I am emulating them in my execute.ts, and I didn't know there was a performance penalty. Is that these lines?
|
This is now an NPM module and so far it's working!
And it exports the pin for the precompiled FastLED code: This covers all my use-cases and will make it super easy for me to update AVR8js in future across all the places I use it :) |
Shouldn't affect the performance too much - basically, any call to
Super cool! I see you already got to version 1.0.5. Do you need some help with crafting a README? |
Thank you! Yes I made a few small patch changes in the process. For now I'm going to wait on the README until I'm confident the API won't change. I think it's pretty close. |
How is it going with that Elliot? |
I got this working, and then completely forgot about it! Which is a good sign as it worked great. Do you think anybody else will have a need for such a wrapper library? I'm not sure whether it's worth putting more time into documenting or maintaining it as I don't think anybody will have a need to use it. I think the AVR8js library is amazing, and I'm very grateful for it! But I have found it very complicated to work with. Little libraries like the one I've written will be extremely helpful for helping developers like me use it for specific things. At any rate, I think we can close this issue now :) |
Happens to me sometimes too :-)
That's a very good piece of feedback. I've been thinking this over the last few days, and I think we'll have an easier API for people who just want to get ATmega328p (and eventually, maybe also Uno) simulation out of the box. The latest release, 0.14.x, has already simplified the API a little: you no longer have to call This paves the way to creating a preset - some kind of factory function that returns a const { cpu } = createAVR(ATmega328p);
// this code runs in a loop
while (...) {
avrInstruction(cpu);
cpu.tick();
} |
The simpler-api branch now has a prototype implementation |
Moving the discussion to #87 |
The
execute.ts
function differs between the two examples (mega
and normal boards) - this always trips me up between examples.It seems to be because the
new CPU
has an offset second parameter:Would it be possible to set board type on
AVRRunner
, and then do the offset depending on what the board is set to, so the user can just use theAvrRunner
directly fromavr8js
without redeclaring it?I also don't really know what
portB
/portC
/portD
refer to. I wonder whether theAVRRunner
class could expose apin(int pinNumber)
function that callsportB.pinState(X)
internally.Or even tidier, the
WS2812Controller
could set up the listener itself:Thanks!
The text was updated successfully, but these errors were encountered: