Skip to content

Allow bytes as well #25

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

Merged
merged 1 commit into from
Mar 14, 2021
Merged

Allow bytes as well #25

merged 1 commit into from
Mar 14, 2021

Conversation

caternuson
Copy link
Contributor

For #24. Using bytes was essentially already supported. Just needed to let the driver know how cool it was.

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit QT Py M0 with samd21e18
>>> import board
>>> import adafruit_fram
>>> fram = adafruit_fram.FRAM_I2C(board.I2C())
>>> message = b'Python is fun!'
>>> fram[0] = message
>>> fram[0:len(message)-1]
bytearray(b'Python is fun!')
>>> 

@caternuson caternuson requested a review from a team March 11, 2021 01:35
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit weird for python because fram[0] = [0,1,2,3] would store the list at index 0, not treat it as a starting index. Instead you would use slices fram[0:3] = [0,1,2,3]. I believe this is how nvm works already. Mind look into switching this?

@caternuson
Copy link
Contributor Author

I was sort of wondering about that too. Do you think that'd be better as a separate issue?

I guess the idea was to make it easier? There's no way to actually store all of [0,1,2,3] at fram[0]. And that syntax doesn't require one to figure out the math for the slice values on the left hand side fram[0:3]. But I'm just guessing.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me if you want to do it later. I do think it'd be good to make consistent at some point.

@caternuson
Copy link
Contributor Author

Yep, agree. Just not sure how much of a thread it will pull to change here. And can use nvm as a reference. I'll open the new issue.

@caternuson caternuson merged commit cec0cc8 into adafruit:master Mar 14, 2021
@caternuson caternuson mentioned this pull request Mar 14, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Mar 17, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_FRAM to 1.3.8 from 1.3.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_FRAM#25 from caternuson/iss24

Updating https://github.com/adafruit/Adafruit_CircuitPython_GPS to 3.8.1 from 3.8.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_GPS#60 from lesamouraipourpre/length-data-type-check
  > Merge pull request adafruit/Adafruit_CircuitPython_GPS#61 from lesamouraipourpre/docs2
  > Revert "[WILL BE REVERSED] Making change to test adabot release check"
  > [WILL BE REVERSED] Making change to test adabot release check

Updating https://github.com/adafruit/Adafruit_CircuitPython_LC709203F to 2.0.3 from 2.0.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_LC709203F#10 from noahcoad/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A to 0.4.0 from 0.3.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_TCA9548A#27 from caternuson/iss26_scan

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout to 1.3.0 from 1.2.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_Layout#17 from FoamyGuy/iconwidget_ondisk

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 5.0.5 from 5.0.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#74 from KTibow/patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#72 from FoamyGuy/ignoreimport

Updating https://github.com/adafruit/Adafruit_CircuitPython_PIOASM to 0.2.3 from 0.2.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_PIOASM#14 from adafruit/jepler-rotary-example

Updating https://github.com/adafruit/Adafruit_CircuitPython_PortalBase to 1.4.1 from 1.4.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_PortalBase#22 from makermelissa/main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants