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

Fix GPIO assignments #3007

Merged
merged 1 commit into from
Aug 12, 2024
Merged

Fix GPIO assignments #3007

merged 1 commit into from
Aug 12, 2024

Conversation

josesimoes
Copy link
Member

@josesimoes josesimoes commented Aug 12, 2024

Description

  • Add missing config for PA2 connected to ADC.
  • Remove ADC channels being wrongly configured.
  • Fix ADC declaration following this.
  • Update managed helper for ADC.

Motivation and Context

  • Fixes ADC and other GPIOs being wrongly assigned.

How Has This Been Tested?

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • Dependencies/declarations (update dependencies or assembly declarations and changes associated, has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).

CC @gligorov @networkfusion

Summary by CodeRabbit

  • New Features

    • Enhanced clarity and consistency in GPIO pin assignments with updated naming conventions.
    • Reorganization of ADC channel connections for improved hardware configuration alignment.
  • Bug Fixes

    • Resolved potential confusion with outdated ADC channel mappings by updating comments and connections.
  • Chores

    • Streamlined ADC input configuration for better performance and reduced complexity.

@josesimoes josesimoes added the Platform: STM32 Everything related specifically with ChibiOS platform label Aug 12, 2024
Copy link

coderabbitai bot commented Aug 12, 2024

Walkthrough

The recent updates to the ChibiOS project involve significant changes to GPIO pin assignments and configurations, as well as the reassignment of ADC channel connections. The modifications aim to enhance clarity and maintainability by renaming GPIO pins and adjusting their configurations across various ports. The ADC channel mappings have also been reorganized to reflect the new hardware setup, optimizing how the channels are utilized in the application.

Changes

Files Change Summary
targets/ChibiOS/ORGPAL_PALX/board.h Renamed GPIO pin definitions for clarity, updated GPIO line assignments, and revised configurations across all GPIO ports.
targets/ChibiOS/ORGPAL_PALX/managed_helpers/ORGPAL_PALX.Adc.cs Updated ADC channel connections with new pin mappings, reflecting hardware changes and reorganization of channel assignments.
targets/ChibiOS/ORGPAL_PALX/target_system_device_adc_config.cpp Modified ADC port pin channel mappings, simplifying the configuration and removing obsolete entries.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

- Add missing config for PA2 connected to ADC.
- Remove ADC channels being wrongly configured.
- Fix ADC declaration following this.
- Update managed helper for ADC.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
targets/ChibiOS/ORGPAL_PALX/board.h (1)

50-68: Inconsistency Found in GPIO Pin Renaming

The GPIO pin renaming is not consistent across the codebase. The following files still contain old GPIO pin names:

  • targets/AzureRTOS/ST/ORGPAL_PALTHREE/board.h
  • targets/ChibiOS/ORGPAL_PALTHREE/board.h

Please update these references to match the new naming conventions.

Analysis chain

Verify Consistency in GPIO Pin Renaming

The GPIO pin macros have been renamed for clarity. Ensure that all instances of these pins in the codebase have been updated to match the new naming conventions.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that GPIO pin renaming is consistent across the codebase.

# Test: Search for old and new GPIO pin names to ensure all references are updated.
rg --type c --type h $'GPIOA_PIN2|GPIOB_IO1_P18_ADC1_IN9|LINE_IO1_P17_ADC1_IN3|LINE_IO1_P18_ADC1_IN9'

Length of output: 2019

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 132e730 and 9a4595c.

Files selected for processing (3)
  • targets/ChibiOS/ORGPAL_PALX/board.h (17 hunks)
  • targets/ChibiOS/ORGPAL_PALX/managed_helpers/ORGPAL_PALX.Adc.cs (2 hunks)
  • targets/ChibiOS/ORGPAL_PALX/target_system_device_adc_config.cpp (1 hunks)
Additional comments not posted (4)
targets/ChibiOS/ORGPAL_PALX/target_system_device_adc_config.cpp (1)

11-17: Ensure ADC Channel Updates Align with Hardware Specifications

The changes to the AdcPortPinConfig array update the GPIO pin assignments for ADC1. Verify that these changes accurately reflect the hardware design and that the removed configurations are no longer needed.

targets/ChibiOS/ORGPAL_PALX/managed_helpers/ORGPAL_PALX.Adc.cs (1)

Line range hint 14-44:
Verify Accuracy of ADC Channel Descriptions

The comments for ADC channels have been updated to reflect new pin assignments. Ensure that these descriptions are accurate and match the hardware configuration, as incorrect descriptions could lead to confusion.

targets/ChibiOS/ORGPAL_PALX/board.h (2)

388-537: Review GPIO Configuration Macros for Accuracy

The configuration macros for GPIO settings have been updated. Ensure that these macros accurately reflect the intended pin modes, types, speeds, and alternate functions.


240-263: Check Line Assignments for GPIO Consistency

The line assignments for GPIO pins have been updated. Verify that these changes are consistent with the new GPIO pin definitions and that they reflect the intended hardware functionality.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 132e730 and 9a4595c.

Files selected for processing (3)
  • targets/ChibiOS/ORGPAL_PALX/board.h (17 hunks)
  • targets/ChibiOS/ORGPAL_PALX/managed_helpers/ORGPAL_PALX.Adc.cs (2 hunks)
  • targets/ChibiOS/ORGPAL_PALX/target_system_device_adc_config.cpp (1 hunks)
Additional comments not posted (3)
targets/ChibiOS/ORGPAL_PALX/target_system_device_adc_config.cpp (1)

11-11: Verify ADC channel mapping change.

The ADC channel for GPIOA has been changed from pin 3 to pin 2. Ensure that this change aligns with the hardware configuration and that any dependent code has been updated accordingly.

targets/ChibiOS/ORGPAL_PALX/managed_helpers/ORGPAL_PALX.Adc.cs (1)

14-14: Ensure updated comment accuracy for Channel 0.

The comment for Channel 0 has been updated to reflect a connection to PA2. Ensure this matches the actual hardware setup.

Verification successful

Comment for Channel 0 accurately reflects the hardware connection.

The comment stating that Channel 0 is connected to PA2 in ORGPAL_PALX.Adc.cs is correct and consistent with the codebase. No further action is needed.

  • targets/ChibiOS/ORGPAL_PALX/managed_helpers/ORGPAL_PALX.Adc.cs: Channel 0 is correctly documented as connected to PA2.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the accuracy of Channel 0's comment in the codebase.

# Test: Search for references to Channel 0 and PA2 in the codebase.
rg --type cs -A 5 $'Channel_0'
rg --type cs -A 5 $'PA2'

Length of output: 3940

targets/ChibiOS/ORGPAL_PALX/board.h (1)

52-52: Verify GPIO pin renaming for GPIOA_PIN2.

The definition for GPIOA_PIN2 has been renamed to GPIOA_IO2_ADC1_IN2_NTC. Ensure this change is reflected consistently across the codebase.

Verification successful

Renaming Verified: GPIOA_PIN2 to GPIOA_IO2_ADC1_IN2_NTC

The renaming of GPIOA_PIN2 to GPIOA_IO2_ADC1_IN2_NTC has been successfully applied throughout the codebase. No instances of GPIOA_PIN2 remain, ensuring consistency and correctness in the updated code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the renamed GPIOA_PIN2 in the codebase.

# Test: Search for references to GPIOA_PIN2 and GPIOA_IO2_ADC1_IN2_NTC in the codebase.
rg --type c -A 5 $'GPIOA_PIN2'
rg --type c -A 5 $'GPIOA_IO2_ADC1_IN2_NTC'

Length of output: 3732


Script:

#!/bin/bash
# Description: Verify the usage of the renamed GPIOA_PIN2 across the entire codebase.

# Test: Search for any remaining references to GPIOA_PIN2 in the codebase.
rg --type c $'GPIOA_PIN2'

Length of output: 24

@josesimoes josesimoes merged commit 6cd9a72 into nanoframework:main Aug 12, 2024
11 checks passed
@josesimoes josesimoes deleted the fix-palx-gpios branch August 12, 2024 11:10
@josesimoes josesimoes mentioned this pull request Aug 12, 2024
13 tasks
@josesimoes josesimoes changed the title Fix GPIO assigments Fix GPIO assignments Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Config-and-Build Platform: STM32 Everything related specifically with ChibiOS platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants