Skip to content

Conversation

@ramya-subramanyam
Copy link
Collaborator

By creating this pull request you agree to the terms in CONTRIBUTING.md.
https://github.com/Infineon/.github/blob/master/CONTRIBUTING.md
--- DO NOT DELETE ANYTHING ABOVE THIS LINE ---

We previously used project-specific class names "SPIClassPSOC" in SPI tests to create slave and master instances. This has now been moved to a test_config source file to enhance its generic nature and reusability across different projects.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors PSOC-specific SPI variables by moving them from SPI test files to a centralized test configuration. The purpose is to improve code organization and reusability across different projects by removing hardcoded class names from test files.

  • Moved PSOC-specific SPI class declarations to test_config.h/cpp
  • Created centralized global SPI instances for master and slave configurations
  • Added proper forward declarations and implementations to avoid multiple definition errors

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_config.h Added SPI.h include and forward declarations for spi_master/spi_slave instances
tests/test_config.cpp New file implementing SPI instance definitions with proper initialization
Comments suppressed due to low confidence (1)

tests/test_config.cpp:15

  • [nitpick] The variable name 'SPI1' is inconsistent with the declared naming pattern. Consider renaming to 'spi_slave_instance' or similar to match the naming convention used for the pointer variables.
SPIClassPSOC SPI1 = SPIClassPSOC(PIN_SPI_MOSI, PIN_SPI_MISO, PIN_SPI_SCK, TEST_PIN_SPI_SSEL, true);

@jaenrig-ifx
Copy link
Member

jaenrig-ifx commented Aug 4, 2025

Should not SPIClass work for both ports? https://github.com/arduino/ArduinoCore-API/blob/master/api/HardwareSPI.h#L129

@ramya-subramanyam
Copy link
Collaborator Author

Should not SPIClass work for both ports? https://github.com/arduino/ArduinoCore-API/blob/master/api/HardwareSPI.h#L129

It will not work because in PSOC project the class name is SPIClassPSOC.
HardwareSPI is abstract class and SPIClass depends on it. May be we can try what you suggest during the pairing daily call

@ramya-subramanyam ramya-subramanyam force-pushed the refactor-spi-test-config branch from 23a3644 to b8a999c Compare August 7, 2025 04:20
Signed-off-by: Ramya Subramanyam <ramya.subramanyam@infineon.com>
@ramya-subramanyam ramya-subramanyam force-pushed the refactor-spi-test-config branch from b8a999c to 73c29e8 Compare August 7, 2025 08:46
Signed-off-by: Ramya Subramanyam <ramya.subramanyam@infineon.com>
@ramya-subramanyam ramya-subramanyam force-pushed the refactor-spi-test-config branch from 7dcf8d7 to d0b6e72 Compare August 7, 2025 09:01
Signed-off-by: Ramya Subramanyam <ramya.subramanyam@infineon.com>
@ramya-subramanyam ramya-subramanyam force-pushed the refactor-spi-test-config branch from 989188f to 690188d Compare August 7, 2025 10:25
@ramya-subramanyam ramya-subramanyam merged commit bf969b6 into main Aug 7, 2025
31 of 32 checks passed
@ramya-subramanyam ramya-subramanyam deleted the refactor-spi-test-config branch August 7, 2025 10:44
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.

4 participants