Add setAnalogRead type & command handler. Add core analogRead function.
This commit is contained in:
@@ -1007,6 +1007,19 @@ int setDigitalRead(const uint8_t command[], uint8_t response[])
|
||||
return 6;
|
||||
}
|
||||
|
||||
int setAnalogRead(const uint8_t command[], uint8_t response[])
|
||||
{
|
||||
uint8_t pin = command[4];
|
||||
|
||||
int value = digitalRead(pin);
|
||||
|
||||
response[2] = 1; // number of parameters
|
||||
response[3] = sizeof(value); // parameter 1 length
|
||||
memcpy(&response[4], &value, sizeof(value));
|
||||
|
||||
return 5 + sizeof(value);
|
||||
}
|
||||
|
||||
int wpa2EntSetIdentity(const uint8_t command[], uint8_t response[]) {
|
||||
char identity[32 + 1];
|
||||
|
||||
@@ -1125,7 +1138,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, setDigitalRead,
|
||||
setPinMode, setDigitalWrite, setAnalogWrite, setDigitalRead, setAnalogRead,
|
||||
};
|
||||
|
||||
#define NUM_COMMAND_HANDLERS (sizeof(commandHandlers) / sizeof(commandHandlers[0]))
|
||||
|
||||
Reference in New Issue
Block a user