Skip to content

Added Ethernet module#561

Merged
jorgesg82 merged 19 commits intodevelopmentfrom
patch-ethernet
Feb 6, 2026
Merged

Added Ethernet module#561
jorgesg82 merged 19 commits intodevelopmentfrom
patch-ethernet

Conversation

@jorgesg82
Copy link
Contributor

The Ethernet module has been refactored to align with the new infrastructure.

It should be noted that you have two constants in the EthernetDomain declared to help the user using the old and the new design:

constexpr static EthernetPins PINSET_H10{
  .MDC = PC1,
  .REF_CLK = PA1,
  .MDIO = PA2,
  .CRS_DV = PA7,
  .RXD0 = PC4,
  .RXD1 = PC5,
  .TXD1 = PB13,
  .TX_EN = PG11,
  .TXD0 = PG13
};
constexpr static EthernetPins PINSET_H11{
  .MDC = PC1,
  .REF_CLK = PA1,
  .MDIO = PA2,
  .CRS_DV = PA7,
  .RXD0 = PC4,
  .RXD1 = PC5,
  .TXD1 = PB13,
  .TX_EN = PB11,     // NEW
  .TXD0 = PB12.      // NEW
};

This module has been tested in a Nucleo Development Board using this code in main.cpp in a template project:

#include "ST-LIB.hpp"
#include "main.h"

constexpr auto eth = ST_LIB::EthernetDomain::Ethernet(
    ST_LIB::EthernetDomain::PINSET_H10, "00:80:e1:00:01:07", "192.168.1.7",
    "255.255.0.0");

using myBoard = ST_LIB::Board<eth>;

int main(void) {
  Hard_fault_check();

  myBoard::init();
  auto eth_instance = &myBoard::instance_of<eth>();

  while (1) {
    eth_instance->update();
  }
}
void Error_Handler(void) {
  ErrorHandler("HAL error handler triggered");
  while (1) {
  }
}

The test consisted of performing a ping to the address 192.168.1.7 successfully. It has NOT been tested in a board

@jorgesg82 jorgesg82 requested a review from jdmarmen February 3, 2026 23:35
@jorgesg82 jorgesg82 self-assigned this Feb 3, 2026
Copilot AI review requested due to automatic review settings February 3, 2026 23:35
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 refactors the Ethernet module to align with the new domain-based infrastructure pattern used throughout the codebase. The module introduces two predefined pin configurations (PINSET_H10 and PINSET_H11) to support different hardware revisions and integrates Ethernet as a domain into the ST-LIB framework.

Changes:

  • Added NewEthernet.hpp implementing EthernetDomain following the established domain pattern
  • Integrated EthernetDomain into the ST-LIB BuildCtx and initialization sequence
  • Commented out HAL_ETH_MspInit GPIO and NVIC initialization to avoid conflicts with the new infrastructure

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
Inc/HALAL/Services/Communication/Ethernet/NewEthernet.hpp New Ethernet domain implementation with pin configurations, initialization logic, and runtime instance management
Inc/ST-LIB.hpp Integration of EthernetDomain into the build context and initialization sequence; minor formatting improvements
Inc/HALAL/HALAL.hpp Added NewEthernet.hpp include and reordered includes alphabetically
LWIP/Target/ethernetif.c Commented out GPIO and NVIC initialization in HAL_ETH_MspInit to delegate to new infrastructure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jorgesg82 jorgesg82 marked this pull request as draft February 4, 2026 22:38
@jorgesg82 jorgesg82 marked this pull request as ready for review February 6, 2026 16:49
Copy link
Contributor

@FoniksFox FoniksFox left a comment

Choose a reason for hiding this comment

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

LGTM

@jorgesg82 jorgesg82 marked this pull request as draft February 6, 2026 17:22
@jorgesg82 jorgesg82 marked this pull request as ready for review February 6, 2026 17:27
Copy link
Contributor

@victor-Lopez25 victor-Lopez25 left a comment

Choose a reason for hiding this comment

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

LGTM

@jorgesg82 jorgesg82 merged commit dcf817b into development Feb 6, 2026
16 checks passed
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