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

[breaking] SPI library rework #2171

Merged
merged 5 commits into from
Nov 15, 2023
Merged

[breaking] SPI library rework #2171

merged 5 commits into from
Nov 15, 2023

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Nov 9, 2023

  • chore(SPI): align with ArduinoCoreAPI
  • chore(SPI): remove non arduino transfer api with 2 buffer
  • chore(SPI): clean up internal CS pin managements
  • chore(SPI): remove deprecated WiFi library workaround

To be aligned with Arduino API: https://github.com/arduino/ArduinoCore-API/blob/master/api/HardwareSPI.h
Only Hardware CS pin support kept.
Allows to save memory space (arounf 1kB) and increase execution speed ( until 30%).

Fixes #257.
Supersede #2082.

Mainly follow recommendation from @matthijskooijman : #257 (comment)

Test old vs new

  • Done on all series with GraphicTests
  • Saved RAM space is 48 bytes for all series.
  • Time measured between fillScreen and end of setup(). (note that it include delay's value i.e. 11000 ms).
  • For STM32C0xx, all unnecessary features disabled to save space including Serial. Adafruit libraries modified to remove dependencies within I2C. Time measured thanks a GPIO.
Series Board Flash (old) Flash (new) delta (bytes) Delta (%) Time (old) Time (new) delta Delta (%)
STM32C0xx Nucleo C031C6 30252 29212 1040 3.44% 23384 19879 3505 14.99%
STM32F0xx Nucleo F091RC 47048 45984 1064 2.26% 25048 21226 3822 15.26%
STM32F1xx Nucleo F103RB 36008 35016 992 2.75% 10408 7984 2424 23.29%
STM32F2xx Nucleo F207ZG 38692 37700 992 2.56% 17315 16274 1041 6.01%
STM32F3xx Nucleo F303RE 38332 37324 1008 2.63% 20963 18721 2242 10.70%
STM32F4xx Nucleo F411RE 35496 34500 996 2.81% 17437 16312 1125 6.45%
STM32F7xx Nucleo F767ZI 41260 40256 1004 2.43% 15252 14977 275 1.80%
STM32G0xx Nucleo G071RB 50600 49536 1064 2.10% 22660 19665 2995 13.22%
STM32G4xx Nucleo G474RE 41016 40008 1008 2.46% 16496 15747 749 4.54%
STM32H5xx Nucleo H563ZI 56752 55716 1036 1.83% 17429 17066 363 2.08%
STM32H7xx Nucleo H723ZG 51276 50240 1036 2.02% 6349 6231 118 1.86%
STM32L0xx Nucleo L010RB 46600 45536 1064 2.28% 29983 24746 5237 17.47%
STM32L1xx Nucleo L152RE 37408 36416 992 2.65% 26852 22682 4170 15.53%
STM32L4xx Nucleo L476RG 41068 40060 1008 2.45% 18655 17182 1473 7.90%
STM32L5xx Nucleo L552ZE 44204 43200 1004 2.27% 16827 15919 908 5.40%
STM32U5xx Nucleo U575ZI 51079 50043 1036 2.03% 18710 18071 639 3.42%
STM32WBxx Nucleo WB55RG 40276 39268 1008 2.50% 25124 21545 3579 14.25%
STM32WLxx Nucleo WL55JC1 40412 39404 1008 2.49% 21347 18967 2380 11.15%

Test with Hardware CS managed by the library:

  • Done with GraphicTests
  • Set TFT_CS to -1 and add SPI.setSSEL(xx); before first call of tft.initR(INITR_BLACKTAB);

@fpistm fpistm added enhancement New feature or request arduino compatibility labels Nov 9, 2023
@fpistm fpistm added this to the 2.7.0 milestone Nov 9, 2023
@fpistm fpistm marked this pull request as draft November 9, 2023 16:09
@fpistm fpistm force-pushed the SPI_rework branch 2 times, most recently from de8dab9 to ec472cd Compare November 9, 2023 16:33
@fpistm fpistm self-assigned this Nov 9, 2023
To be aligned with Arduino API.
Only Hardware CS pin support kept.
Allows to save memory space and increase execution speed.

Fixes stm32duino#257.

Signed-off-by: Frederic Pillon <[email protected]>
@fpistm fpistm marked this pull request as ready for review November 14, 2023 13:23
@fpistm fpistm merged commit 0038100 into stm32duino:main Nov 15, 2023
23 checks passed
@fpistm fpistm deleted the SPI_rework branch November 15, 2023 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

SPI library optimization
1 participant