Giter Site home page Giter Site logo

Comments (5)

krwq avatar krwq commented on July 28, 2024 1

@shaggygi you can have a ReadBool or ReadAsBool and Write with different overload. Reopening as I personally find the enum cumbersome and prefer bool and keep on noticing the pattern @joperezr mentioned more and more in the PRs - I think we should keep things as simple as possible

from iot.

krwq avatar krwq commented on July 28, 2024 1

I think I'm fine with this as us after @JeremyKuhne's changes. @shaggygi? (closing this assuming you agree)

from iot.

joperezr avatar joperezr commented on July 28, 2024

I'm not sure how valuable these methods would be, since in reality you could still have the above code written in one line like:

BitArray bitArray = new BitArray(new byte[] { 0x1A });

foreach (bool bitValue in bitArray)
{
  _controller.Write(1, (bitValue) ? PinValue.High : PinValue.Low);
  
  // Other logic...
}

Granted it is not as readable as an overload, but I'm just not convinced that we should add extra methods for this. Also, if we were to add them, I would much rather just have an overload of Write that takes in a bool instead of a PinValue than having different method names.

from iot.

shaggygi avatar shaggygi commented on July 28, 2024

Yeah, I originally wanted the Write/Read, but since you couldn't have a Read for returning both PinValue or a bool is why I added the Bool at end. I agree, just use the logic above will be fine. Closing.

from iot.

joperezr avatar joperezr commented on July 28, 2024

I believe that this experience should be better now that PinValue is a struct right? You should now be able to use either int or bool on the write method by just casting. @krwq do you agree that after this change we don't need these extra Apis any longer?

from iot.

Related Issues (20)

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.