Add setDigitalRead command handler type and command handler.

This commit is contained in:
anecdata
2019-10-13 14:13:15 -05:00
parent e813fbe664
commit b90bbd6349

View File

@@ -994,6 +994,19 @@ int setAnalogWrite(const uint8_t command[], uint8_t response[])
return 6;
}
int setDigitalRead(const uint8_t command[], uint8_t response[])
{
uint8_t pin = command[4];
int8_t value = digitalRead(pin);
response[2] = 1; // number of parameters
response[3] = 1; // parameter 1 length
response[4] = value;
return 6;
}
int wpa2EntSetIdentity(const uint8_t command[], uint8_t response[]) {
char identity[32 + 1];
@@ -1112,7 +1125,7 @@ const CommandHandlerType commandHandlers[] = {
setClientCert, setCertKey, NULL, NULL, sendDataTcp, getDataBufTcp, insertDataBuf, NULL, NULL, NULL, wpa2EntSetIdentity, wpa2EntSetUsername, wpa2EntSetPassword, wpa2EntSetCACert, wpa2EntSetCertKey, wpa2EntEnable,
// 0x50 -> 0x5f
setPinMode, setDigitalWrite, setAnalogWrite,
setPinMode, setDigitalWrite, setAnalogWrite, setDigitalRead,
};
#define NUM_COMMAND_HANDLERS (sizeof(commandHandlers) / sizeof(commandHandlers[0]))