Skip to content

Commit f794ddc

Browse files
committed
Automatically print the correct DIO name.
1 parent 219449f commit f794ddc

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

examples/tools/Control-DIOx/Control-DIOx.ino

+18-9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ static IPAddress const gateway {192, 168, 42, 100};
2727
static T1SPlcaSettings const t1s_plca_settings{T1S_PLCA_NODE_ID};
2828
static T1SMacSettings const t1s_default_mac_settings;
2929

30+
/* Modify this function call parameter if you want to test a different LAN8651 DIO.
31+
*/
32+
static auto const DIO_PIN = TC6::DIO::A0;
33+
3034
/**************************************************************************************
3135
* GLOBAL VARIABLES
3236
**************************************************************************************/
@@ -81,10 +85,6 @@ void setup()
8185
Serial.println(mac_addr);
8286
Serial.println(t1s_plca_settings);
8387
Serial.println(t1s_default_mac_settings);
84-
85-
// If Power Provider, turn on LOCAL_ENABLE and turn on T1S_DISABLE
86-
//tc6_inst->digitalWrite(1,1,1);
87-
//tc6_inst->digitalWrite(0,0,0);
8888
}
8989

9090
void loop()
@@ -103,13 +103,22 @@ void loop()
103103

104104
static bool dio_val = false;
105105

106-
Serial.print("DIO A0 = ");
106+
Serial.print("DIO ");
107+
Serial.print(toStr(DIO_PIN));
108+
Serial.print(" = ");
107109
Serial.println(dio_val);
108110

109-
/* Modify this function call parameter if you want
110-
* to test a different LAN8651 DIO.
111-
*/
112-
tc6_inst->digitalWrite(TC6::DIO::A1, dio_val);
111+
tc6_inst->digitalWrite(DIO_PIN, dio_val);
113112
dio_val = !dio_val;
114113
}
115114
}
115+
116+
String toStr(TC6::DIO const dio)
117+
{
118+
if (dio == TC6::DIO::A0)
119+
return String("A0");
120+
else if (dio == TC6::DIO::A1)
121+
return String("A1");
122+
else
123+
return String("");
124+
}

0 commit comments

Comments
 (0)