Skip to content

Wire: Max TX buffer length #1562

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 4 commits into from
Nov 26, 2021
Merged

Conversation

ABOSTM
Copy link
Contributor

@ABOSTM ABOSTM commented Nov 26, 2021

Summary
Wire: limit TX buffer size to avoid consuming too much stack

If data size to be sent is greater than the max defined,
application can split the transfert
Note: no limit implemented in RX buffer, because when receiving,
data are received on I2C, it is not possible to split.

Fixes #1539

txBufferIndex and txBufferLength always have the same value.
Thus only 1 variable is necessary.
Rename it txDataSize for better understanding.

Signed-off-by: Alexandre Bourdiol <[email protected]>
Prepare introduction of max TX buffer length

Signed-off-by: Alexandre Bourdiol <[email protected]>
@ABOSTM ABOSTM added the fix 🩹 Bug fix label Nov 26, 2021
@ABOSTM ABOSTM force-pushed the WIRE_MAX_TX_BUFF_LENGTH branch from f7c0ce6 to 8f995c5 Compare November 26, 2021 08:30
@fpistm fpistm added this to the 2.2.0 🎄 🎅 milestone Nov 26, 2021
@fpistm fpistm assigned ABOSTM and unassigned fpistm Nov 26, 2021
@fpistm fpistm self-requested a review November 26, 2021 09:09
If data size to be sent is greater than the max defined,
application can split the transfert
Note: no limit implemented in RX buffer, because when receiving,
data are received on I2C, it is not possible to split.

Fixes stm32duino#1539

Signed-off-by: Alexandre Bourdiol <[email protected]>
Check of null pointer is already done in both
* allocateTxBuffer()
* allocateRxBuffer()
and it leads to _Error_Handler()

Signed-off-by: Alexandre Bourdiol <[email protected]>
@ABOSTM ABOSTM force-pushed the WIRE_MAX_TX_BUFF_LENGTH branch from 8f995c5 to 2e73fd2 Compare November 26, 2021 10:20
@fpistm fpistm merged commit 7ae74e4 into stm32duino:main Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 🩹 Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wire: limit buffer size allocation
2 participants