@@ -34,16 +34,11 @@ static uint16_t const UDP_SERVER_PORT = 8888;
34
34
* GLOBAL VARIABLES
35
35
**************************************************************************************/
36
36
37
- auto const tc6_io = new TC6::TC6_Io(
38
37
#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33)
39
- SPI1
38
+ Arduino_10BASE_T1S_PHY_TC6 ( SPI1, CS_PIN, RESET_PIN, IRQ_PIN);
40
39
#else
41
- SPI
40
+ Arduino_10BASE_T1S_PHY_TC6 ( SPI, CS_PIN, RESET_PIN, IRQ_PIN);
42
41
#endif
43
- , CS_PIN
44
- , RESET_PIN
45
- , IRQ_PIN);
46
- auto const tc6_inst = new TC6::TC6_Arduino_10BASE_T1S(tc6_io);
47
42
Arduino_10BASE_T1S_UDP udp_client;
48
43
49
44
/* *************************************************************************************
@@ -61,19 +56,19 @@ void setup()
61
56
*/
62
57
pinMode (IRQ_PIN, INPUT_PULLUP);
63
58
attachInterrupt (digitalPinToInterrupt (IRQ_PIN),
64
- []() { tc6_io-> onInterrupt (); },
59
+ []() { t1s_io. onInterrupt (); },
65
60
FALLING);
66
61
67
62
/* Initialize IO module. */
68
- if (!tc6_io-> begin ())
63
+ if (!t1s_io. begin ())
69
64
{
70
65
Serial.println (" 'TC6_Io::begin(...)' failed." );
71
66
for (;;) { }
72
67
}
73
68
74
69
MacAddress const mac_addr = MacAddress::create_from_uid ();
75
70
76
- if (!tc6_inst-> begin (ip_addr
71
+ if (!t1s_phy. begin (ip_addr
77
72
, network_mask
78
73
, gateway
79
74
, mac_addr
@@ -104,7 +99,7 @@ void loop()
104
99
/* Services the hardware and the protocol stack.
105
100
* Must be called cyclic. The faster the better.
106
101
*/
107
- tc6_inst-> service ();
102
+ t1s_phy. service ();
108
103
109
104
static unsigned long prev_beacon_check = 0 ;
110
105
static unsigned long prev_udp_packet_sent = 0 ;
@@ -114,7 +109,7 @@ void loop()
114
109
if ((now - prev_beacon_check) > 1000 )
115
110
{
116
111
prev_beacon_check = now;
117
- if (!tc6_inst-> getPlcaStatus (OnPlcaStatus))
112
+ if (!t1s_phy. getPlcaStatus (OnPlcaStatus))
118
113
Serial.println (" getPlcaStatus(...) failed" );
119
114
}
120
115
@@ -189,6 +184,6 @@ static void OnPlcaStatus(bool success, bool plcaStatus)
189
184
Serial.println (" PLCA Mode active" );
190
185
else {
191
186
Serial.println (" CSMA/CD fallback" );
192
- tc6_inst-> enablePlca ();
187
+ t1s_phy. enablePlca ();
193
188
}
194
189
}
0 commit comments