Git Product home page Git Product logo

Comments (8)

ladyada avatar ladyada commented on July 24, 2024

SPI is definitely not fully done, you shouldnt adapt drivers to match Blinka as its missing a bunch of stuff and vargs. its just 'barely working' right now, i only tested it with one sensor so far :)

from adafruit_blinka.

jerryneedell avatar jerryneedell commented on July 24, 2024

Fair enough! I was not sure if spidev could handle the "end=".
It is fun to have it working as much as it is! Thanks for adding the note to the guide about not using ce0/ce1 on the RPi -- that caused some very odd results!

from adafruit_blinka.

ladyada avatar ladyada commented on July 24, 2024

ok cool! re-opening as a reminder to myself to fix the end= thing

from adafruit_blinka.

Timonzimm avatar Timonzimm commented on July 24, 2024

I have the same issue and if I would love to have details on how you dealt with this @jerryneedell. Indeed, I tried to remove the "end" argument from the function call and changed the range of buffer.

So instead of having buf=[a,b,c] and end=2, I now have buf=[a,b].

Thank you for your help!

from adafruit_blinka.

jerryneedell avatar jerryneedell commented on July 24, 2024

@Timonzimm As noted by @ladyada this is likely to be fixed properly in a future update to the Blinka module so the preferred solution is to wait for that!

What ti did was to create additional BUFFER's to hold 1 or 2 byte arguments and use them instead of the end= keyword. For your reference, here is the "dif" but be forewarned, I have done very little testing of this and it may not work reliably.

$ diff adafruit_rfm9x.py ../Adafruit_CircuitPython_RFM9x/adafruit_rfm9x.py  > adafruit_rfm9x.diff
$ cat adafruit_rfm9x.diff 
270,271d269
<     _BUFFER1 = bytearray(1)
<     _BUFFER2 = bytearray(2)
394c392
<             self._BUFFER1[0] = address & 0x7F  # Strip out top bit to set 0
---
>             self._BUFFER[0] = address & 0x7F  # Strip out top bit to set 0
396,397c394,395
<             device.write(self._BUFFER1)
<             device.readinto(buf)
---
>             device.write(self._BUFFER, end=1)
>             device.readinto(buf, end=length)
401,402c399,400
<         self._read_into(address, self._BUFFER1)
<         return self._BUFFER1[0]
---
>         self._read_into(address, self._BUFFER, length=1)
>         return self._BUFFER[0]
404c402
<     def _write_from(self, address, msg, length=None):
---
>     def _write_from(self, address, buf, length=None):
407a406,407
>         if length is None:
>             length = len(buf)
409,412c409,412
<             self._BUFFER1[0] = (address | 0x80) & 0xFF  # Set top bit to 1 to
<                                               # indicate a write.
<             device.write(self._BUFFER1)
<             device.write(msg)
---
>             self._BUFFER[0] = (address | 0x80) & 0xFF  # Set top bit to 1 to
>                                                        # indicate a write.
>             device.write(self._BUFFER, end=1)
>             device.write(buf, end=length)
418c418
<             self._BUFFER2[0] = (address | 0x80) & 0xFF  # Set top bit to 1 to
---
>             self._BUFFER[0] = (address | 0x80) & 0xFF  # Set top bit to 1 to
420,421c420,421
<             self._BUFFER2[1] = val & 0xFF
<             device.write(self._BUFFER2)
---
>             self._BUFFER[1] = val & 0xFF
>             device.write(self._BUFFER, end=2)
558c558
<         # Write payload
---
>         # Write payload.

from adafruit_blinka.

ladyada avatar ladyada commented on July 24, 2024

yep ive just been super busy!

from adafruit_blinka.

jerryneedell avatar jerryneedell commented on July 24, 2024

can't imagine why ;-)

from adafruit_blinka.

ladyada avatar ladyada commented on July 24, 2024

#22 fixes this

from adafruit_blinka.

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.