Skip to content

Commit

Permalink
c33: eth: move clock pins to variant
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed May 21, 2024
1 parent 667009a commit 447568c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
22 changes: 19 additions & 3 deletions libraries/Ethernet/src/EthernetClock.cpp
Original file line number Diff line number Diff line change
@@ -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));
Expand All @@ -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;
Expand All @@ -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;
}

Expand All @@ -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
4 changes: 0 additions & 4 deletions libraries/Ethernet/src/EthernetClock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion variants/PORTENTA_C33/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
#define AR_INTERNAL_VOLTAGE 1.18f

#define ETHERNET_AGT_TIMER_CHANNEL 3
#define ETHERNET_CLK_PIN BSP_IO_PORT_06_PIN_00

0 comments on commit 447568c

Please sign in to comment.