mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-24 16:20:49 +01:00
28 lines
698 B
C++
28 lines
698 B
C++
#include "command.h"
|
|
#include <ion.h>
|
|
#include <poincare/print_float.h>
|
|
#include <ion/src/device/led.h>
|
|
|
|
namespace Ion {
|
|
namespace Device {
|
|
namespace Bench {
|
|
namespace Command {
|
|
|
|
void ADC(const char * input) {
|
|
if (input != nullptr) {
|
|
reply(sSyntaxError);
|
|
return;
|
|
}
|
|
float result = Ion::Battery::voltage();
|
|
constexpr int precision = 8;
|
|
constexpr int bufferSize = Poincare::PrintFloat::bufferSizeForFloatsWithPrecision(precision);
|
|
char responseBuffer[bufferSize+4] = {'A', 'D', 'C', '='}; // ADC=
|
|
Poincare::PrintFloat::convertFloatToText<float>(result, responseBuffer+4, bufferSize, precision, Poincare::Preferences::PrintFloatMode::Decimal);
|
|
reply(responseBuffer);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|