2019-03-26 08:57:01 +00:00
|
|
|
#include <iostream>
|
2019-03-29 10:12:31 +00:00
|
|
|
#include <cmath>
|
2019-05-15 13:39:16 +00:00
|
|
|
#include <b15f/b15f.h>
|
|
|
|
#include <b15f/plottyfile.h>
|
2019-03-26 08:57:01 +00:00
|
|
|
|
2019-05-16 08:49:30 +00:00
|
|
|
constexpr char * PLOT_FILE = "plot.bin";
|
2019-03-28 10:11:19 +00:00
|
|
|
|
2019-05-15 14:35:47 +00:00
|
|
|
int main()
|
2019-03-26 08:57:01 +00:00
|
|
|
{
|
2019-04-03 07:34:22 +00:00
|
|
|
|
2019-03-26 08:57:01 +00:00
|
|
|
B15F& drv = B15F::getInstance();
|
2019-03-29 07:32:11 +00:00
|
|
|
PlottyFile pf;
|
2019-03-27 09:33:16 +00:00
|
|
|
|
2019-03-28 10:11:19 +00:00
|
|
|
uint16_t ba[1024];
|
|
|
|
uint16_t bb[1024];
|
|
|
|
|
2019-04-03 06:40:14 +00:00
|
|
|
const uint16_t sample_count = 1024;
|
|
|
|
const uint16_t delta = 1;
|
2019-03-28 10:11:19 +00:00
|
|
|
|
|
|
|
pf.setUnitX("V");
|
2019-05-15 14:35:47 +00:00
|
|
|
pf.setUnitY("V");
|
2019-03-28 10:11:19 +00:00
|
|
|
pf.setUnitPara("V");
|
2019-05-15 14:35:47 +00:00
|
|
|
pf.setDescX("U_{OUT}");
|
|
|
|
pf.setDescY("U_{IN}");
|
|
|
|
pf.setDescPara("");
|
2019-03-28 10:11:19 +00:00
|
|
|
pf.setRefX(5);
|
2019-05-15 14:35:47 +00:00
|
|
|
pf.setRefY(5);
|
|
|
|
pf.setParaFirstCurve(0);
|
|
|
|
pf.setParaStepWidth(0);
|
2019-03-28 10:11:19 +00:00
|
|
|
|
|
|
|
uint8_t curve = 0;
|
2019-04-03 07:34:22 +00:00
|
|
|
|
|
|
|
|
2019-05-15 14:35:47 +00:00
|
|
|
drv.analogSequence(0, &ba[0], 0, 1, &bb[0], 0, 0, delta, sample_count);
|
|
|
|
|
|
|
|
for(uint16_t x = 0; x < sample_count * delta; x += delta)
|
|
|
|
{
|
2019-05-16 08:44:38 +00:00
|
|
|
drv.analogWrite0(x);
|
|
|
|
uint16_t y = drv.analogRead(0);
|
|
|
|
std::cout << x << " - " << y << std::endl;
|
|
|
|
pf.addDot(Dot(x, y, curve));
|
2019-05-15 14:35:47 +00:00
|
|
|
}
|
|
|
|
|
2019-03-29 07:32:11 +00:00
|
|
|
// speichern und plotty starten
|
2019-05-16 08:49:30 +00:00
|
|
|
pf.writeToFile(PLOT_FILE);
|
|
|
|
pf.startPlotty(PLOT_FILE);
|
2019-03-28 10:11:19 +00:00
|
|
|
}
|