@@ -34,16 +34,11 @@ static uint16_t const UDP_SERVER_PORT = 8888;
3434 * GLOBAL VARIABLES
3535 **************************************************************************************/
3636
37- auto const tc6_io = new TC6::TC6_Io(
3837#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
39- SPI1
38+ Arduino_10BASE_T1S_PHY_TC6 ( SPI1, CS_PIN, RESET_PIN, IRQ_PIN);
4039#else
41- SPI
40+ Arduino_10BASE_T1S_PHY_TC6 ( SPI, CS_PIN, RESET_PIN, IRQ_PIN);
4241#endif
43- , CS_PIN
44- , RESET_PIN
45- , IRQ_PIN);
46- auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
4742Arduino_10BASE_T1S_UDP udp_client;
4843
4944/* *************************************************************************************
@@ -61,19 +56,19 @@ void setup()
6156 */
6257 pinMode (IRQ_PIN, INPUT_PULLUP);
6358 attachInterrupt (digitalPinToInterrupt (IRQ_PIN),
64- []() { tc6_io-> onInterrupt (); },
59+ []() { t1s_io. onInterrupt (); },
6560 FALLING);
6661
6762 /* Initialize IO module. */
68- if (!tc6_io-> begin ())
63+ if (!t1s_io. begin ())
6964 {
7065 Serial.println (" 'TC6_Io::begin(...)' failed." );
7166 for (;;) { }
7267 }
7368
7469 MacAddress const mac_addr = MacAddress::create_from_uid ();
7570
76- if (!tc6_inst-> begin (ip_addr
71+ if (!t1s_phy. begin (ip_addr
7772 , network_mask
7873 , gateway
7974 , mac_addr
@@ -104,7 +99,7 @@ void loop()
10499 /* Services the hardware and the protocol stack.
105100 * Must be called cyclic. The faster the better.
106101 */
107- tc6_inst-> service ();
102+ t1s_phy. service ();
108103
109104 static unsigned long prev_beacon_check = 0 ;
110105 static unsigned long prev_udp_packet_sent = 0 ;
@@ -114,7 +109,7 @@ void loop()
114109 if ((now - prev_beacon_check) > 1000 )
115110 {
116111 prev_beacon_check = now;
117- if (!tc6_inst-> getPlcaStatus (OnPlcaStatus))
112+ if (!t1s_phy. getPlcaStatus (OnPlcaStatus))
118113 Serial.println (" getPlcaStatus(...) failed" );
119114 }
120115
@@ -189,6 +184,6 @@ static void OnPlcaStatus(bool success, bool plcaStatus)
189184 Serial.println (" PLCA Mode active" );
190185 else {
191186 Serial.println (" CSMA/CD fallback" );
192- tc6_inst-> enablePlca ();
187+ t1s_phy. enablePlca ();
193188 }
194189}
0 commit comments