Skip to content

Desmakers 4585 #6

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 7 commits into from
May 23, 2025
Merged

Desmakers 4585 #6

merged 7 commits into from
May 23, 2025

Conversation

OlafFilies
Copy link
Member

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 ---

CONTRIBUTING.md also tells you what to expect in the PR process.

Description
This pull request introduces significant changes to the SPICIno and Tle94112 classes, simplifying their constructors, improving code readability, and enhancing maintainability. The key updates include removing unused parameters in SPICIno constructors, refactoring repeated code patterns in Tle94112, and replacing hard coded register addresses with named constants for clarity.

Simplification of SPICIno constructors:

  • Removed unused lsb and mode parameters from all constructors in SPICIno, as they were no longer needed. (src/spic-arduino.cpp, src/spic-arduino.hpp) [1] [2] [3] [4] [5]

Refactoring in Tle94112 class:

  • Consolidated repeated writeReg and readStatusReg calls by directly passing structure members, reducing redundancy and improving readability. (src/tle94112.cpp) [1] [2] [3] [4]
  • Replaced hardcoded register addresses with descriptive constants (e.g., REG_ACT_1, REG_ERR1) for better maintainability and readability in initialization logic. (src/tle94112.cpp)

Minor updates:

  • Updated the TLE94112_PIN_CS1 macro to use the SS constant instead of a hard coded value for better compatibility and flexibility. (src/tle94112-platf-ino.hpp)

@ederjc ederjc requested review from jaenrig-ifx and Copilot May 20, 2025 09:01
Copy link
Contributor

@Copilot 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 simplifies SPI interface constructors, streamlines TLE94112 register access patterns, and replaces hard-coded values with descriptive constants for clarity and maintainability.

  • SPICIno constructors: removed unused parameters (lsb, mode) and hard-coded settings in init
  • Tle94112 methods: collapsed repeated writeReg/readStatusReg calls and replaced literal addresses with named REG_* constants
  • Platform definitions: updated TLE94112_PIN_CS1 to use SS macro

Reviewed Changes

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

File Description
src/spic-arduino.hpp Removed unused lsb and mode members and adjusted constructor signatures
src/spic-arduino.cpp Updated constructors and init() to drop lsb/mode usage, hard-coded SPI settings, and fixed doc comments
src/tle94112.cpp Added SPI/CS timing macros, refactored writeReg/readStatusReg calls, replaced register literals with REG_* constants, and switched delay units
src/tle94112-platf-ino.hpp Changed TLE94112_PIN_CS1 from 10 to SS constant
Comments suppressed due to low confidence (3)

src/spic-arduino.cpp:28

  • The mode parameter was removed from the constructor signature—please update or remove this outdated doc comment.
* @param mode   SPI mode

src/tle94112.cpp:17

  • Remove the trailing semicolon in this macro definition—#define should not include ; at the end.
#define TLE94112_CMD_WRITE          0x80;

src/tle94112.cpp:18

  • Remove the trailing semicolon here as well. Also verify that TLE94112_CMD_CLEAR has the correct opcode (it currently duplicates the write command).
#define TLE94112_CMD_CLEAR          0x80;

Copy link
Member Author

@OlafFilies OlafFilies left a comment

Choose a reason for hiding this comment

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

Nope, I deinitialize only one SPI channel not multiple

@jaenrig-ifx
Copy link
Member

Not a lot I can judge :D But it seems to compile with all libraries 👯

Copy link
Member

@ederjc ederjc left a comment

Choose a reason for hiding this comment

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

Great, thanks @OlafFilies!

@ederjc ederjc merged commit 4b2883f into master May 23, 2025
15 checks passed
@jaenrig-ifx jaenrig-ifx deleted the DESMAKERS-4585 branch May 23, 2025 11:43
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