From fb3e5b7c8047ea08b111c9beab94745556e0f8d3 Mon Sep 17 00:00:00 2001
From: lynxnb <niccolo.betto@gmail.com>
Date: Sun, 24 Sep 2023 22:01:40 +0200
Subject: [PATCH] [AutomatedAntennas] Add ethernet hwmapping

---
 .../interfaces-impl/bsp.cpp                       |  6 ++++++
 .../interfaces-impl/hwmapping.h                   | 15 +++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/miosix/arch/cortexM7_stm32f7/stm32f767zi_automated_antennas/interfaces-impl/bsp.cpp b/miosix/arch/cortexM7_stm32f7/stm32f767zi_automated_antennas/interfaces-impl/bsp.cpp
index 71ffe577..b3ed6982 100644
--- a/miosix/arch/cortexM7_stm32f7/stm32f767zi_automated_antennas/interfaces-impl/bsp.cpp
+++ b/miosix/arch/cortexM7_stm32f7/stm32f767zi_automated_antennas/interfaces-impl/bsp.cpp
@@ -293,6 +293,12 @@ void IRQbspInit()
     stepper2::enable::mode(Mode::OUTPUT);
     stepper2::direction::mode(Mode::OUTPUT);
 
+    ethernet::cs::mode(Mode::OUTPUT);
+    ethernet::cs::high();
+    ethernet::nrst::mode(Mode::OUTPUT);
+    ethernet::nrst::high();
+    ethernet::intr::mode(Mode::INPUT);
+
     DefaultConsole::instance().IRQset(intrusive_ref_ptr<Device>(new STM32Serial(
         defaultSerial, defaultSerialSpeed, STM32Serial::NOFLOWCTRL)));
 }
diff --git a/miosix/arch/cortexM7_stm32f7/stm32f767zi_automated_antennas/interfaces-impl/hwmapping.h b/miosix/arch/cortexM7_stm32f7/stm32f767zi_automated_antennas/interfaces-impl/hwmapping.h
index a1e5d4ad..c631c165 100644
--- a/miosix/arch/cortexM7_stm32f7/stm32f767zi_automated_antennas/interfaces-impl/hwmapping.h
+++ b/miosix/arch/cortexM7_stm32f7/stm32f767zi_automated_antennas/interfaces-impl/hwmapping.h
@@ -29,6 +29,9 @@
 
 #include "interfaces/gpio.h"
 
+#define MIOSIX_ETHERNET_IRQ EXTI1_IRQHandlerImpl
+#define MIOSIX_ETHERNET_SPI SPI4
+
 namespace miosix
 {
 namespace interfaces
@@ -116,4 +119,16 @@ using pulseTimer = interfaces::timers::tim4ch1;
 using countTimer = interfaces::timers::tim8ch4;
 }  // namespace stepper2
 
+namespace ethernet
+{
+namespace spi
+{
+using namespace miosix::interfaces::spi4;
+}  // namespace spi
+
+using cs   = Gpio<GPIOE_BASE, 4>;
+using intr = Gpio<GPIOC_BASE, 1>;
+using nrst = Gpio<GPIOB_BASE, 1>;
+}  // namespace ethernet
+
 }  // namespace miosix
\ No newline at end of file
-- 
GitLab