Add basic ADC calibration.

This commit is contained in:
anecdata
2019-10-17 00:12:35 -05:00
parent b9c66fa1b1
commit 6bb17bb179
3 changed files with 23 additions and 5 deletions

View File

@@ -1010,11 +1010,13 @@ int setDigitalRead(const uint8_t command[], uint8_t response[])
int setAnalogRead(const uint8_t command[], uint8_t response[])
{
uint8_t pin = command[4];
uint8_t atten = command[6];
int value = digitalRead(pin);
int value = analogRead(pin, atten);
response[2] = 1; // number of parameters
response[3] = sizeof(value); // parameter 1 length
memcpy(&response[4], &value, sizeof(value));
return 5 + sizeof(value);