From 447568c7238243c7ae59badbed4d712c19189004 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Tue, 21 May 2024 16:00:33 +0200 Subject: [PATCH] c33: eth: move clock pins to variant --- libraries/Ethernet/src/EthernetClock.cpp | 22 +++++++++++++++++++--- libraries/Ethernet/src/EthernetClock.h | 4 ---- variants/PORTENTA_C33/pins_arduino.h | 5 ++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/libraries/Ethernet/src/EthernetClock.cpp b/libraries/Ethernet/src/EthernetClock.cpp index c3fb5b9d6..a38fbe5ea 100644 --- a/libraries/Ethernet/src/EthernetClock.cpp +++ b/libraries/Ethernet/src/EthernetClock.cpp @@ -1,6 +1,7 @@ #include "EthernetClock.h" +#include "pins_arduino.h" - +#if defined(ETHERNET_CLK_PIN) EthernetClock::EthernetClock() { pinPeripheral(ETHERNET_CLK_PIN, (uint32_t) (IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_AGT)); @@ -18,7 +19,7 @@ EthernetClock::EthernetClock() { this->TIMER_ETHERNET_cfg.period_counts = (uint32_t) 0x1; this->TIMER_ETHERNET_cfg.duty_cycle_counts = 0x00; this->TIMER_ETHERNET_cfg.source_div = (timer_source_div_t) 0; - this->TIMER_ETHERNET_cfg.channel = AGT_TIMER_CHANNEL; + this->TIMER_ETHERNET_cfg.channel = ETHERNET_AGT_TIMER_CHANNEL; this->TIMER_ETHERNET_cfg.p_callback = NULL; this->TIMER_ETHERNET_cfg.p_context = NULL; this->TIMER_ETHERNET_cfg.p_extend = &TIMER_ETHERNET_extend; @@ -40,7 +41,7 @@ fsp_err_t EthernetClock::start() { return err; } - FspTimer::set_timer_is_used(AGT_TIMER, AGT_TIMER_CHANNEL); + FspTimer::set_timer_is_used(AGT_TIMER, ETHERNET_AGT_TIMER_CHANNEL); return err; } @@ -60,3 +61,18 @@ fsp_err_t EthernetClock::stop() { } } } + +#else + +EthernetClock::EthernetClock() { +} + +fsp_err_t EthernetClock::start() { + return FSP_SUCCESS; +} + +fsp_err_t EthernetClock::stop() { + return FSP_SUCCESS; +} + +#endif \ No newline at end of file diff --git a/libraries/Ethernet/src/EthernetClock.h b/libraries/Ethernet/src/EthernetClock.h index 4c22aa3da..0e3940f91 100644 --- a/libraries/Ethernet/src/EthernetClock.h +++ b/libraries/Ethernet/src/EthernetClock.h @@ -4,10 +4,6 @@ #include "FspTimer.h" -#define AGT_TIMER_CHANNEL 3 -#define ETHERNET_CLK_PIN BSP_IO_PORT_06_PIN_00 - - class EthernetClock { public: EthernetClock(); diff --git a/variants/PORTENTA_C33/pins_arduino.h b/variants/PORTENTA_C33/pins_arduino.h index 898a1940d..98bc950da 100644 --- a/variants/PORTENTA_C33/pins_arduino.h +++ b/variants/PORTENTA_C33/pins_arduino.h @@ -208,4 +208,7 @@ static const uint8_t SS = PIN_SPI_CS; #define RTC_CLOCK_SOURCE RTC_CLOCK_SOURCE_SUBCLK -#define AR_INTERNAL_VOLTAGE 1.18f \ No newline at end of file +#define AR_INTERNAL_VOLTAGE 1.18f + +#define ETHERNET_AGT_TIMER_CHANNEL 3 +#define ETHERNET_CLK_PIN BSP_IO_PORT_06_PIN_00