analoge Ausgabe
This commit is contained in:
parent
58c97e3257
commit
167e0a3ce8
BIN
driver/cli
BIN
driver/cli
Binary file not shown.
|
@ -136,7 +136,19 @@ void show_invalid_port_input(int)
|
||||||
{
|
{
|
||||||
ViewInfo* view = new ViewInfo();
|
ViewInfo* view = new ViewInfo();
|
||||||
view->setTitle("Falsche Eingabe");
|
view->setTitle("Falsche Eingabe");
|
||||||
view->setText("Bitte geben Sie einen Wert aus dem Intervall [00, FF] an.");
|
view->setText("Bitte geben Sie einen Wert aus dem Intervall [0, FF] an.");
|
||||||
|
view->setLabelClose("[ Schliessen ]");
|
||||||
|
view->repaint();
|
||||||
|
|
||||||
|
win_stack.push_back(view);
|
||||||
|
input(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_invalid_dac_input(int)
|
||||||
|
{
|
||||||
|
ViewInfo* view = new ViewInfo();
|
||||||
|
view->setTitle("Falsche Eingabe");
|
||||||
|
view->setText("Bitte geben Sie einen Wert aus dem Intervall [0, 1023] an.");
|
||||||
view->setLabelClose("[ Schliessen ]");
|
view->setLabelClose("[ Schliessen ]");
|
||||||
view->repaint();
|
view->repaint();
|
||||||
|
|
||||||
|
@ -176,6 +188,42 @@ void write_digital_output1(int)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void write_analog_output0(int)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
uint16_t port = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput());
|
||||||
|
if(port > 1023)
|
||||||
|
throw std::invalid_argument("bad value");
|
||||||
|
|
||||||
|
B15F& drv = B15F::getInstance();
|
||||||
|
drv.analogWrite0(port);
|
||||||
|
view_back(0);
|
||||||
|
}
|
||||||
|
catch(std::invalid_argument& ex)
|
||||||
|
{
|
||||||
|
show_invalid_dac_input(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_analog_output1(int)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
uint16_t port = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput());
|
||||||
|
if(port > 1023)
|
||||||
|
throw std::invalid_argument("bad value");
|
||||||
|
|
||||||
|
B15F& drv = B15F::getInstance();
|
||||||
|
drv.analogWrite1(port);
|
||||||
|
view_back(0);
|
||||||
|
}
|
||||||
|
catch(std::invalid_argument& ex)
|
||||||
|
{
|
||||||
|
show_invalid_dac_input(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void show_digital_output0(int)
|
void show_digital_output0(int)
|
||||||
{
|
{
|
||||||
ViewPromt* view = new ViewPromt();
|
ViewPromt* view = new ViewPromt();
|
||||||
|
@ -202,6 +250,32 @@ void show_digital_output1(int)
|
||||||
input(0);
|
input(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void show_analog_output0(int)
|
||||||
|
{
|
||||||
|
ViewPromt* view = new ViewPromt();
|
||||||
|
view->setTitle("Analoge Ausgabe AA0");
|
||||||
|
view->setMessage("\nEingabe 10-Bit-Wert (0...1023): ");
|
||||||
|
view->setCancel("[ Zurueck ]", true);
|
||||||
|
view->setConfirm("[ OK ]", &write_analog_output0);
|
||||||
|
view->repaint();
|
||||||
|
|
||||||
|
win_stack.push_back(view);
|
||||||
|
input(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_analog_output1(int)
|
||||||
|
{
|
||||||
|
ViewPromt* view = new ViewPromt();
|
||||||
|
view->setTitle("Analoge Ausgabe AA1");
|
||||||
|
view->setMessage("\nEingabe 10-Bit-Wert (0...1023): ");
|
||||||
|
view->setCancel("[ Zurueck ]", true);
|
||||||
|
view->setConfirm("[ OK ]", &write_analog_output1);
|
||||||
|
view->repaint();
|
||||||
|
|
||||||
|
win_stack.push_back(view);
|
||||||
|
input(0);
|
||||||
|
}
|
||||||
|
|
||||||
void show_main(int)
|
void show_main(int)
|
||||||
{
|
{
|
||||||
ViewSelection* view = new ViewSelection();
|
ViewSelection* view = new ViewSelection();
|
||||||
|
@ -209,8 +283,8 @@ void show_main(int)
|
||||||
view->addChoice("[ Monitor - Eingaben beobachten ]", &show_monitor);
|
view->addChoice("[ Monitor - Eingaben beobachten ]", &show_monitor);
|
||||||
view->addChoice("[ Digitale Ausgabe BE0 ]", &show_digital_output0);
|
view->addChoice("[ Digitale Ausgabe BE0 ]", &show_digital_output0);
|
||||||
view->addChoice("[ Digitale Ausgabe BE1 ]", &show_digital_output1);
|
view->addChoice("[ Digitale Ausgabe BE1 ]", &show_digital_output1);
|
||||||
view->addChoice("[ Analoge Ausgabe AA0 ]", &show_monitor);
|
view->addChoice("[ Analoge Ausgabe AA0 ]", &show_analog_output0);
|
||||||
view->addChoice("[ Analoge Ausgabe AA1 ]", &show_monitor);
|
view->addChoice("[ Analoge Ausgabe AA1 ]", &show_analog_output1);
|
||||||
view->addChoice("[ Informationen ]", &show_info);
|
view->addChoice("[ Informationen ]", &show_info);
|
||||||
view->addChoice("", nullptr);
|
view->addChoice("", nullptr);
|
||||||
view->addChoice("[ Beenden ]", &finish);
|
view->addChoice("[ Beenden ]", &finish);
|
||||||
|
|
Loading…
Reference in a new issue