Giter Site home page Giter Site logo

TypeError about i2cdevice-python HOT 5 OPEN

pimoroni avatar pimoroni commented on August 17, 2024 1
TypeError

from i2cdevice-python.

Comments (5)

Gadgetoid avatar Gadgetoid commented on August 17, 2024 1

I can't remember the exact motivation behind this eldritch horror, but I don't believe I use device.register.set_field() anywhere in any library based on i2c-device.

Presumably I wanted device.some_settings_register.set_field(1) to work, but I seem to exclusively use the pattern:

device.set("REGISTER", key=value, key2=value2)

I would be delighted to remove this ghastly abomination and patch any libraries that show otherwise. Sometimes simpler is better, and trying to do weird dictionary lookup catching nonsense liks this is just a result of nobody telling me when to stop.

from i2cdevice-python.

Thynix avatar Thynix commented on August 17, 2024

I'm running into this too - maybe the __dict__ signature changed or something? I haven't looked into it yet. _RegisterProxy explains why it's there:

class _RegisterProxy(object):
    """Register Proxy

    This proxy catches lookups against non existent get_fieldname and set_fieldname methods
    and converts them into calls against the device's get_field and set_field methods with
    the appropriate options.

    This means device.register.set_field(value) and device.register.get_field(value) will work
    and also transparently update the underlying device without the register or field objects
    having to know anything about how data is written/read/stored.

    """

from i2cdevice-python.

Thynix avatar Thynix commented on August 17, 2024

I'm on board with that! Do you want to remove it, or I can open a PR?

from i2cdevice-python.

Gadgetoid avatar Gadgetoid commented on August 17, 2024

Feel free to open a PR- though Iā€™m going to have to do some careful inspection of our i2c-device based libraries to make sure Iā€™m not wrong šŸ˜¬

from i2cdevice-python.

PaulskPt avatar PaulskPt commented on August 17, 2024

Thank you gentlemen for giving your precious time to this!
Btw the script with the Pimoroni RTC breakout works perfect. Even having it left without electricity for weeks, it keeps time quit exactly.

from i2cdevice-python.

Related Issues (4)

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.