Skip to content

Conversation

j-heitz
Copy link
Collaborator

@j-heitz j-heitz commented Oct 8, 2025

Issue #118

Summary

This PR introduces a new helper class [ShiftRegister74HC595Helper] that controls 74HC595 shift registers via SPI communication on Raspberry Pi devices. Also Introduces a [ShiftRegister74HC595HelperTest].

Changes

  • New Class: [ShiftRegister74HC595Helper]
  • Comprehensive Test: [ShiftRegister74HC595HelperTest]

Basic Operations:

  • [shiftOut(byte)] - Write a byte value to the shift register
  • [clear()] - Reset all outputs to LOW (0x00)
  • [getState()]- Get current state of the shift register

Bit Manipulation:

  • [setBit(int, boolean)] - Set or clear individual bits (0-7)
  • [clearBit(int)] - Clear a specific bit

Error Handling:

  • Proper exception handling for SPI communication failures
  • Input validation for bit indices (0-7 range)
  • Comprehensive logging using SLF4J

Technical Details

  • Uses Pi4J SPI interface for hardware communication
  • Includes proper null checking and validation
  • Comprehensive unit tests with Mockito for SPI mocking

Testing

  • Valid operations and edge cases
  • Exception handling scenarios
  • State management verification
  • Input validation

@j-heitz j-heitz linked an issue Oct 8, 2025 that may be closed by this pull request
@j-heitz j-heitz changed the title #118 ShiftRegister (74HC595) Support #118 Shift Register (74HC595) Support Oct 8, 2025
@j-heitz j-heitz requested a review from leandrumartin October 9, 2025 01:49
@j-heitz j-heitz requested a review from leandrumartin October 13, 2025 15:32
@j-heitz j-heitz changed the title #118 Shift Register (74HC595) Support Add ShiftRegister74HC595Helper for SPI-based shift register control Oct 13, 2025
Copy link
Collaborator

@leandrumartin leandrumartin left a comment

Choose a reason for hiding this comment

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

The helper class itself should also have a Javadoc comment right above its declaration. Everything else looks good.

@j-heitz j-heitz requested a review from leandrumartin October 14, 2025 02:32
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.

Shift Register Class

2 participants