Skip to content
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

Wire rework #500

Merged
merged 3 commits into from
Dec 5, 2023
Merged

Wire rework #500

merged 3 commits into from
Dec 5, 2023

Conversation

MX682X
Copy link
Contributor

@MX682X MX682X commented Nov 12, 2023

Alright, so kinda big changes:

  • pulled twi.c into Wire.cpp, the seperation wasn't needed
  • Master and Slave don't have seperate tx and rx buffers anymore, as the mode of operation is defined by the read/write bit so there is no interfereing between tx and rx between start and stop (saves like 50% of ram)
  • reworked the slave isr routine to save some flash (a fresh look helps a lot)
  • added masterTransmit/masterReceive functions that write directly to a user buffer (useful if you are tired of the Arduino API)
    • the Arduino API are basically just wrappers for this functions now
  • replaced the define BUFFER_LENGTH with TWI_BUFFER_LENGTH (maybe WIRE_BUFFER_LENGTH would be better?) while maintaining backwards capability

@MX682X
Copy link
Contributor Author

MX682X commented Nov 12, 2023

gonna finish updating the docs a bit later

@mikrocoder
Copy link
Contributor

Hi,
Very nice.
TWI_BUFFER_LENGTH is the better name.
WIRE_BUFFER_LENGTH could be confused with OneWire.
My opinion.

@MCUdude
Copy link
Contributor

MCUdude commented Nov 15, 2023

I've been using TWI_BUFFER_SIZE for the last four years with MegaCoreX. It could be a good idea to keep the names similar.

@SpenceKonde
Copy link
Owner

Sorry for the awful delay here, have been moving between shitty temporary locations cause my roommates fucked me over and didn;t tell me they weren't re-signing lease.... half an hour before they told the land lord.

@SpenceKonde SpenceKonde merged commit 7e16b25 into SpenceKonde:master Dec 5, 2023
134 of 135 checks passed
@MX682X
Copy link
Contributor Author

MX682X commented Dec 5, 2023

Yeah, that soubds awful. I hope you were able to find something stable.

However it would be good to read your thoughts aswell about the Naming of the define. We have two options....

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.

None yet

4 participants