Blame view

build3/ion/src/device/bench/command/adc.cpp 635 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  #include "command.h"
  #include <ion.h>
  #include <poincare.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::Complex<float>::convertFloatToText(result, responseBuffer+4, bufferSize, precision);
    reply(responseBuffer);
  }
  
  }
  }
  }
  }