Giter Site home page Giter Site logo

europigo's People

Contributors

awonak avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

europigo's Issues

Observations

Hey Adam! Been looking a bit through the code and I thought to take note of some things that called out to me.

Documentation

EuroPi struct needs better naming or documentation. I'd guess K1 and K2 are the knobs, but it is hard to be sure. Adding a comment or changing them to Knob1 and Knob2 would be pretty good (I'd opt for the second since it would make comments superfluous, which is an especially good thing!). Same goes for NewAI and NewDI functions, their naming seems evil to me hahah ๐Ÿ™ƒ

API

I feel like you should be making better use of the tinygo drivers package and it's interfaces. A lot of stuff here has wrappers that feel superfluous to me. An example is the Display. Instead of having a *Display in the EuroPi struct could you not use a drivers.Displayer and have the font stored in the EuroPi struct too if needed?

I also feel like the DigitalReader could be a struct instead of an interface. Though this would prevent mocking (never mocked tinygo programs myself though).

After some thinking... Shouldn't all of Europi's fields be non-interface types? What exactly is the advantage of having them as interface types? Seems to me they should be at most structs that embed interfaces which implement the IO functionality.

Heap

yep, I think strconv.Itoa is causing those awful heap alloc. Instead I'd have a static byte array of the size of the display and use the strconv.AppendInt function to avoid heap allocations altogether.

type display struct {
     // ...
     buf [16]byte  
}
// ...
n := copy(disp.buf[:],  "my knob is at ")
strconv.AppendInt(a[:n:16], number, 10) // if append exceeds capacity then you have a problem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.