Skip to content

Add pin lock method to digital out#502

Merged
g0nz4I0 merged 6 commits intodevelopmentfrom
digital-out-lock
Apr 25, 2025
Merged

Add pin lock method to digital out#502
g0nz4I0 merged 6 commits intodevelopmentfrom
digital-out-lock

Conversation

@jmaralo
Copy link
Member

@jmaralo jmaralo commented Mar 28, 2025

The HAL has a method that can lock a GPIO in a certain state until the board resets (using HAL_GPIO_LockPin). This could be useful for the contactors as an example, where once you enter fault you don't want to close them until you reset the board after fixing the fault cause. This is the same for the GD reset and enable, brakes, etc. All driven by a GPIO.

Also I took the chance to run the linter through the digital out code, the logic of this modification is minimal. The interesting methods are named force_lock_state

@jmaralo jmaralo requested a review from Copilot April 2, 2025 18:57
Copy link
Contributor

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 adds a method to lock a GPIO pin in a specific state until board reset, supporting safety features like preventing contactor reactivation after a fault. Key changes include:

  • Addition of a new lock_pin_state method in DigitalOutput and related service classes.
  • Consistent header updates and minor formatting improvements across HALAL and HALALMock implementations.
  • Adjusted error handling when registering/use of DigitalOutput IDs.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Src/ST-LIB_LOW/DigitalOutput/DigitalOutput.cpp Added lock_pin_state method and simplified formatting of existing methods.
Src/HALALMock/Services/DigitalOutputService/DigitalOutputService.cpp Reformatted error message and toggle method; mock implementation of lock_pin_state introduced.
Src/HALAL/Services/DigitalOutputService/DigitalOutputService.cpp New implementation for lock_pin_state with proper error handling and use of HAL routines.
Inc/ST-LIB_LOW/DigitalOutput/DigitalOutput.hpp Updated header to include lock_pin_state declaration.
Inc/HALALMock/Services/DigitalOutputService/DigitalOutputService.hpp Declared lock_pin_state in the HALALMock service header.
Inc/HALAL/Services/DigitalOutputService/DigitalOutputService.hpp Declared lock_pin_state in the HALAL service header.

Copy link
Contributor

@Ikubimu Ikubimu left a comment

Choose a reason for hiding this comment

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

lgfm

Copy link
Member

@g0nz4I0 g0nz4I0 left a comment

Choose a reason for hiding this comment

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

I'm going to shove the linter up *********

@g0nz4I0 g0nz4I0 merged commit 2210547 into development Apr 25, 2025
13 checks passed
@g0nz4I0 g0nz4I0 deleted the digital-out-lock branch April 25, 2025 10:02
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