From b4996e84c81e9973a7e1b5661dcc0c6ab3935f4a Mon Sep 17 00:00:00 2001 From: Tristan Krause Date: Tue, 4 Jun 2019 10:28:01 +0200 Subject: [PATCH] b15f.cpp uses only usart transmit & receive --- control/bin/b15fcli | Bin 0 -> 89776 bytes control/src/.idea/workspace.xml | 81 ++-- control/src/drv/b15f.cpp | 268 ++++++----- control/src/drv/b15f.cpp.orig | 439 ++++++++++++++++++ docs/html/CMakeCCompilerId_8c_source.html | 2 +- docs/html/CMakeCXXCompilerId_8cpp_source.html | 2 +- docs/html/annotated.html | 2 +- docs/html/b15f_8cpp_source.html | 51 +- docs/html/b15f_8h_source.html | 48 +- docs/html/backup_8cpp_source.html | 4 +- docs/html/classB15F-members.html | 2 +- docs/html/classB15F.html | 50 +- docs/html/classDot-members.html | 2 +- docs/html/classDot.html | 2 +- docs/html/classDriverException-members.html | 2 +- docs/html/classDriverException.html | 2 +- docs/html/classPlottyFile-members.html | 2 +- docs/html/classPlottyFile.html | 2 +- docs/html/classTimeoutException-members.html | 2 +- docs/html/classTimeoutException.html | 2 +- docs/html/classUSART-members.html | 2 +- docs/html/classUSART.html | 2 +- docs/html/classUSARTException-members.html | 2 +- docs/html/classUSARTException.html | 10 +- docs/html/classView-members.html | 2 +- docs/html/classView.html | 2 +- docs/html/classViewInfo-members.html | 2 +- docs/html/classViewInfo.html | 2 +- docs/html/classViewMonitor-members.html | 2 +- docs/html/classViewMonitor.html | 2 +- docs/html/classViewPromt-members.html | 2 +- docs/html/classViewPromt.html | 2 +- docs/html/classViewSelection-members.html | 2 +- docs/html/classViewSelection.html | 2 +- docs/html/classes.html | 2 +- docs/html/cli_8cpp_source.html | 6 +- .../dir_1788f8309b1a812dcb800a185471cf6c.html | 2 +- .../dir_19f2f1b99f19c12fa55b8d312cf373ed.html | 2 +- .../dir_3d3c8ff3ebf9841b39117ac899f41936.html | 2 +- .../dir_587c94d866dbb2f408f78cf41f9b2f8d.html | 2 +- .../dir_90e361ec3542f3dd076ea3ad19547437.html | 2 +- .../dir_95e29a8b8ee7c54052c171a88bb95675.html | 2 +- .../dir_f89abcb304c928c7d889aa5625570de5.html | 2 +- docs/html/dot_8cpp_source.html | 2 +- docs/html/dot_8h_source.html | 2 +- docs/html/driverexception_8h_source.html | 2 +- docs/html/feature__tests_8c_source.html | 2 +- docs/html/feature__tests_8cxx_source.html | 2 +- docs/html/files.html | 2 +- docs/html/functions.html | 2 +- docs/html/functions_func.html | 2 +- docs/html/functions_vars.html | 2 +- docs/html/hierarchy.html | 2 +- docs/html/index.html | 2 +- docs/html/plottyfile_8cpp_source.html | 2 +- docs/html/plottyfile_8h_source.html | 2 +- docs/html/timeoutexception_8h_source.html | 2 +- docs/html/ui_8cpp_source.html | 16 +- docs/html/ui_8h_source.html | 2 +- docs/html/usart_8cpp_source.html | 4 +- docs/html/usart_8h_source.html | 2 +- docs/html/usartexception_8h_source.html | 14 +- docs/html/view_8cpp_source.html | 4 +- docs/html/view_8h_source.html | 2 +- docs/html/view__info_8cpp_source.html | 2 +- docs/html/view__info_8h_source.html | 2 +- docs/html/view__monitor_8cpp_source.html | 16 +- docs/html/view__monitor_8h_source.html | 2 +- docs/html/view__promt_8cpp_source.html | 2 +- docs/html/view__promt_8h_source.html | 2 +- docs/html/view__selection_8cpp_source.html | 2 +- docs/html/view__selection_8h_source.html | 2 +- 72 files changed, 806 insertions(+), 319 deletions(-) create mode 100755 control/bin/b15fcli create mode 100644 control/src/drv/b15f.cpp.orig diff --git a/control/bin/b15fcli b/control/bin/b15fcli new file mode 100755 index 0000000000000000000000000000000000000000..65fe6788a7403dc068f3ec4d196a91e1345ea8ac GIT binary patch literal 89776 zcmeFaeP9&T^*6qOEJOrnQPf!V>#D0Iz9zgV5z!4vU{*F51r$Y1AS5Ibl9+5DC`jxk z!gSphYi(_7TUz@<)mEz3A}WNp1g*94ovM{+eVH*T5f$-`{63#^XEu{fR_(XX^VjcL zB|G=bz2}~L?m6e4bMBqlRfXYcL(i{-7tk|-LMk{?tHH~M2em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L+yRz+}&Nw#!Pyx%iX$+$vR@-goql+f^Hg&;c>rF&+rHs=ybrizFI`tQZ z8tX}rv@3ba8osT#PwT8C90lg8;(TsanLdY1=`1v4N}~vhQyd=__M?UKlL8ju5(H@O$^)OdNAYi+Yp*qK~u%OToAOy$y1y)Tx|=0ec;#bpAfQ-8DRZ8#G!Y6Y%j z3!u>Yw1hc363c|~S#WN-wq>isSSmJm4&H@~>k;NCv#7UadU%JUJ>7y{+-UhTr3`$5sNS%J@tez@$yAhB|uNWY+8i$Vfz7JU^hJI2uoxAj}k~yNP%5XGAXM0E`b7JBgi=d(WM2B(* zNnX-WZ!8QC9hC6Fh-5gaLmyk0uOO5jJN(Rk96M(Y{G2kSy2nOA90NBvid*V%922+A z6w|j$LJE3IBg5}DJqPeynm#MjD~RKj24_y+giw55TfNp*xIahTqa$A@q#Ja&Q}2t( zN45wadiO%rAD6cXC*cO1J10lyg{kf;y*ekn6gY~i(yRM;6jb-HAqsb9{(T)-y5mfx zSNHZPsP3&(*xZ{XC5_rj_B;nY2Hl%CR<(_aD{6_LtEPQ8Dnpn6|MgpQVSnb)jdiIj#vFbrZe}y`%LN8eM<^%z(o7s`SU1@S;?r%oIe=N_I=5E|d9t@%{@rybi?ZRRvXkrN5|usj|aca4Wwea{Aga a1r+zF{1ukY=3Axz{plj+;id$pNA|y4v_(w- literal 0 HcmV?d00001 diff --git a/control/src/.idea/workspace.xml b/control/src/.idea/workspace.xml index 87a7f90..e3f79b8 100644 --- a/control/src/.idea/workspace.xml +++ b/control/src/.idea/workspace.xml @@ -12,9 +12,7 @@ - - - + - @@ -225,7 +214,7 @@ - + @@ -242,42 +231,42 @@ - + - + - - + + - - - - - - - - - + + - - + + + + + + + + + - + @@ -285,10 +274,10 @@ - + - - + + diff --git a/control/src/drv/b15f.cpp b/control/src/drv/b15f.cpp index 208bfff..4febe04 100644 --- a/control/src/drv/b15f.cpp +++ b/control/src/drv/b15f.cpp @@ -1,6 +1,6 @@ #include "b15f.h" -B15F* B15F::instance = nullptr; +B15F *B15F::instance = nullptr; errorhandler_t B15F::errorhandler = nullptr; B15F::B15F() @@ -12,57 +12,57 @@ void B15F::init() { std::string device = exec("bash -c 'ls /dev/ttyUSB*'"); - while(device.find(' ') != std::string::npos || device.find('\n') != std::string::npos || device.find('\t') != std::string::npos) + while (device.find(' ') != std::string::npos || device.find('\n') != std::string::npos || + device.find('\t') != std::string::npos) device.pop_back(); - if(device.length() == 0) + if (device.length() == 0) abort("Adapter nicht gefunden"); std::cout << PRE << "Verwende Adapter: " << device << std::endl; - std::cout << PRE << "Stelle Verbindung mit Adapter her... " << std::flush; usart.setBaudrate(BAUDRATE); usart.openDevice(device); std::cout << "OK" << std::endl; - std::cout << PRE << "Teste Verbindung... " << std::flush; uint8_t tries = 3; - while(tries--) + while (tries--) { // verwerfe Daten, die µC noch hat //discard(); - if(!testConnection()) + if (!testConnection()) continue; - if(!testIntConv()) + if (!testIntConv()) continue; break; } - if(tries == 0) + if (tries == 0) abort("Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?"); std::cout << "OK" << std::endl; // Gib board info aus std::vector info = getBoardInfo(); - std::cout << PRE << "AVR Firmware Version: " << info[0] << " um " << info[1] << " Uhr (" << info[2] << ")" << std::endl; + std::cout << PRE << "AVR Firmware Version: " << info[0] << " um " << info[1] << " Uhr (" << info[2] << ")" + << std::endl; } void B15F::reconnect() { uint8_t tries = RECONNECT_TRIES; - while(tries--) + while (tries--) { delay_ms(RECONNECT_TIMEOUT); discard(); - if(testConnection()) + if (testConnection()) return; } @@ -73,15 +73,20 @@ void B15F::discard(void) { try { - usart.clearOutputBuffer(); - for(uint8_t i = 0; i < 16; i++) + uint8_t rq[] = { - usart.writeByte(RQ_DISC); // sende discard Befehl (verwerfe input) + RQ_DISC + }; + + usart.clearOutputBuffer(); + for (uint8_t i = 0; i < 16; i++) + { + usart.transmit(&rq[0], 0, sizeof(rq)); // sende discard Befehl (verwerfe input) delay_ms(4); } usart.clearInputBuffer(); } - catch(std::exception& ex) + catch (std::exception &ex) { abort(ex); } @@ -93,13 +98,17 @@ bool B15F::testConnection() srand(time(NULL)); uint8_t dummy = rand() % 256; - usart.writeByte(RQ_TEST); - usart.writeByte(dummy); + uint8_t rq[] = + { + RQ_TEST, + dummy + }; + usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t aw = usart.readByte(); - uint8_t mirror = usart.readByte(); + uint8_t aw[2]; + usart.receive(&aw[0], 0, sizeof(aw)); - return aw == MSG_OK && mirror == dummy; + return aw[0] == MSG_OK && aw[1] == dummy; } bool B15F::testIntConv() @@ -107,10 +116,17 @@ bool B15F::testIntConv() srand(time(NULL)); uint16_t dummy = rand() % (0xFFFF / 3); - usart.writeByte(RQ_INT); - usart.writeInt(dummy); + uint8_t rq[] = + { + RQ_INT, + static_cast(dummy & 0xFF), + static_cast(dummy >> 8) + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint16_t aw; + usart.receive(reinterpret_cast(&aw), 0, sizeof(aw)); - uint16_t aw = usart.readInt(); return aw == dummy * 3; } @@ -119,24 +135,30 @@ std::vector B15F::getBoardInfo(void) { std::vector info; - usart.writeByte(RQ_INFO); - - uint8_t n = usart.readByte(); - while(n--) + uint8_t rq[] = { - uint8_t len = usart.readByte(); - std::string str; + RQ_INFO + }; + usart.transmit(&rq[0], 0, sizeof(rq)); - while(len--) - { - str += static_cast(usart.readByte()); - } + uint8_t n; + usart.receive(&n, 0, sizeof(n)); - info.push_back(str); + while (n--) + { + uint8_t len; + usart.receive(&len, 0, sizeof(len)); + + char str[len + 1]; + str[len] = '\0'; + usart.receive(reinterpret_cast(&str[0]), 0, len); + + info.push_back(std::string(str)); } - uint8_t aw = usart.readByte(); - if(aw != MSG_OK) + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + if (aw != MSG_OK) abort("Board Info fehlerhalft: code " + std::to_string((int) aw)); return info; @@ -144,83 +166,121 @@ std::vector B15F::getBoardInfo(void) bool B15F::activateSelfTestMode() { - usart.writeByte(RQ_ST); + uint8_t rq[] = + { + RQ_ST + }; + usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t aw = usart.readByte(); + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); return aw == MSG_OK; } bool B15F::digitalWrite0(uint8_t port) { - usart.writeByte(RQ_BA0); - usart.writeByte(port); + uint8_t rq[] = + { + RQ_BA0, + port + }; + usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t aw = usart.readByte(); - delay_us(10); + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); return aw == MSG_OK; } bool B15F::digitalWrite1(uint8_t port) { - usart.writeByte(RQ_BA1); - usart.writeByte(port); + uint8_t rq[] = + { + RQ_BA1, + port + }; + usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t aw = usart.readByte(); - delay_us(10); + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); return aw == MSG_OK; } uint8_t B15F::digitalRead0() { usart.clearInputBuffer(); - usart.writeByte(RQ_BE0); - uint8_t byte = usart.readByte(); - delay_us(10); - return byte; + uint8_t rq[] = + { + RQ_BE0 + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; } uint8_t B15F::digitalRead1() { usart.clearInputBuffer(); - usart.writeByte(RQ_BE1); - uint8_t byte = usart.readByte(); - delay_us(10); - return byte; + uint8_t rq[] = + { + RQ_BE1 + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; } uint8_t B15F::readDipSwitch() { usart.clearInputBuffer(); - usart.writeByte(RQ_DSW); - uint8_t byte = usart.readByte(); - delay_us(10); - return byte; + uint8_t rq[] = + { + RQ_DSW + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; } bool B15F::analogWrite0(uint16_t value) { - usart.writeByte(RQ_AA0); - usart.writeInt(value); + uint8_t rq[] = + { + RQ_AA0, + static_cast(value & 0xFF), + static_cast(value >> 8) + }; + usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t aw = usart.readByte(); - delay_us(10); + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); return aw == MSG_OK; } bool B15F::analogWrite1(uint16_t value) { - usart.writeByte(RQ_AA1); - usart.writeInt(value); + uint8_t rq[] = + { + RQ_AA1, + static_cast(value & 0xFF), + static_cast(value >> 8) + }; + usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t aw = usart.readByte(); - delay_us(10); + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); return aw == MSG_OK; } uint16_t B15F::analogRead(uint8_t channel) { usart.clearInputBuffer(); - if(channel > 7) + if (channel > 7) abort("Bad ADC channel: " + std::to_string(channel)); uint8_t rq[] = @@ -231,16 +291,20 @@ uint16_t B15F::analogRead(uint8_t channel) usart.transmit(&rq[0], 0, sizeof(rq)); - uint16_t adc = usart.readInt(); + uint16_t aw; + usart.receive(reinterpret_cast(&aw), 0, sizeof(aw)); - if(adc > 1023) + if (aw > 1023) abort("Bad ADC data detected (1)"); - return adc; + return aw; } -void B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count) +void +B15F::analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b, + uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count) { - // check pointers + /* + // prepare pointers buffer_a += offset_a; buffer_b += offset_b; @@ -253,38 +317,31 @@ void B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset usart.writeInt(static_cast(delta)); usart.writeInt(count); - for(uint16_t i = 0; i < count; i++) - { - if(buffer_a) - { + for (uint16_t i = 0; i < count; i++) { + if (buffer_a) { buffer_a[i] = usart.readInt(); - if(buffer_a[i] > 1023) // check for broken usart connection + if (buffer_a[i] > 1023) // check for broken usart connection abort("Bad ADC data detected (2)"); - } - else - { + } else { usart.readInt(); } - if(buffer_b) - { + if (buffer_b) { buffer_b[i] = usart.readInt(); - if(buffer_b[i] > 1023) // check for broken usart connection + if (buffer_b[i] > 1023) // check for broken usart connection abort("Bad ADC data detected (3)"); - } - else - { + } else { usart.readInt(); } } uint8_t aw = usart.readByte(); - if(aw != MSG_OK) + if (aw != MSG_OK) abort("Sequenz unterbrochen"); - delay_us(10); + delay_us(10);*/ } uint8_t B15F::pwmSetFrequency(uint32_t freq) @@ -294,17 +351,17 @@ uint8_t B15F::pwmSetFrequency(uint32_t freq) uint8_t rq[] = { RQ_PWM_SET_FREQ, - static_cast((freq >> 0) & 0xFF), - static_cast((freq >> 8) & 0xFF), + static_cast((freq >> 0) & 0xFF), + static_cast((freq >> 8) & 0xFF), static_cast((freq >> 16) & 0xFF), static_cast((freq >> 24) & 0xFF) }; usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t byte = usart.readByte(); - delay_us(10); - return byte; + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; } bool B15F::pwmSetValue(uint8_t value) @@ -319,8 +376,8 @@ bool B15F::pwmSetValue(uint8_t value) usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t aw = usart.readByte(); - delay_us(10); + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); return aw == MSG_OK; } @@ -337,9 +394,9 @@ bool B15F::setRegister(uint8_t adr, uint8_t val) usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t byte = usart.readByte(); - delay_us(10); - return byte == val; + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw == val; } uint8_t B15F::getRegister(uint8_t adr) @@ -354,8 +411,8 @@ uint8_t B15F::getRegister(uint8_t adr) usart.transmit(&rq[0], 0, sizeof(rq)); - uint8_t aw = usart.readByte(); - delay_us(10); + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); return aw; } @@ -370,9 +427,9 @@ void B15F::delay_us(uint16_t us) std::this_thread::sleep_for(std::chrono::microseconds(us)); } -B15F& B15F::getInstance(void) +B15F &B15F::getInstance(void) { - if(!instance) + if (!instance) instance = new B15F(); return *instance; @@ -400,9 +457,10 @@ void B15F::abort(std::string msg) DriverException ex(msg); abort(ex); } -void B15F::abort(std::exception& ex) + +void B15F::abort(std::exception &ex) { - if(errorhandler) + if (errorhandler) errorhandler(ex); else { diff --git a/control/src/drv/b15f.cpp.orig b/control/src/drv/b15f.cpp.orig new file mode 100644 index 0000000..b8d1d62 --- /dev/null +++ b/control/src/drv/b15f.cpp.orig @@ -0,0 +1,439 @@ +#include "b15f.h" + +B15F *B15F::instance = nullptr; +errorhandler_t B15F::errorhandler = nullptr; + +B15F::B15F() { + init(); +} + +void B15F::init() { + + std::string device = exec("bash -c 'ls /dev/ttyUSB*'"); + while (device.find(' ') != std::string::npos || device.find('\n') != std::string::npos || + device.find('\t') != std::string::npos) + device.pop_back(); + + if (device.length() == 0) + abort("Adapter nicht gefunden"); + + std::cout << PRE << "Verwende Adapter: " << device << std::endl; + + + std::cout << PRE << "Stelle Verbindung mit Adapter her... " << std::flush; + usart.setBaudrate(BAUDRATE); + usart.openDevice(device); + std::cout << "OK" << std::endl; + + + std::cout << PRE << "Teste Verbindung... " << std::flush; + uint8_t tries = 3; + while (tries--) { + // verwerfe Daten, die µC noch hat + //discard(); + + if (!testConnection()) + continue; + + if (!testIntConv()) + continue; + + break; + } + if (tries == 0) + abort("Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?"); + std::cout << "OK" << std::endl; + + + // Gib board info aus + std::vector info = getBoardInfo(); + std::cout << PRE << "AVR Firmware Version: " << info[0] << " um " << info[1] << " Uhr (" << info[2] << ")" + << std::endl; +} + +void B15F::reconnect() { + uint8_t tries = RECONNECT_TRIES; + while (tries--) { + delay_ms(RECONNECT_TIMEOUT); + discard(); + + if (testConnection()) + return; + } + + abort("Verbindung kann nicht repariert werden"); +} + +void B15F::discard(void) { + try { + uint8_t rq[] = + { + RQ_DISC + }; + + usart.clearOutputBuffer(); + for (uint8_t i = 0; i < 16; i++) { + usart.transmit(&rq[0], 0, sizeof(rq)); // sende discard Befehl (verwerfe input) + delay_ms(4); + } + usart.clearInputBuffer(); + } + catch (std::exception &ex) { + abort(ex); + } +} + +bool B15F::testConnection() { + // erzeuge zufälliges Byte + srand(time(NULL)); + uint8_t dummy = rand() % 256; + + uint8_t rq[] = + { + RQ_TEST, + dummy + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw[2]; + usart.receive(&aw[0], 0, sizeof(aw)); + + return aw[0] == MSG_OK && aw[1] == dummy; +} + +bool B15F::testIntConv() { + srand(time(NULL)); + uint16_t dummy = rand() % (0xFFFF / 3); + + uint8_t rq[] = + { + RQ_INT, + static_cast(dummy & 0xFF), + static_cast(dummy >> 8) + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint16_t aw; + usart.receive(reinterpret_cast(&aw), 0, sizeof(aw)); + + return aw == dummy * 3; +} + + +std::vector B15F::getBoardInfo(void) { + std::vector info; + + uint8_t rq[] = + { + RQ_INFO + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t n; + usart.receive(&n, 0, sizeof(n)); + + while (n--) { + uint8_t len; + usart.receive(&len, 0, sizeof(len)); + + char str[len + 1]; + str[len] = '\0'; + usart.receive(reinterpret_cast(&str[0]), 0, len); + + info.push_back(std::string(str)); + } + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + if (aw != MSG_OK) + abort("Board Info fehlerhalft: code " + std::to_string((int) aw)); + + return info; +} + +bool B15F::activateSelfTestMode() { + uint8_t rq[] = + { + RQ_ST + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw == MSG_OK; +} + +bool B15F::digitalWrite0(uint8_t port) { + uint8_t rq[] = + { + RQ_BA0, + port + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw == MSG_OK; +} + +bool B15F::digitalWrite1(uint8_t port) { + uint8_t rq[] = + { + RQ_BA1, + port + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw == MSG_OK; +} + +uint8_t B15F::digitalRead0() { + usart.clearInputBuffer(); + uint8_t rq[] = + { + RQ_BE0 + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; +} + +uint8_t B15F::digitalRead1() { + usart.clearInputBuffer(); + uint8_t rq[] = + { + RQ_BE1 + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; +} + +uint8_t B15F::readDipSwitch() { + usart.clearInputBuffer(); + uint8_t rq[] = + { + RQ_DSW + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; +} + +bool B15F::analogWrite0(uint16_t value) { + uint8_t rq[] = + { + RQ_AA0, + static_cast(value & 0xFF), + static_cast(value >> 8) + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw == MSG_OK; +} + +bool B15F::analogWrite1(uint16_t value) { + uint8_t rq[] = + { + RQ_AA1, + static_cast(value & 0xFF), + static_cast(value >> 8) + }; + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw == MSG_OK; +} + +uint16_t B15F::analogRead(uint8_t channel) { + usart.clearInputBuffer(); + if (channel > 7) + abort("Bad ADC channel: " + std::to_string(channel)); + + uint8_t rq[] = + { + RQ_ADC, + channel + }; + + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint16_t aw; + usart.receive(reinterpret_cast(&aw), 0, sizeof(aw)); + + if (aw > 1023) + abort("Bad ADC data detected (1)"); + return aw; +} + +void +B15F::analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b, + uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count) { + /* + // prepare pointers + buffer_a += offset_a; + buffer_b += offset_b; + + + usart.clearInputBuffer(); + usart.writeByte(RQ_ADC_DAC_STROKE); + usart.writeByte(channel_a); + usart.writeByte(channel_b); + usart.writeInt(start); + usart.writeInt(static_cast(delta)); + usart.writeInt(count); + + for (uint16_t i = 0; i < count; i++) { + if (buffer_a) { + buffer_a[i] = usart.readInt(); + + if (buffer_a[i] > 1023) // check for broken usart connection + abort("Bad ADC data detected (2)"); + } else { + usart.readInt(); + } + + if (buffer_b) { + buffer_b[i] = usart.readInt(); + + if (buffer_b[i] > 1023) // check for broken usart connection + abort("Bad ADC data detected (3)"); + } else { + usart.readInt(); + } + } + + uint8_t aw = usart.readByte(); + if (aw != MSG_OK) + abort("Sequenz unterbrochen"); + + delay_us(10);*/ +} + +uint8_t B15F::pwmSetFrequency(uint32_t freq) { + usart.clearInputBuffer(); + + uint8_t rq[] = + { + RQ_PWM_SET_FREQ, + static_cast((freq >> 0) & 0xFF), + static_cast((freq >> 8) & 0xFF), + static_cast((freq >> 16) & 0xFF), + static_cast((freq >> 24) & 0xFF) + }; + + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; +} + +bool B15F::pwmSetValue(uint8_t value) { + usart.clearInputBuffer(); + + uint8_t rq[] = + { + RQ_PWM_SET_VALUE, + value + }; + + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw == MSG_OK; +} + +bool B15F::setRegister(uint8_t adr, uint8_t val) { + usart.clearInputBuffer(); + + uint8_t rq[] = + { + RQ_SET_REG, + adr, + val + }; + + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw == val; +} + +uint8_t B15F::getRegister(uint8_t adr) { + usart.clearInputBuffer(); + + uint8_t rq[] = + { + RQ_GET_REG, + adr + }; + + usart.transmit(&rq[0], 0, sizeof(rq)); + + uint8_t aw; + usart.receive(&aw, 0, sizeof(aw)); + return aw; +} + + +void B15F::delay_ms(uint16_t ms) { + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); +} + +void B15F::delay_us(uint16_t us) { + std::this_thread::sleep_for(std::chrono::microseconds(us)); +} + +B15F &B15F::getInstance(void) { + if (!instance) + instance = new B15F(); + + return *instance; +} + +// https://stackoverflow.com/a/478960 +std::string B15F::exec(std::string cmd) { + std::array buffer; + std::string result; + std::unique_ptr pipe(popen(cmd.c_str(), "r"), pclose); + if (!pipe) { + throw std::runtime_error("popen() failed!"); + } + while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { + result += buffer.data(); + } + return result; +} + +void B15F::abort(std::string msg) { + DriverException ex(msg); + abort(ex); +} + +void B15F::abort(std::exception &ex) { + if (errorhandler) + errorhandler(ex); + else { + std::cerr << "NOTICE: B15F::errorhandler not set" << std::endl; + std::cout << ex.what() << std::endl; + throw DriverException(ex.what()); + } +} + +void B15F::setAbortHandler(errorhandler_t func) { + errorhandler = func; +} diff --git a/docs/html/CMakeCCompilerId_8c_source.html b/docs/html/CMakeCCompilerId_8c_source.html index a7c7bda..81263ee 100644 --- a/docs/html/CMakeCCompilerId_8c_source.html +++ b/docs/html/CMakeCCompilerId_8c_source.html @@ -73,7 +73,7 @@ $(function() {
1 #ifdef __cplusplus
2 # error "A C++ compiler has been selected for C."
3 #endif
4 
5 #if defined(__18CXX)
6 # define ID_VOID_MAIN
7 #endif
8 #if defined(__CLASSIC_C__)
9 /* cv-qualifiers did not exist in K&R C */
10 # define const
11 # define volatile
12 #endif
13 
14 
15 /* Version number components: V=Version, R=Revision, P=Patch
16  Version date components: YYYY=Year, MM=Month, DD=Day */
17 
18 #if defined(__INTEL_COMPILER) || defined(__ICC)
19 # define COMPILER_ID "Intel"
20 # if defined(_MSC_VER)
21 # define SIMULATE_ID "MSVC"
22 # endif
23 /* __INTEL_COMPILER = VRP */
24 # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
25 # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
26 # if defined(__INTEL_COMPILER_UPDATE)
27 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
28 # else
29 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
30 # endif
31 # if defined(__INTEL_COMPILER_BUILD_DATE)
32 /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
33 # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
34 # endif
35 # if defined(_MSC_VER)
36 /* _MSC_VER = VVRR */
37 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
38 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
39 # endif
40 
41 #elif defined(__PATHCC__)
42 # define COMPILER_ID "PathScale"
43 # define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
44 # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
45 # if defined(__PATHCC_PATCHLEVEL__)
46 # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
47 # endif
48 
49 #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
50 # define COMPILER_ID "Embarcadero"
51 # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
52 # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
53 # define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
54 
55 #elif defined(__BORLANDC__)
56 # define COMPILER_ID "Borland"
57 /* __BORLANDC__ = 0xVRR */
58 # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
59 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
60 
61 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200
62 # define COMPILER_ID "Watcom"
63 /* __WATCOMC__ = VVRR */
64 # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
65 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
66 # if (__WATCOMC__ % 10) > 0
67 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
68 # endif
69 
70 #elif defined(__WATCOMC__)
71 # define COMPILER_ID "OpenWatcom"
72 /* __WATCOMC__ = VVRP + 1100 */
73 # define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
74 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
75 # if (__WATCOMC__ % 10) > 0
76 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
77 # endif
78 
79 #elif defined(__SUNPRO_C)
80 # define COMPILER_ID "SunPro"
81 # if __SUNPRO_C >= 0x5100
82 /* __SUNPRO_C = 0xVRRP */
83 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
84 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
85 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
86 # else
87 /* __SUNPRO_CC = 0xVRP */
88 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
89 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
90 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
91 # endif
92 
93 #elif defined(__HP_cc)
94 # define COMPILER_ID "HP"
95 /* __HP_cc = VVRRPP */
96 # define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
97 # define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
98 # define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
99 
100 #elif defined(__DECC)
101 # define COMPILER_ID "Compaq"
102 /* __DECC_VER = VVRRTPPPP */
103 # define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
104 # define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
105 # define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
106 
107 #elif defined(__IBMC__) && defined(__COMPILER_VER__)
108 # define COMPILER_ID "zOS"
109 # if defined(__ibmxl__)
110 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
111 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
112 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
113 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
114 # else
115 /* __IBMC__ = VRP */
116 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
117 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
118 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
119 # endif
120 
121 
122 #elif defined(__ibmxl__) || (defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800)
123 # define COMPILER_ID "XL"
124 # if defined(__ibmxl__)
125 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
126 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
127 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
128 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
129 # else
130 /* __IBMC__ = VRP */
131 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
132 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
133 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
134 # endif
135 
136 
137 #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
138 # define COMPILER_ID "VisualAge"
139 # if defined(__ibmxl__)
140 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
141 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
142 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
143 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
144 # else
145 /* __IBMC__ = VRP */
146 # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
147 # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
148 # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
149 # endif
150 
151 
152 #elif defined(__PGI)
153 # define COMPILER_ID "PGI"
154 # define COMPILER_VERSION_MAJOR DEC(__PGIC__)
155 # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
156 # if defined(__PGIC_PATCHLEVEL__)
157 # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
158 # endif
159 
160 #elif defined(_CRAYC)
161 # define COMPILER_ID "Cray"
162 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
163 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
164 
165 #elif defined(__TI_COMPILER_VERSION__)
166 # define COMPILER_ID "TI"
167 /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
168 # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
169 # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
170 # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
171 
172 #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
173 # define COMPILER_ID "Fujitsu"
174 
175 #elif defined(__ghs__)
176 # define COMPILER_ID "GHS"
177 /* __GHS_VERSION_NUMBER = VVVVRP */
178 # ifdef __GHS_VERSION_NUMBER
179 # define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
180 # define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
181 # define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
182 # endif
183 
184 #elif defined(__TINYC__)
185 # define COMPILER_ID "TinyCC"
186 
187 #elif defined(__BCC__)
188 # define COMPILER_ID "Bruce"
189 
190 #elif defined(__SCO_VERSION__)
191 # define COMPILER_ID "SCO"
192 
193 #elif defined(__ARMCC_VERSION) && !defined(__clang__)
194 # define COMPILER_ID "ARMCC"
195 #if __ARMCC_VERSION >= 1000000
196 /* __ARMCC_VERSION = VRRPPPP */
197 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
198 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
199 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
200 #else
201 /* __ARMCC_VERSION = VRPPPP */
202 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
203 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
204 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
205 #endif
206 
207 
208 #elif defined(__clang__) && defined(__apple_build_version__)
209 # define COMPILER_ID "AppleClang"
210 # if defined(_MSC_VER)
211 # define SIMULATE_ID "MSVC"
212 # endif
213 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
214 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
215 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
216 # if defined(_MSC_VER)
217 /* _MSC_VER = VVRR */
218 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
219 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
220 # endif
221 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
222 
223 #elif defined(__clang__)
224 # define COMPILER_ID "Clang"
225 # if defined(_MSC_VER)
226 # define SIMULATE_ID "MSVC"
227 # endif
228 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
229 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
230 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
231 # if defined(_MSC_VER)
232 /* _MSC_VER = VVRR */
233 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
234 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
235 # endif
236 
237 #elif defined(__GNUC__)
238 # define COMPILER_ID "GNU"
239 # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
240 # if defined(__GNUC_MINOR__)
241 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
242 # endif
243 # if defined(__GNUC_PATCHLEVEL__)
244 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
245 # endif
246 
247 #elif defined(_MSC_VER)
248 # define COMPILER_ID "MSVC"
249 /* _MSC_VER = VVRR */
250 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
251 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
252 # if defined(_MSC_FULL_VER)
253 # if _MSC_VER >= 1400
254 /* _MSC_FULL_VER = VVRRPPPPP */
255 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
256 # else
257 /* _MSC_FULL_VER = VVRRPPPP */
258 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
259 # endif
260 # endif
261 # if defined(_MSC_BUILD)
262 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
263 # endif
264 
265 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
266 # define COMPILER_ID "ADSP"
267 #if defined(__VISUALDSPVERSION__)
268 /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
269 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
270 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
271 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
272 #endif
273 
274 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
275 # define COMPILER_ID "IAR"
276 # if defined(__VER__) && defined(__ICCARM__)
277 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
278 # define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
279 # define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
280 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
281 # elif defined(__VER__) && defined(__ICCAVR__)
282 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
283 # define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
284 # define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
285 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
286 # endif
287 
288 #elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
289 # define COMPILER_ID "SDCC"
290 # if defined(__SDCC_VERSION_MAJOR)
291 # define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
292 # define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
293 # define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
294 # else
295 /* SDCC = VRP */
296 # define COMPILER_VERSION_MAJOR DEC(SDCC/100)
297 # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
298 # define COMPILER_VERSION_PATCH DEC(SDCC % 10)
299 # endif
300 
301 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
302 # define COMPILER_ID "MIPSpro"
303 # if defined(_SGI_COMPILER_VERSION)
304 /* _SGI_COMPILER_VERSION = VRP */
305 # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
306 # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
307 # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
308 # else
309 /* _COMPILER_VERSION = VRP */
310 # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
311 # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
312 # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
313 # endif
314 
315 
316 /* These compilers are either not known or too old to define an
317  identification macro. Try to identify the platform and guess that
318  it is the native compiler. */
319 #elif defined(__hpux) || defined(__hpua)
320 # define COMPILER_ID "HP"
321 
322 #else /* unknown compiler */
323 # define COMPILER_ID ""
324 #endif
325 
326 /* Construct the string literal in pieces to prevent the source from
327  getting matched. Store it in a pointer rather than an array
328  because some compilers will just produce instructions to fill the
329  array rather than assigning a pointer to a static array. */
330 char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
331 #ifdef SIMULATE_ID
332 char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
333 #endif
334 
335 #ifdef __QNXNTO__
336 char const* qnxnto = "INFO" ":" "qnxnto[]";
337 #endif
338 
339 #if defined(__CRAYXE) || defined(__CRAYXC)
340 char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
341 #endif
342 
343 #define STRINGIFY_HELPER(X) #X
344 #define STRINGIFY(X) STRINGIFY_HELPER(X)
345 
346 /* Identify known platforms by name. */
347 #if defined(__linux) || defined(__linux__) || defined(linux)
348 # define PLATFORM_ID "Linux"
349 
350 #elif defined(__CYGWIN__)
351 # define PLATFORM_ID "Cygwin"
352 
353 #elif defined(__MINGW32__)
354 # define PLATFORM_ID "MinGW"
355 
356 #elif defined(__APPLE__)
357 # define PLATFORM_ID "Darwin"
358 
359 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
360 # define PLATFORM_ID "Windows"
361 
362 #elif defined(__FreeBSD__) || defined(__FreeBSD)
363 # define PLATFORM_ID "FreeBSD"
364 
365 #elif defined(__NetBSD__) || defined(__NetBSD)
366 # define PLATFORM_ID "NetBSD"
367 
368 #elif defined(__OpenBSD__) || defined(__OPENBSD)
369 # define PLATFORM_ID "OpenBSD"
370 
371 #elif defined(__sun) || defined(sun)
372 # define PLATFORM_ID "SunOS"
373 
374 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
375 # define PLATFORM_ID "AIX"
376 
377 #elif defined(__hpux) || defined(__hpux__)
378 # define PLATFORM_ID "HP-UX"
379 
380 #elif defined(__HAIKU__)
381 # define PLATFORM_ID "Haiku"
382 
383 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
384 # define PLATFORM_ID "BeOS"
385 
386 #elif defined(__QNX__) || defined(__QNXNTO__)
387 # define PLATFORM_ID "QNX"
388 
389 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
390 # define PLATFORM_ID "Tru64"
391 
392 #elif defined(__riscos) || defined(__riscos__)
393 # define PLATFORM_ID "RISCos"
394 
395 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
396 # define PLATFORM_ID "SINIX"
397 
398 #elif defined(__UNIX_SV__)
399 # define PLATFORM_ID "UNIX_SV"
400 
401 #elif defined(__bsdos__)
402 # define PLATFORM_ID "BSDOS"
403 
404 #elif defined(_MPRAS) || defined(MPRAS)
405 # define PLATFORM_ID "MP-RAS"
406 
407 #elif defined(__osf) || defined(__osf__)
408 # define PLATFORM_ID "OSF1"
409 
410 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
411 # define PLATFORM_ID "SCO_SV"
412 
413 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
414 # define PLATFORM_ID "ULTRIX"
415 
416 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
417 # define PLATFORM_ID "Xenix"
418 
419 #elif defined(__WATCOMC__)
420 # if defined(__LINUX__)
421 # define PLATFORM_ID "Linux"
422 
423 # elif defined(__DOS__)
424 # define PLATFORM_ID "DOS"
425 
426 # elif defined(__OS2__)
427 # define PLATFORM_ID "OS2"
428 
429 # elif defined(__WINDOWS__)
430 # define PLATFORM_ID "Windows3x"
431 
432 # else /* unknown platform */
433 # define PLATFORM_ID
434 # endif
435 
436 #elif defined(__INTEGRITY)
437 # if defined(INT_178B)
438 # define PLATFORM_ID "Integrity178"
439 
440 # else /* regular Integrity */
441 # define PLATFORM_ID "Integrity"
442 # endif
443 
444 #else /* unknown platform */
445 # define PLATFORM_ID
446 
447 #endif
448 
449 /* For windows compilers MSVC and Intel we can determine
450  the architecture of the compiler being used. This is because
451  the compilers do not have flags that can change the architecture,
452  but rather depend on which compiler is being used
453 */
454 #if defined(_WIN32) && defined(_MSC_VER)
455 # if defined(_M_IA64)
456 # define ARCHITECTURE_ID "IA64"
457 
458 # elif defined(_M_X64) || defined(_M_AMD64)
459 # define ARCHITECTURE_ID "x64"
460 
461 # elif defined(_M_IX86)
462 # define ARCHITECTURE_ID "X86"
463 
464 # elif defined(_M_ARM64)
465 # define ARCHITECTURE_ID "ARM64"
466 
467 # elif defined(_M_ARM)
468 # if _M_ARM == 4
469 # define ARCHITECTURE_ID "ARMV4I"
470 # elif _M_ARM == 5
471 # define ARCHITECTURE_ID "ARMV5I"
472 # else
473 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
474 # endif
475 
476 # elif defined(_M_MIPS)
477 # define ARCHITECTURE_ID "MIPS"
478 
479 # elif defined(_M_SH)
480 # define ARCHITECTURE_ID "SHx"
481 
482 # else /* unknown architecture */
483 # define ARCHITECTURE_ID ""
484 # endif
485 
486 #elif defined(__WATCOMC__)
487 # if defined(_M_I86)
488 # define ARCHITECTURE_ID "I86"
489 
490 # elif defined(_M_IX86)
491 # define ARCHITECTURE_ID "X86"
492 
493 # else /* unknown architecture */
494 # define ARCHITECTURE_ID ""
495 # endif
496 
497 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
498 # if defined(__ICCARM__)
499 # define ARCHITECTURE_ID "ARM"
500 
501 # elif defined(__ICCAVR__)
502 # define ARCHITECTURE_ID "AVR"
503 
504 # else /* unknown architecture */
505 # define ARCHITECTURE_ID ""
506 # endif
507 
508 #elif defined(__ghs__)
509 # if defined(__PPC64__)
510 # define ARCHITECTURE_ID "PPC64"
511 
512 # elif defined(__ppc__)
513 # define ARCHITECTURE_ID "PPC"
514 
515 # elif defined(__ARM__)
516 # define ARCHITECTURE_ID "ARM"
517 
518 # elif defined(__x86_64__)
519 # define ARCHITECTURE_ID "x64"
520 
521 # elif defined(__i386__)
522 # define ARCHITECTURE_ID "X86"
523 
524 # else /* unknown architecture */
525 # define ARCHITECTURE_ID ""
526 # endif
527 #else
528 # define ARCHITECTURE_ID
529 #endif
530 
531 /* Convert integer to decimal digit literals. */
532 #define DEC(n) \
533  ('0' + (((n) / 10000000)%10)), \
534  ('0' + (((n) / 1000000)%10)), \
535  ('0' + (((n) / 100000)%10)), \
536  ('0' + (((n) / 10000)%10)), \
537  ('0' + (((n) / 1000)%10)), \
538  ('0' + (((n) / 100)%10)), \
539  ('0' + (((n) / 10)%10)), \
540  ('0' + ((n) % 10))
541 
542 /* Convert integer to hex digit literals. */
543 #define HEX(n) \
544  ('0' + ((n)>>28 & 0xF)), \
545  ('0' + ((n)>>24 & 0xF)), \
546  ('0' + ((n)>>20 & 0xF)), \
547  ('0' + ((n)>>16 & 0xF)), \
548  ('0' + ((n)>>12 & 0xF)), \
549  ('0' + ((n)>>8 & 0xF)), \
550  ('0' + ((n)>>4 & 0xF)), \
551  ('0' + ((n) & 0xF))
552 
553 /* Construct a string literal encoding the version number components. */
554 #ifdef COMPILER_VERSION_MAJOR
555 char const info_version[] =
556 {
557  'I', 'N', 'F', 'O', ':',
558  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
559  COMPILER_VERSION_MAJOR,
560 # ifdef COMPILER_VERSION_MINOR
561  '.', COMPILER_VERSION_MINOR,
562 # ifdef COMPILER_VERSION_PATCH
563  '.', COMPILER_VERSION_PATCH,
564 # ifdef COMPILER_VERSION_TWEAK
565  '.', COMPILER_VERSION_TWEAK,
566 # endif
567 # endif
568 # endif
569  ']','\0'
570 };
571 #endif
572 
573 /* Construct a string literal encoding the internal version number. */
574 #ifdef COMPILER_VERSION_INTERNAL
575 char const info_version_internal[] =
576 {
577  'I', 'N', 'F', 'O', ':',
578  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
579  'i','n','t','e','r','n','a','l','[',
580  COMPILER_VERSION_INTERNAL,']','\0'
581 };
582 #endif
583 
584 /* Construct a string literal encoding the version number components. */
585 #ifdef SIMULATE_VERSION_MAJOR
586 char const info_simulate_version[] =
587 {
588  'I', 'N', 'F', 'O', ':',
589  's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
590  SIMULATE_VERSION_MAJOR,
591 # ifdef SIMULATE_VERSION_MINOR
592  '.', SIMULATE_VERSION_MINOR,
593 # ifdef SIMULATE_VERSION_PATCH
594  '.', SIMULATE_VERSION_PATCH,
595 # ifdef SIMULATE_VERSION_TWEAK
596  '.', SIMULATE_VERSION_TWEAK,
597 # endif
598 # endif
599 # endif
600  ']','\0'
601 };
602 #endif
603 
604 /* Construct the string literal in pieces to prevent the source from
605  getting matched. Store it in a pointer rather than an array
606  because some compilers will just produce instructions to fill the
607  array rather than assigning a pointer to a static array. */
608 char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
609 char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
610 
611 
612 
613 
614 #if !defined(__STDC__)
615 # if (defined(_MSC_VER) && !defined(__clang__)) \
616  || (defined(__ibmxl__) || defined(__IBMC__))
617 # define C_DIALECT "90"
618 # else
619 # define C_DIALECT
620 # endif
621 #elif __STDC_VERSION__ >= 201000L
622 # define C_DIALECT "11"
623 #elif __STDC_VERSION__ >= 199901L
624 # define C_DIALECT "99"
625 #else
626 # define C_DIALECT "90"
627 #endif
628 const char* info_language_dialect_default =
629  "INFO" ":" "dialect_default[" C_DIALECT "]";
630 
631 /*--------------------------------------------------------------------------*/
632 
633 #ifdef ID_VOID_MAIN
634 void main() {}
635 #else
636 # if defined(__CLASSIC_C__)
637 int main(argc, argv) int argc;
638 char *argv[];
639 # else
640 int main(int argc, char* argv[])
641 # endif
642 {
643  int require = 0;
644  require += info_compiler[argc];
645  require += info_platform[argc];
646  require += info_arch[argc];
647 #ifdef COMPILER_VERSION_MAJOR
648  require += info_version[argc];
649 #endif
650 #ifdef COMPILER_VERSION_INTERNAL
651  require += info_version_internal[argc];
652 #endif
653 #ifdef SIMULATE_ID
654  require += info_simulate[argc];
655 #endif
656 #ifdef SIMULATE_VERSION_MAJOR
657  require += info_simulate_version[argc];
658 #endif
659 #if defined(__CRAYXE) || defined(__CRAYXC)
660  require += info_cray[argc];
661 #endif
662  require += info_language_dialect_default[argc];
663  (void)argv;
664  return require;
665 }
666 #endif
diff --git a/docs/html/CMakeCXXCompilerId_8cpp_source.html b/docs/html/CMakeCXXCompilerId_8cpp_source.html index 04f58bc..3c38e14 100644 --- a/docs/html/CMakeCXXCompilerId_8cpp_source.html +++ b/docs/html/CMakeCXXCompilerId_8cpp_source.html @@ -73,7 +73,7 @@ $(function() {
1 /* This source file must have a .cpp extension so that all C++ compilers
2  recognize the extension without flags. Borland does not know .cxx for
3  example. */
4 #ifndef __cplusplus
5 # error "A C compiler has been selected for C++."
6 #endif
7 
8 
9 /* Version number components: V=Version, R=Revision, P=Patch
10  Version date components: YYYY=Year, MM=Month, DD=Day */
11 
12 #if defined(__COMO__)
13 # define COMPILER_ID "Comeau"
14 /* __COMO_VERSION__ = VRR */
15 # define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
16 # define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
17 
18 #elif defined(__INTEL_COMPILER) || defined(__ICC)
19 # define COMPILER_ID "Intel"
20 # if defined(_MSC_VER)
21 # define SIMULATE_ID "MSVC"
22 # endif
23 /* __INTEL_COMPILER = VRP */
24 # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
25 # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
26 # if defined(__INTEL_COMPILER_UPDATE)
27 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
28 # else
29 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
30 # endif
31 # if defined(__INTEL_COMPILER_BUILD_DATE)
32 /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
33 # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
34 # endif
35 # if defined(_MSC_VER)
36 /* _MSC_VER = VVRR */
37 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
38 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
39 # endif
40 
41 #elif defined(__PATHCC__)
42 # define COMPILER_ID "PathScale"
43 # define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
44 # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
45 # if defined(__PATHCC_PATCHLEVEL__)
46 # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
47 # endif
48 
49 #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
50 # define COMPILER_ID "Embarcadero"
51 # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
52 # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
53 # define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
54 
55 #elif defined(__BORLANDC__)
56 # define COMPILER_ID "Borland"
57 /* __BORLANDC__ = 0xVRR */
58 # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
59 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
60 
61 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200
62 # define COMPILER_ID "Watcom"
63 /* __WATCOMC__ = VVRR */
64 # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
65 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
66 # if (__WATCOMC__ % 10) > 0
67 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
68 # endif
69 
70 #elif defined(__WATCOMC__)
71 # define COMPILER_ID "OpenWatcom"
72 /* __WATCOMC__ = VVRP + 1100 */
73 # define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
74 # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
75 # if (__WATCOMC__ % 10) > 0
76 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
77 # endif
78 
79 #elif defined(__SUNPRO_CC)
80 # define COMPILER_ID "SunPro"
81 # if __SUNPRO_CC >= 0x5100
82 /* __SUNPRO_CC = 0xVRRP */
83 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
84 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
85 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
86 # else
87 /* __SUNPRO_CC = 0xVRP */
88 # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
89 # define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
90 # define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
91 # endif
92 
93 #elif defined(__HP_aCC)
94 # define COMPILER_ID "HP"
95 /* __HP_aCC = VVRRPP */
96 # define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
97 # define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
98 # define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
99 
100 #elif defined(__DECCXX)
101 # define COMPILER_ID "Compaq"
102 /* __DECCXX_VER = VVRRTPPPP */
103 # define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
104 # define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
105 # define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
106 
107 #elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
108 # define COMPILER_ID "zOS"
109 # if defined(__ibmxl__)
110 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
111 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
112 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
113 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
114 # else
115 /* __IBMCPP__ = VRP */
116 # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
117 # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
118 # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
119 # endif
120 
121 
122 #elif defined(__ibmxl__) || (defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800)
123 # define COMPILER_ID "XL"
124 # if defined(__ibmxl__)
125 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
126 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
127 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
128 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
129 # else
130 /* __IBMCPP__ = VRP */
131 # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
132 # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
133 # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
134 # endif
135 
136 
137 #elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
138 # define COMPILER_ID "VisualAge"
139 # if defined(__ibmxl__)
140 # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
141 # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
142 # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
143 # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
144 # else
145 /* __IBMCPP__ = VRP */
146 # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
147 # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
148 # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
149 # endif
150 
151 
152 #elif defined(__PGI)
153 # define COMPILER_ID "PGI"
154 # define COMPILER_VERSION_MAJOR DEC(__PGIC__)
155 # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
156 # if defined(__PGIC_PATCHLEVEL__)
157 # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
158 # endif
159 
160 #elif defined(_CRAYC)
161 # define COMPILER_ID "Cray"
162 # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
163 # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
164 
165 #elif defined(__TI_COMPILER_VERSION__)
166 # define COMPILER_ID "TI"
167 /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
168 # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
169 # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
170 # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
171 
172 #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
173 # define COMPILER_ID "Fujitsu"
174 
175 #elif defined(__ghs__)
176 # define COMPILER_ID "GHS"
177 /* __GHS_VERSION_NUMBER = VVVVRP */
178 # ifdef __GHS_VERSION_NUMBER
179 # define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
180 # define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
181 # define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
182 # endif
183 
184 #elif defined(__SCO_VERSION__)
185 # define COMPILER_ID "SCO"
186 
187 #elif defined(__ARMCC_VERSION) && !defined(__clang__)
188 # define COMPILER_ID "ARMCC"
189 #if __ARMCC_VERSION >= 1000000
190 /* __ARMCC_VERSION = VRRPPPP */
191 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
192 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
193 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
194 #else
195 /* __ARMCC_VERSION = VRPPPP */
196 # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
197 # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
198 # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
199 #endif
200 
201 
202 #elif defined(__clang__) && defined(__apple_build_version__)
203 # define COMPILER_ID "AppleClang"
204 # if defined(_MSC_VER)
205 # define SIMULATE_ID "MSVC"
206 # endif
207 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
208 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
209 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
210 # if defined(_MSC_VER)
211 /* _MSC_VER = VVRR */
212 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
213 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
214 # endif
215 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
216 
217 #elif defined(__clang__)
218 # define COMPILER_ID "Clang"
219 # if defined(_MSC_VER)
220 # define SIMULATE_ID "MSVC"
221 # endif
222 # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
223 # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
224 # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
225 # if defined(_MSC_VER)
226 /* _MSC_VER = VVRR */
227 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
228 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
229 # endif
230 
231 #elif defined(__GNUC__) || defined(__GNUG__)
232 # define COMPILER_ID "GNU"
233 # if defined(__GNUC__)
234 # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
235 # else
236 # define COMPILER_VERSION_MAJOR DEC(__GNUG__)
237 # endif
238 # if defined(__GNUC_MINOR__)
239 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
240 # endif
241 # if defined(__GNUC_PATCHLEVEL__)
242 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
243 # endif
244 
245 #elif defined(_MSC_VER)
246 # define COMPILER_ID "MSVC"
247 /* _MSC_VER = VVRR */
248 # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
249 # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
250 # if defined(_MSC_FULL_VER)
251 # if _MSC_VER >= 1400
252 /* _MSC_FULL_VER = VVRRPPPPP */
253 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
254 # else
255 /* _MSC_FULL_VER = VVRRPPPP */
256 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
257 # endif
258 # endif
259 # if defined(_MSC_BUILD)
260 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
261 # endif
262 
263 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
264 # define COMPILER_ID "ADSP"
265 #if defined(__VISUALDSPVERSION__)
266 /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
267 # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
268 # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
269 # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
270 #endif
271 
272 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
273 # define COMPILER_ID "IAR"
274 # if defined(__VER__) && defined(__ICCARM__)
275 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
276 # define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
277 # define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
278 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
279 # elif defined(__VER__) && defined(__ICCAVR__)
280 # define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
281 # define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
282 # define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
283 # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
284 # endif
285 
286 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
287 # define COMPILER_ID "MIPSpro"
288 # if defined(_SGI_COMPILER_VERSION)
289 /* _SGI_COMPILER_VERSION = VRP */
290 # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
291 # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
292 # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
293 # else
294 /* _COMPILER_VERSION = VRP */
295 # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
296 # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
297 # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
298 # endif
299 
300 
301 /* These compilers are either not known or too old to define an
302  identification macro. Try to identify the platform and guess that
303  it is the native compiler. */
304 #elif defined(__hpux) || defined(__hpua)
305 # define COMPILER_ID "HP"
306 
307 #else /* unknown compiler */
308 # define COMPILER_ID ""
309 #endif
310 
311 /* Construct the string literal in pieces to prevent the source from
312  getting matched. Store it in a pointer rather than an array
313  because some compilers will just produce instructions to fill the
314  array rather than assigning a pointer to a static array. */
315 char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
316 #ifdef SIMULATE_ID
317 char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
318 #endif
319 
320 #ifdef __QNXNTO__
321 char const* qnxnto = "INFO" ":" "qnxnto[]";
322 #endif
323 
324 #if defined(__CRAYXE) || defined(__CRAYXC)
325 char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
326 #endif
327 
328 #define STRINGIFY_HELPER(X) #X
329 #define STRINGIFY(X) STRINGIFY_HELPER(X)
330 
331 /* Identify known platforms by name. */
332 #if defined(__linux) || defined(__linux__) || defined(linux)
333 # define PLATFORM_ID "Linux"
334 
335 #elif defined(__CYGWIN__)
336 # define PLATFORM_ID "Cygwin"
337 
338 #elif defined(__MINGW32__)
339 # define PLATFORM_ID "MinGW"
340 
341 #elif defined(__APPLE__)
342 # define PLATFORM_ID "Darwin"
343 
344 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
345 # define PLATFORM_ID "Windows"
346 
347 #elif defined(__FreeBSD__) || defined(__FreeBSD)
348 # define PLATFORM_ID "FreeBSD"
349 
350 #elif defined(__NetBSD__) || defined(__NetBSD)
351 # define PLATFORM_ID "NetBSD"
352 
353 #elif defined(__OpenBSD__) || defined(__OPENBSD)
354 # define PLATFORM_ID "OpenBSD"
355 
356 #elif defined(__sun) || defined(sun)
357 # define PLATFORM_ID "SunOS"
358 
359 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
360 # define PLATFORM_ID "AIX"
361 
362 #elif defined(__hpux) || defined(__hpux__)
363 # define PLATFORM_ID "HP-UX"
364 
365 #elif defined(__HAIKU__)
366 # define PLATFORM_ID "Haiku"
367 
368 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
369 # define PLATFORM_ID "BeOS"
370 
371 #elif defined(__QNX__) || defined(__QNXNTO__)
372 # define PLATFORM_ID "QNX"
373 
374 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
375 # define PLATFORM_ID "Tru64"
376 
377 #elif defined(__riscos) || defined(__riscos__)
378 # define PLATFORM_ID "RISCos"
379 
380 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
381 # define PLATFORM_ID "SINIX"
382 
383 #elif defined(__UNIX_SV__)
384 # define PLATFORM_ID "UNIX_SV"
385 
386 #elif defined(__bsdos__)
387 # define PLATFORM_ID "BSDOS"
388 
389 #elif defined(_MPRAS) || defined(MPRAS)
390 # define PLATFORM_ID "MP-RAS"
391 
392 #elif defined(__osf) || defined(__osf__)
393 # define PLATFORM_ID "OSF1"
394 
395 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
396 # define PLATFORM_ID "SCO_SV"
397 
398 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
399 # define PLATFORM_ID "ULTRIX"
400 
401 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
402 # define PLATFORM_ID "Xenix"
403 
404 #elif defined(__WATCOMC__)
405 # if defined(__LINUX__)
406 # define PLATFORM_ID "Linux"
407 
408 # elif defined(__DOS__)
409 # define PLATFORM_ID "DOS"
410 
411 # elif defined(__OS2__)
412 # define PLATFORM_ID "OS2"
413 
414 # elif defined(__WINDOWS__)
415 # define PLATFORM_ID "Windows3x"
416 
417 # else /* unknown platform */
418 # define PLATFORM_ID
419 # endif
420 
421 #elif defined(__INTEGRITY)
422 # if defined(INT_178B)
423 # define PLATFORM_ID "Integrity178"
424 
425 # else /* regular Integrity */
426 # define PLATFORM_ID "Integrity"
427 # endif
428 
429 #else /* unknown platform */
430 # define PLATFORM_ID
431 
432 #endif
433 
434 /* For windows compilers MSVC and Intel we can determine
435  the architecture of the compiler being used. This is because
436  the compilers do not have flags that can change the architecture,
437  but rather depend on which compiler is being used
438 */
439 #if defined(_WIN32) && defined(_MSC_VER)
440 # if defined(_M_IA64)
441 # define ARCHITECTURE_ID "IA64"
442 
443 # elif defined(_M_X64) || defined(_M_AMD64)
444 # define ARCHITECTURE_ID "x64"
445 
446 # elif defined(_M_IX86)
447 # define ARCHITECTURE_ID "X86"
448 
449 # elif defined(_M_ARM64)
450 # define ARCHITECTURE_ID "ARM64"
451 
452 # elif defined(_M_ARM)
453 # if _M_ARM == 4
454 # define ARCHITECTURE_ID "ARMV4I"
455 # elif _M_ARM == 5
456 # define ARCHITECTURE_ID "ARMV5I"
457 # else
458 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
459 # endif
460 
461 # elif defined(_M_MIPS)
462 # define ARCHITECTURE_ID "MIPS"
463 
464 # elif defined(_M_SH)
465 # define ARCHITECTURE_ID "SHx"
466 
467 # else /* unknown architecture */
468 # define ARCHITECTURE_ID ""
469 # endif
470 
471 #elif defined(__WATCOMC__)
472 # if defined(_M_I86)
473 # define ARCHITECTURE_ID "I86"
474 
475 # elif defined(_M_IX86)
476 # define ARCHITECTURE_ID "X86"
477 
478 # else /* unknown architecture */
479 # define ARCHITECTURE_ID ""
480 # endif
481 
482 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
483 # if defined(__ICCARM__)
484 # define ARCHITECTURE_ID "ARM"
485 
486 # elif defined(__ICCAVR__)
487 # define ARCHITECTURE_ID "AVR"
488 
489 # else /* unknown architecture */
490 # define ARCHITECTURE_ID ""
491 # endif
492 
493 #elif defined(__ghs__)
494 # if defined(__PPC64__)
495 # define ARCHITECTURE_ID "PPC64"
496 
497 # elif defined(__ppc__)
498 # define ARCHITECTURE_ID "PPC"
499 
500 # elif defined(__ARM__)
501 # define ARCHITECTURE_ID "ARM"
502 
503 # elif defined(__x86_64__)
504 # define ARCHITECTURE_ID "x64"
505 
506 # elif defined(__i386__)
507 # define ARCHITECTURE_ID "X86"
508 
509 # else /* unknown architecture */
510 # define ARCHITECTURE_ID ""
511 # endif
512 #else
513 # define ARCHITECTURE_ID
514 #endif
515 
516 /* Convert integer to decimal digit literals. */
517 #define DEC(n) \
518  ('0' + (((n) / 10000000)%10)), \
519  ('0' + (((n) / 1000000)%10)), \
520  ('0' + (((n) / 100000)%10)), \
521  ('0' + (((n) / 10000)%10)), \
522  ('0' + (((n) / 1000)%10)), \
523  ('0' + (((n) / 100)%10)), \
524  ('0' + (((n) / 10)%10)), \
525  ('0' + ((n) % 10))
526 
527 /* Convert integer to hex digit literals. */
528 #define HEX(n) \
529  ('0' + ((n)>>28 & 0xF)), \
530  ('0' + ((n)>>24 & 0xF)), \
531  ('0' + ((n)>>20 & 0xF)), \
532  ('0' + ((n)>>16 & 0xF)), \
533  ('0' + ((n)>>12 & 0xF)), \
534  ('0' + ((n)>>8 & 0xF)), \
535  ('0' + ((n)>>4 & 0xF)), \
536  ('0' + ((n) & 0xF))
537 
538 /* Construct a string literal encoding the version number components. */
539 #ifdef COMPILER_VERSION_MAJOR
540 char const info_version[] =
541 {
542  'I', 'N', 'F', 'O', ':',
543  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
544  COMPILER_VERSION_MAJOR,
545 # ifdef COMPILER_VERSION_MINOR
546  '.', COMPILER_VERSION_MINOR,
547 # ifdef COMPILER_VERSION_PATCH
548  '.', COMPILER_VERSION_PATCH,
549 # ifdef COMPILER_VERSION_TWEAK
550  '.', COMPILER_VERSION_TWEAK,
551 # endif
552 # endif
553 # endif
554  ']','\0'
555 };
556 #endif
557 
558 /* Construct a string literal encoding the internal version number. */
559 #ifdef COMPILER_VERSION_INTERNAL
560 char const info_version_internal[] =
561 {
562  'I', 'N', 'F', 'O', ':',
563  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
564  'i','n','t','e','r','n','a','l','[',
565  COMPILER_VERSION_INTERNAL,']','\0'
566 };
567 #endif
568 
569 /* Construct a string literal encoding the version number components. */
570 #ifdef SIMULATE_VERSION_MAJOR
571 char const info_simulate_version[] =
572 {
573  'I', 'N', 'F', 'O', ':',
574  's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
575  SIMULATE_VERSION_MAJOR,
576 # ifdef SIMULATE_VERSION_MINOR
577  '.', SIMULATE_VERSION_MINOR,
578 # ifdef SIMULATE_VERSION_PATCH
579  '.', SIMULATE_VERSION_PATCH,
580 # ifdef SIMULATE_VERSION_TWEAK
581  '.', SIMULATE_VERSION_TWEAK,
582 # endif
583 # endif
584 # endif
585  ']','\0'
586 };
587 #endif
588 
589 /* Construct the string literal in pieces to prevent the source from
590  getting matched. Store it in a pointer rather than an array
591  because some compilers will just produce instructions to fill the
592  array rather than assigning a pointer to a static array. */
593 char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
594 char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
595 
596 
597 
598 
599 #if defined(_MSC_VER) && defined(_MSVC_LANG)
600 #define CXX_STD _MSVC_LANG
601 #else
602 #define CXX_STD __cplusplus
603 #endif
604 
605 const char* info_language_dialect_default = "INFO" ":" "dialect_default["
606 #if CXX_STD > 201703L
607  "20"
608 #elif CXX_STD >= 201703L
609  "17"
610 #elif CXX_STD >= 201402L
611  "14"
612 #elif CXX_STD >= 201103L
613  "11"
614 #else
615  "98"
616 #endif
617  "]";
618 
619 /*--------------------------------------------------------------------------*/
620 
621 int main(int argc, char* argv[])
622 {
623  int require = 0;
624  require += info_compiler[argc];
625  require += info_platform[argc];
626 #ifdef COMPILER_VERSION_MAJOR
627  require += info_version[argc];
628 #endif
629 #ifdef COMPILER_VERSION_INTERNAL
630  require += info_version_internal[argc];
631 #endif
632 #ifdef SIMULATE_ID
633  require += info_simulate[argc];
634 #endif
635 #ifdef SIMULATE_VERSION_MAJOR
636  require += info_simulate_version[argc];
637 #endif
638 #if defined(__CRAYXE) || defined(__CRAYXC)
639  require += info_cray[argc];
640 #endif
641  require += info_language_dialect_default[argc];
642  (void)argv;
643  return require;
644 }
diff --git a/docs/html/annotated.html b/docs/html/annotated.html index c4c82a7..5ac1c23 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/html/b15f_8cpp_source.html b/docs/html/b15f_8cpp_source.html index 46c3211..2b0aafd 100644 --- a/docs/html/b15f_8cpp_source.html +++ b/docs/html/b15f_8cpp_source.html @@ -70,47 +70,48 @@ $(function() {
b15f.cpp
-
1 #include "b15f.h"
2 
3 B15F* B15F::instance = nullptr;
4 errorhandler_t B15F::errorhandler = nullptr;
5 
6 B15F::B15F()
7 {
8  init();
9 }
10 
11 void B15F::init()
12 {
13 
14  std::string device = exec("bash -c 'ls /dev/ttyUSB*'");
15  while(device.find(' ') != std::string::npos || device.find('\n') != std::string::npos || device.find('\t') != std::string::npos)
16  device.pop_back();
17 
18  if(device.length() == 0)
19  abort("Adapter nicht gefunden");
20 
21  std::cout << PRE << "Verwende Adapter: " << device << std::endl;
22 
23 
24 
25  std::cout << PRE << "Stelle Verbindung mit Adapter her... " << std::flush;
26  usart.setBaudrate(BAUDRATE);
27  usart.openDevice(device);
28  std::cout << "OK" << std::endl;
29 
30 
31 
32  std::cout << PRE << "Teste Verbindung... " << std::flush;
33  uint8_t tries = 3;
34  while(tries--)
35  {
36  // verwerfe Daten, die µC noch hat
37  //discard();
38 
39  if(!testConnection())
40  continue;
41 
42  if(!testIntConv())
43  continue;
44 
45  break;
46  }
47  if(tries == 0)
48  abort("Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?");
49  std::cout << "OK" << std::endl;
50 
51 
52  // Gib board info aus
53  std::vector<std::string> info = getBoardInfo();
54  std::cout << PRE << "AVR Firmware Version: " << info[0] << " um " << info[1] << " Uhr (" << info[2] << ")" << std::endl;
55 }
56 
58 {
59  uint8_t tries = RECONNECT_TRIES;
60  while(tries--)
61  {
63  discard();
64 
65  if(testConnection())
66  return;
67  }
68 
69  abort("Verbindung kann nicht repariert werden");
70 }
71 
72 void B15F::discard(void)
73 {
74  try
75  {
76  usart.clearOutputBuffer();
77  for(uint8_t i = 0; i < 16; i++)
78  {
79  usart.writeByte(RQ_DISC); // sende discard Befehl (verwerfe input)
80  delay_ms(4);
81  }
82  usart.clearInputBuffer();
83  }
84  catch(std::exception& ex)
85  {
86  abort(ex);
87  }
88 }
89 
91 {
92  // erzeuge zufälliges Byte
93  srand(time(NULL));
94  uint8_t dummy = rand() % 256;
95 
96  usart.writeByte(RQ_TEST);
97  usart.writeByte(dummy);
98 
99  uint8_t aw = usart.readByte();
100  uint8_t mirror = usart.readByte();
101 
102  return aw == MSG_OK && mirror == dummy;
103 }
104 
106 {
107  srand(time(NULL));
108  uint16_t dummy = rand() % (0xFFFF / 3);
109 
110  usart.writeByte(RQ_INT);
111  usart.writeInt(dummy);
112 
113  uint16_t aw = usart.readInt();
114  return aw == dummy * 3;
115 }
116 
117 
118 std::vector<std::string> B15F::getBoardInfo(void)
119 {
120  std::vector<std::string> info;
121 
122  usart.writeByte(RQ_INFO);
123 
124  uint8_t n = usart.readByte();
125  while(n--)
126  {
127  uint8_t len = usart.readByte();
128  std::string str;
129 
130  while(len--)
131  {
132  str += static_cast<char>(usart.readByte());
133  }
134 
135  info.push_back(str);
136  }
137 
138  uint8_t aw = usart.readByte();
139  if(aw != MSG_OK)
140  abort("Board Info fehlerhalft: code " + std::to_string((int) aw));
141 
142  return info;
143 }
144 
146 {
147  usart.writeByte(RQ_ST);
148 
149  uint8_t aw = usart.readByte();
150  return aw == MSG_OK;
151 }
152 
153 bool B15F::digitalWrite0(uint8_t port)
154 {
155  usart.writeByte(RQ_BA0);
156  usart.writeByte(port);
157 
158  uint8_t aw = usart.readByte();
159  delay_us(10);
160  return aw == MSG_OK;
161 }
162 
163 bool B15F::digitalWrite1(uint8_t port)
164 {
165  usart.writeByte(RQ_BA1);
166  usart.writeByte(port);
167 
168  uint8_t aw = usart.readByte();
169  delay_us(10);
170  return aw == MSG_OK;
171 }
172 
174 {
175  usart.clearInputBuffer();
176  usart.writeByte(RQ_BE0);
177  uint8_t byte = usart.readByte();
178  delay_us(10);
179  return byte;
180 }
181 
183 {
184  usart.clearInputBuffer();
185  usart.writeByte(RQ_BE1);
186  uint8_t byte = usart.readByte();
187  delay_us(10);
188  return byte;
189 }
190 
192 {
193  usart.clearInputBuffer();
194  usart.writeByte(RQ_DSW);
195  uint8_t byte = usart.readByte();
196  delay_us(10);
197  return byte;
198 }
199 
200 bool B15F::analogWrite0(uint16_t value)
201 {
202  usart.writeByte(RQ_AA0);
203  usart.writeInt(value);
204 
205  uint8_t aw = usart.readByte();
206  delay_us(10);
207  return aw == MSG_OK;
208 }
209 
210 bool B15F::analogWrite1(uint16_t value)
211 {
212  usart.writeByte(RQ_AA1);
213  usart.writeInt(value);
214 
215  uint8_t aw = usart.readByte();
216  delay_us(10);
217  return aw == MSG_OK;
218 }
219 
220 uint16_t B15F::analogRead(uint8_t channel)
221 {
222  usart.clearInputBuffer();
223  if(channel > 7)
224  abort("Bad ADC channel: " + std::to_string(channel));
225 
226  uint8_t rq[] =
227  {
228  RQ_ADC,
229  channel
230  };
231 
232  usart.transmit(&rq[0], 0, sizeof(rq));
233 
234  uint16_t adc = usart.readInt();
235 
236  if(adc > 1023)
237  abort("Bad ADC data detected (1)");
238  return adc;
239 }
240 
241 void B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
242 {
243  // check pointers
244  buffer_a += offset_a;
245  buffer_b += offset_b;
246 
247 
248  usart.clearInputBuffer();
249  usart.writeByte(RQ_ADC_DAC_STROKE);
250  usart.writeByte(channel_a);
251  usart.writeByte(channel_b);
252  usart.writeInt(start);
253  usart.writeInt(static_cast<uint16_t>(delta));
254  usart.writeInt(count);
255 
256  for(uint16_t i = 0; i < count; i++)
257  {
258  if(buffer_a)
259  {
260  buffer_a[i] = usart.readInt();
261 
262  if(buffer_a[i] > 1023) // check for broken usart connection
263  abort("Bad ADC data detected (2)");
264  }
265  else
266  {
267  usart.readInt();
268  }
269 
270  if(buffer_b)
271  {
272  buffer_b[i] = usart.readInt();
273 
274  if(buffer_b[i] > 1023) // check for broken usart connection
275  abort("Bad ADC data detected (3)");
276  }
277  else
278  {
279  usart.readInt();
280  }
281  }
282 
283  uint8_t aw = usart.readByte();
284  if(aw != MSG_OK)
285  abort("Sequenz unterbrochen");
286 
287  delay_us(10);
288 }
289 
290 uint8_t B15F::pwmSetFrequency(uint32_t freq)
291 {
292  usart.clearInputBuffer();
293 
294  uint8_t rq[] =
295  {
296  RQ_PWM_SET_FREQ,
297  static_cast<uint8_t>((freq >> 0) & 0xFF),
298  static_cast<uint8_t>((freq >> 8) & 0xFF),
299  static_cast<uint8_t>((freq >> 16) & 0xFF),
300  static_cast<uint8_t>((freq >> 24) & 0xFF)
301  };
302 
303  usart.transmit(&rq[0], 0, sizeof(rq));
304 
305  uint8_t byte = usart.readByte();
306  delay_us(10);
307  return byte;
308 }
309 
310 bool B15F::pwmSetValue(uint8_t value)
311 {
312  usart.clearInputBuffer();
313 
314  uint8_t rq[] =
315  {
316  RQ_PWM_SET_VALUE,
317  value
318  };
319 
320  usart.transmit(&rq[0], 0, sizeof(rq));
321 
322  uint8_t aw = usart.readByte();
323  delay_us(10);
324  return aw == MSG_OK;
325 }
326 
327 bool B15F::setRegister(uint8_t adr, uint8_t val)
328 {
329  usart.clearInputBuffer();
330 
331  uint8_t rq[] =
332  {
333  RQ_SET_REG,
334  adr,
335  val
336  };
337 
338  usart.transmit(&rq[0], 0, sizeof(rq));
339 
340  uint8_t byte = usart.readByte();
341  delay_us(10);
342  return byte == val;
343 }
344 
345 uint8_t B15F::getRegister(uint8_t adr)
346 {
347  usart.clearInputBuffer();
348 
349  uint8_t rq[] =
350  {
351  RQ_GET_REG,
352  adr
353  };
354 
355  usart.transmit(&rq[0], 0, sizeof(rq));
356 
357  uint8_t aw = usart.readByte();
358  delay_us(10);
359  return aw;
360 }
361 
362 
363 void B15F::delay_ms(uint16_t ms)
364 {
365  std::this_thread::sleep_for(std::chrono::milliseconds(ms));
366 }
367 
368 void B15F::delay_us(uint16_t us)
369 {
370  std::this_thread::sleep_for(std::chrono::microseconds(us));
371 }
372 
374 {
375  if(!instance)
376  instance = new B15F();
377 
378  return *instance;
379 }
380 
381 // https://stackoverflow.com/a/478960
382 std::string B15F::exec(std::string cmd)
383 {
384  std::array<char, 128> buffer;
385  std::string result;
386  std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), pclose);
387  if (!pipe)
388  {
389  throw std::runtime_error("popen() failed!");
390  }
391  while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr)
392  {
393  result += buffer.data();
394  }
395  return result;
396 }
397 
398 void B15F::abort(std::string msg)
399 {
400  DriverException ex(msg);
401  abort(ex);
402 }
403 void B15F::abort(std::exception& ex)
404 {
405  if(errorhandler)
406  errorhandler(ex);
407  else
408  {
409  std::cerr << "NOTICE: B15F::errorhandler not set" << std::endl;
410  std::cout << ex.what() << std::endl;
411  throw DriverException(ex.what());
412  }
413 }
414 
415 void B15F::setAbortHandler(errorhandler_t func)
416 {
417  errorhandler = func;
418 }
-
static std::string exec(std::string cmd)
Definition: b15f.cpp:382
-
uint8_t getRegister(uint8_t adr)
Definition: b15f.cpp:345
-
void delay_us(uint16_t us)
Definition: b15f.cpp:368
-
uint8_t digitalRead0(void)
Definition: b15f.cpp:173
-
uint8_t pwmSetFrequency(uint32_t freq)
Definition: b15f.cpp:290
-
void analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
Definition: b15f.cpp:241
-
bool testConnection(void)
Definition: b15f.cpp:90
-
uint8_t readDipSwitch(void)
Definition: b15f.cpp:191
-
void delay_ms(uint16_t ms)
Definition: b15f.cpp:363
-
bool setRegister(uint8_t adr, uint8_t val)
Definition: b15f.cpp:327
-
static B15F & getInstance(void)
Definition: b15f.cpp:373
+
1 #include "b15f.h"
2 
3 B15F *B15F::instance = nullptr;
4 errorhandler_t B15F::errorhandler = nullptr;
5 
6 B15F::B15F()
7 {
8  init();
9 }
10 
11 void B15F::init()
12 {
13 
14  std::string device = exec("bash -c 'ls /dev/ttyUSB*'");
15  while (device.find(' ') != std::string::npos || device.find('\n') != std::string::npos ||
16  device.find('\t') != std::string::npos)
17  device.pop_back();
18 
19  if (device.length() == 0)
20  abort("Adapter nicht gefunden");
21 
22  std::cout << PRE << "Verwende Adapter: " << device << std::endl;
23 
24 
25  std::cout << PRE << "Stelle Verbindung mit Adapter her... " << std::flush;
26  usart.setBaudrate(BAUDRATE);
27  usart.openDevice(device);
28  std::cout << "OK" << std::endl;
29 
30 
31  std::cout << PRE << "Teste Verbindung... " << std::flush;
32  uint8_t tries = 3;
33  while (tries--)
34  {
35  // verwerfe Daten, die µC noch hat
36  //discard();
37 
38  if (!testConnection())
39  continue;
40 
41  if (!testIntConv())
42  continue;
43 
44  break;
45  }
46  if (tries == 0)
47  abort("Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?");
48  std::cout << "OK" << std::endl;
49 
50 
51  // Gib board info aus
52  std::vector<std::string> info = getBoardInfo();
53  std::cout << PRE << "AVR Firmware Version: " << info[0] << " um " << info[1] << " Uhr (" << info[2] << ")"
54  << std::endl;
55 }
56 
58 {
59  uint8_t tries = RECONNECT_TRIES;
60  while (tries--)
61  {
63  discard();
64 
65  if (testConnection())
66  return;
67  }
68 
69  abort("Verbindung kann nicht repariert werden");
70 }
71 
72 void B15F::discard(void)
73 {
74  try
75  {
76  uint8_t rq[] =
77  {
78  RQ_DISC
79  };
80 
81  usart.clearOutputBuffer();
82  for (uint8_t i = 0; i < 16; i++)
83  {
84  usart.transmit(&rq[0], 0, sizeof(rq)); // sende discard Befehl (verwerfe input)
85  delay_ms(4);
86  }
87  usart.clearInputBuffer();
88  }
89  catch (std::exception &ex)
90  {
91  abort(ex);
92  }
93 }
94 
96 {
97  // erzeuge zufälliges Byte
98  srand(time(NULL));
99  uint8_t dummy = rand() % 256;
100 
101  uint8_t rq[] =
102  {
103  RQ_TEST,
104  dummy
105  };
106  usart.transmit(&rq[0], 0, sizeof(rq));
107 
108  uint8_t aw[2];
109  usart.receive(&aw[0], 0, sizeof(aw));
110 
111  return aw[0] == MSG_OK && aw[1] == dummy;
112 }
113 
115 {
116  srand(time(NULL));
117  uint16_t dummy = rand() % (0xFFFF / 3);
118 
119  uint8_t rq[] =
120  {
121  RQ_INT,
122  static_cast<uint8_t >(dummy & 0xFF),
123  static_cast<uint8_t >(dummy >> 8)
124  };
125  usart.transmit(&rq[0], 0, sizeof(rq));
126 
127  uint16_t aw;
128  usart.receive(reinterpret_cast<uint8_t*>(&aw), 0, sizeof(aw));
129 
130  return aw == dummy * 3;
131 }
132 
133 
134 std::vector<std::string> B15F::getBoardInfo(void)
135 {
136  std::vector<std::string> info;
137 
138  uint8_t rq[] =
139  {
140  RQ_INFO
141  };
142  usart.transmit(&rq[0], 0, sizeof(rq));
143 
144  uint8_t n;
145  usart.receive(&n, 0, sizeof(n));
146 
147  while (n--)
148  {
149  uint8_t len;
150  usart.receive(&len, 0, sizeof(len));
151 
152  char str[len + 1];
153  str[len] = '\0';
154  usart.receive(reinterpret_cast<uint8_t *>(&str[0]), 0, len);
155 
156  info.push_back(std::string(str));
157  }
158 
159  uint8_t aw;
160  usart.receive(&aw, 0, sizeof(aw));
161  if (aw != MSG_OK)
162  abort("Board Info fehlerhalft: code " + std::to_string((int) aw));
163 
164  return info;
165 }
166 
168 {
169  uint8_t rq[] =
170  {
171  RQ_ST
172  };
173  usart.transmit(&rq[0], 0, sizeof(rq));
174 
175  uint8_t aw;
176  usart.receive(&aw, 0, sizeof(aw));
177  return aw == MSG_OK;
178 }
179 
180 bool B15F::digitalWrite0(uint8_t port)
181 {
182  uint8_t rq[] =
183  {
184  RQ_BA0,
185  port
186  };
187  usart.transmit(&rq[0], 0, sizeof(rq));
188 
189  uint8_t aw;
190  usart.receive(&aw, 0, sizeof(aw));
191  return aw == MSG_OK;
192 }
193 
194 bool B15F::digitalWrite1(uint8_t port)
195 {
196  uint8_t rq[] =
197  {
198  RQ_BA1,
199  port
200  };
201  usart.transmit(&rq[0], 0, sizeof(rq));
202 
203  uint8_t aw;
204  usart.receive(&aw, 0, sizeof(aw));
205  return aw == MSG_OK;
206 }
207 
209 {
210  usart.clearInputBuffer();
211  uint8_t rq[] =
212  {
213  RQ_BE0
214  };
215  usart.transmit(&rq[0], 0, sizeof(rq));
216 
217  uint8_t aw;
218  usart.receive(&aw, 0, sizeof(aw));
219  return aw;
220 }
221 
223 {
224  usart.clearInputBuffer();
225  uint8_t rq[] =
226  {
227  RQ_BE1
228  };
229  usart.transmit(&rq[0], 0, sizeof(rq));
230 
231  uint8_t aw;
232  usart.receive(&aw, 0, sizeof(aw));
233  return aw;
234 }
235 
237 {
238  usart.clearInputBuffer();
239  uint8_t rq[] =
240  {
241  RQ_DSW
242  };
243  usart.transmit(&rq[0], 0, sizeof(rq));
244 
245  uint8_t aw;
246  usart.receive(&aw, 0, sizeof(aw));
247  return aw;
248 }
249 
250 bool B15F::analogWrite0(uint16_t value)
251 {
252  uint8_t rq[] =
253  {
254  RQ_AA0,
255  static_cast<uint8_t >(value & 0xFF),
256  static_cast<uint8_t >(value >> 8)
257  };
258  usart.transmit(&rq[0], 0, sizeof(rq));
259 
260  uint8_t aw;
261  usart.receive(&aw, 0, sizeof(aw));
262  return aw == MSG_OK;
263 }
264 
265 bool B15F::analogWrite1(uint16_t value)
266 {
267  uint8_t rq[] =
268  {
269  RQ_AA1,
270  static_cast<uint8_t >(value & 0xFF),
271  static_cast<uint8_t >(value >> 8)
272  };
273  usart.transmit(&rq[0], 0, sizeof(rq));
274 
275  uint8_t aw;
276  usart.receive(&aw, 0, sizeof(aw));
277  return aw == MSG_OK;
278 }
279 
280 uint16_t B15F::analogRead(uint8_t channel)
281 {
282  usart.clearInputBuffer();
283  if (channel > 7)
284  abort("Bad ADC channel: " + std::to_string(channel));
285 
286  uint8_t rq[] =
287  {
288  RQ_ADC,
289  channel
290  };
291 
292  usart.transmit(&rq[0], 0, sizeof(rq));
293 
294  uint16_t aw;
295  usart.receive(reinterpret_cast<uint8_t*>(&aw), 0, sizeof(aw));
296 
297  if (aw > 1023)
298  abort("Bad ADC data detected (1)");
299  return aw;
300 }
301 
302 void
303 B15F::analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b,
304  uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
305 {
306  /*
307  // prepare pointers
308  buffer_a += offset_a;
309  buffer_b += offset_b;
310 
311 
312  usart.clearInputBuffer();
313  usart.writeByte(RQ_ADC_DAC_STROKE);
314  usart.writeByte(channel_a);
315  usart.writeByte(channel_b);
316  usart.writeInt(start);
317  usart.writeInt(static_cast<uint16_t>(delta));
318  usart.writeInt(count);
319 
320  for (uint16_t i = 0; i < count; i++) {
321  if (buffer_a) {
322  buffer_a[i] = usart.readInt();
323 
324  if (buffer_a[i] > 1023) // check for broken usart connection
325  abort("Bad ADC data detected (2)");
326  } else {
327  usart.readInt();
328  }
329 
330  if (buffer_b) {
331  buffer_b[i] = usart.readInt();
332 
333  if (buffer_b[i] > 1023) // check for broken usart connection
334  abort("Bad ADC data detected (3)");
335  } else {
336  usart.readInt();
337  }
338  }
339 
340  uint8_t aw = usart.readByte();
341  if (aw != MSG_OK)
342  abort("Sequenz unterbrochen");
343 
344  delay_us(10);*/
345 }
346 
347 uint8_t B15F::pwmSetFrequency(uint32_t freq)
348 {
349  usart.clearInputBuffer();
350 
351  uint8_t rq[] =
352  {
353  RQ_PWM_SET_FREQ,
354  static_cast<uint8_t>((freq >> 0) & 0xFF),
355  static_cast<uint8_t>((freq >> 8) & 0xFF),
356  static_cast<uint8_t>((freq >> 16) & 0xFF),
357  static_cast<uint8_t>((freq >> 24) & 0xFF)
358  };
359 
360  usart.transmit(&rq[0], 0, sizeof(rq));
361 
362  uint8_t aw;
363  usart.receive(&aw, 0, sizeof(aw));
364  return aw;
365 }
366 
367 bool B15F::pwmSetValue(uint8_t value)
368 {
369  usart.clearInputBuffer();
370 
371  uint8_t rq[] =
372  {
373  RQ_PWM_SET_VALUE,
374  value
375  };
376 
377  usart.transmit(&rq[0], 0, sizeof(rq));
378 
379  uint8_t aw;
380  usart.receive(&aw, 0, sizeof(aw));
381  return aw == MSG_OK;
382 }
383 
384 bool B15F::setRegister(uint8_t adr, uint8_t val)
385 {
386  usart.clearInputBuffer();
387 
388  uint8_t rq[] =
389  {
390  RQ_SET_REG,
391  adr,
392  val
393  };
394 
395  usart.transmit(&rq[0], 0, sizeof(rq));
396 
397  uint8_t aw;
398  usart.receive(&aw, 0, sizeof(aw));
399  return aw == val;
400 }
401 
402 uint8_t B15F::getRegister(uint8_t adr)
403 {
404  usart.clearInputBuffer();
405 
406  uint8_t rq[] =
407  {
408  RQ_GET_REG,
409  adr
410  };
411 
412  usart.transmit(&rq[0], 0, sizeof(rq));
413 
414  uint8_t aw;
415  usart.receive(&aw, 0, sizeof(aw));
416  return aw;
417 }
418 
419 
420 void B15F::delay_ms(uint16_t ms)
421 {
422  std::this_thread::sleep_for(std::chrono::milliseconds(ms));
423 }
424 
425 void B15F::delay_us(uint16_t us)
426 {
427  std::this_thread::sleep_for(std::chrono::microseconds(us));
428 }
429 
431 {
432  if (!instance)
433  instance = new B15F();
434 
435  return *instance;
436 }
437 
438 // https://stackoverflow.com/a/478960
439 std::string B15F::exec(std::string cmd)
440 {
441  std::array<char, 128> buffer;
442  std::string result;
443  std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), pclose);
444  if (!pipe)
445  {
446  throw std::runtime_error("popen() failed!");
447  }
448  while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr)
449  {
450  result += buffer.data();
451  }
452  return result;
453 }
454 
455 void B15F::abort(std::string msg)
456 {
457  DriverException ex(msg);
458  abort(ex);
459 }
460 
461 void B15F::abort(std::exception &ex)
462 {
463  if (errorhandler)
464  errorhandler(ex);
465  else
466  {
467  std::cerr << "NOTICE: B15F::errorhandler not set" << std::endl;
468  std::cout << ex.what() << std::endl;
469  throw DriverException(ex.what());
470  }
471 }
472 
473 void B15F::setAbortHandler(errorhandler_t func)
474 {
475  errorhandler = func;
476 }
+
static std::string exec(std::string cmd)
Definition: b15f.cpp:439
+
uint8_t getRegister(uint8_t adr)
Definition: b15f.cpp:402
+
void delay_us(uint16_t us)
Definition: b15f.cpp:425
+
uint8_t digitalRead0(void)
Definition: b15f.cpp:208
+
uint8_t pwmSetFrequency(uint32_t freq)
Definition: b15f.cpp:347
+
void analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
Definition: b15f.cpp:303
+
bool testConnection(void)
Definition: b15f.cpp:95
+
uint8_t readDipSwitch(void)
Definition: b15f.cpp:236
+
void delay_ms(uint16_t ms)
Definition: b15f.cpp:420
+
bool setRegister(uint8_t adr, uint8_t val)
Definition: b15f.cpp:384
+
static B15F & getInstance(void)
Definition: b15f.cpp:430
Definition: b15f.h:26
void transmit(uint8_t *buffer, uint16_t offset, uint8_t len)
Definition: usart.cpp:78
-
static void abort(std::string msg)
Definition: b15f.cpp:398
+
static void abort(std::string msg)
Definition: b15f.cpp:455
+
void receive(uint8_t *buffer, uint16_t offset, uint8_t len)
Definition: usart.cpp:70
void clearInputBuffer(void)
Definition: usart.cpp:49
void clearOutputBuffer(void)
Definition: usart.cpp:56
-
uint16_t analogRead(uint8_t channel)
Definition: b15f.cpp:220
-
bool digitalWrite0(uint8_t)
Definition: b15f.cpp:153
+
uint16_t analogRead(uint8_t channel)
Definition: b15f.cpp:280
+
bool digitalWrite0(uint8_t)
Definition: b15f.cpp:180
const std::string PRE
B15F stdout prefix.
Definition: b15f.h:231
void setBaudrate(uint32_t baudrate)
Definition: usart.cpp:96
-
bool activateSelfTestMode(void)
Definition: b15f.cpp:145
-
std::vector< std::string > getBoardInfo(void)
Definition: b15f.cpp:118
+
bool activateSelfTestMode(void)
Definition: b15f.cpp:167
+
std::vector< std::string > getBoardInfo(void)
Definition: b15f.cpp:134
constexpr static uint16_t RECONNECT_TIMEOUT
Time in ms after which a reconnect attempt aborts.
Definition: b15f.h:234
-
bool analogWrite1(uint16_t port)
Definition: b15f.cpp:210
-
bool digitalWrite1(uint8_t)
Definition: b15f.cpp:163
-
bool pwmSetValue(uint8_t value)
Definition: b15f.cpp:310
+
bool analogWrite1(uint16_t port)
Definition: b15f.cpp:265
+
bool digitalWrite1(uint8_t)
Definition: b15f.cpp:194
+
bool pwmSetValue(uint8_t value)
Definition: b15f.cpp:367
void discard(void)
Definition: b15f.cpp:72
constexpr static uint8_t MSG_OK
Value to acknowledge a received command.
Definition: b15f.h:232
void openDevice(std::string device)
Definition: usart.cpp:8
-
uint8_t digitalRead1(void)
Definition: b15f.cpp:182
+
uint8_t digitalRead1(void)
Definition: b15f.cpp:222
void reconnect(void)
Definition: b15f.cpp:57
constexpr static uint32_t BAUDRATE
USART baudrate for communication with the MCU.
Definition: b15f.h:237
-
static void setAbortHandler(errorhandler_t func)
Definition: b15f.cpp:415
-
bool analogWrite0(uint16_t port)
Definition: b15f.cpp:200
+
static void setAbortHandler(errorhandler_t func)
Definition: b15f.cpp:473
+
bool analogWrite0(uint16_t port)
Definition: b15f.cpp:250
constexpr static uint8_t RECONNECT_TRIES
Maximum count of reconnect attempts after which the driver stops.
Definition: b15f.h:236
-
bool testIntConv(void)
Definition: b15f.cpp:105
+
bool testIntConv(void)
Definition: b15f.cpp:114
diff --git a/docs/html/b15f_8h_source.html b/docs/html/b15f_8h_source.html index 2c00d60..e07ff44 100644 --- a/docs/html/b15f_8h_source.html +++ b/docs/html/b15f_8h_source.html @@ -71,43 +71,43 @@ $(function() {
1 #ifndef B15F_H
2 #define B15F_H
3 
4 #include <iostream>
5 #include <bits/stdc++.h>
6 #include <string>
7 #include <fstream>
8 #include <cstdlib>
9 #include <chrono>
10 #include <cstdint>
11 #include <vector>
12 
13 #include <unistd.h>
14 #include <fcntl.h>
15 #include <sys/ioctl.h>
16 #include <termios.h>
17 #include "usart.h"
18 #include "driverexception.h"
19 #include "timeoutexception.h"
20 
21 typedef std::function<void(std::exception&)> errorhandler_t;
22 
23 
26 class B15F
27 {
28 private:
29  // privater Konstruktor
30  B15F(void);
31 public:
32 
33  /*************************************
34  * Grundfunktionen des B15F Treibers *
35  *************************************/
36 
41  void reconnect(void);
42 
47  void discard(void);
48 
53  bool testConnection(void);
54 
59  bool testIntConv(void);
60 
65  std::vector<std::string> getBoardInfo(void);
66 
71  void delay_ms(uint16_t ms);
72 
77  void delay_us(uint16_t us);
78 
83  static B15F& getInstance(void);
84 
89  static std::string exec(std::string cmd);
90 
95  static void abort(std::string msg);
96 
101  static void abort(std::exception& ex);
102 
107  static void setAbortHandler(errorhandler_t func);
108 
109  /*************************************/
110 
111 
112 
113  /*************************
114  * Steuerbefehle für B15 *
115  *************************/
116 
122  bool activateSelfTestMode(void);
123 
129  bool digitalWrite0(uint8_t);
130 
136  bool digitalWrite1(uint8_t);
137 
143  uint8_t digitalRead0(void);
144 
150  uint8_t digitalRead1(void);
151 
157  uint8_t readDipSwitch(void);
158 
164  bool analogWrite0(uint16_t port);
165 
171  bool analogWrite1(uint16_t port);
172 
178  uint16_t analogRead(uint8_t channel);
179 
195  void analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count);
196 
204  uint8_t pwmSetFrequency(uint32_t freq);
205 
211  bool pwmSetValue(uint8_t value);
212 
220  bool setRegister(uint8_t adr, uint8_t val);
221 
227  uint8_t getRegister(uint8_t adr);
228 
229  /*************************/
230 
231 
232  // CONSTANTS
233  const std::string PRE = "[B15F] ";
234  constexpr static uint8_t MSG_OK = 0xFF;
235  constexpr static uint8_t MSG_FAIL = 0xFE;
236  constexpr static uint16_t RECONNECT_TIMEOUT = 64;
237  constexpr static uint16_t WDT_TIMEOUT = 15;
238  constexpr static uint8_t RECONNECT_TRIES = 3;
239  constexpr static uint32_t BAUDRATE = 57600;
240 
241 private:
242 
247  void init(void);
248 
249  USART usart;
250  static B15F* instance;
251  static errorhandler_t errorhandler;
252 
253  // REQUESTS
254  constexpr static uint8_t RQ_DISC = 0;
255  constexpr static uint8_t RQ_TEST = 1;
256  constexpr static uint8_t RQ_INFO = 2;
257  constexpr static uint8_t RQ_INT = 3;
258  constexpr static uint8_t RQ_ST = 4;
259  constexpr static uint8_t RQ_BA0 = 5;
260  constexpr static uint8_t RQ_BA1 = 6;
261  constexpr static uint8_t RQ_BE0 = 7;
262  constexpr static uint8_t RQ_BE1 = 8;
263  constexpr static uint8_t RQ_DSW = 9;
264  constexpr static uint8_t RQ_AA0 = 10;
265  constexpr static uint8_t RQ_AA1 = 11;
266  constexpr static uint8_t RQ_ADC = 12;
267  constexpr static uint8_t RQ_ADC_DAC_STROKE = 13;
268  constexpr static uint8_t RQ_PWM_SET_FREQ = 14;
269  constexpr static uint8_t RQ_PWM_SET_VALUE = 15;
270  constexpr static uint8_t RQ_SET_REG = 16;
271  constexpr static uint8_t RQ_GET_REG = 17;
272 };
273 
274 #endif // B15F_H
-
static std::string exec(std::string cmd)
Definition: b15f.cpp:382
+
static std::string exec(std::string cmd)
Definition: b15f.cpp:439
constexpr static uint8_t MSG_FAIL
Value to reject a received command.
Definition: b15f.h:233
-
uint8_t getRegister(uint8_t adr)
Definition: b15f.cpp:345
-
void delay_us(uint16_t us)
Definition: b15f.cpp:368
-
uint8_t digitalRead0(void)
Definition: b15f.cpp:173
-
uint8_t pwmSetFrequency(uint32_t freq)
Definition: b15f.cpp:290
-
void analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
Definition: b15f.cpp:241
-
bool testConnection(void)
Definition: b15f.cpp:90
-
uint8_t readDipSwitch(void)
Definition: b15f.cpp:191
-
void delay_ms(uint16_t ms)
Definition: b15f.cpp:363
-
bool setRegister(uint8_t adr, uint8_t val)
Definition: b15f.cpp:327
-
static B15F & getInstance(void)
Definition: b15f.cpp:373
+
uint8_t getRegister(uint8_t adr)
Definition: b15f.cpp:402
+
void delay_us(uint16_t us)
Definition: b15f.cpp:425
+
uint8_t digitalRead0(void)
Definition: b15f.cpp:208
+
uint8_t pwmSetFrequency(uint32_t freq)
Definition: b15f.cpp:347
+
void analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
Definition: b15f.cpp:303
+
bool testConnection(void)
Definition: b15f.cpp:95
+
uint8_t readDipSwitch(void)
Definition: b15f.cpp:236
+
void delay_ms(uint16_t ms)
Definition: b15f.cpp:420
+
bool setRegister(uint8_t adr, uint8_t val)
Definition: b15f.cpp:384
+
static B15F & getInstance(void)
Definition: b15f.cpp:430
Definition: b15f.h:26
-
static void abort(std::string msg)
Definition: b15f.cpp:398
+
static void abort(std::string msg)
Definition: b15f.cpp:455
Definition: usart.h:13
-
uint16_t analogRead(uint8_t channel)
Definition: b15f.cpp:220
-
bool digitalWrite0(uint8_t)
Definition: b15f.cpp:153
+
uint16_t analogRead(uint8_t channel)
Definition: b15f.cpp:280
+
bool digitalWrite0(uint8_t)
Definition: b15f.cpp:180
const std::string PRE
B15F stdout prefix.
Definition: b15f.h:231
-
bool activateSelfTestMode(void)
Definition: b15f.cpp:145
-
std::vector< std::string > getBoardInfo(void)
Definition: b15f.cpp:118
+
bool activateSelfTestMode(void)
Definition: b15f.cpp:167
+
std::vector< std::string > getBoardInfo(void)
Definition: b15f.cpp:134
constexpr static uint16_t RECONNECT_TIMEOUT
Time in ms after which a reconnect attempt aborts.
Definition: b15f.h:234
-
bool analogWrite1(uint16_t port)
Definition: b15f.cpp:210
-
bool digitalWrite1(uint8_t)
Definition: b15f.cpp:163
-
bool pwmSetValue(uint8_t value)
Definition: b15f.cpp:310
+
bool analogWrite1(uint16_t port)
Definition: b15f.cpp:265
+
bool digitalWrite1(uint8_t)
Definition: b15f.cpp:194
+
bool pwmSetValue(uint8_t value)
Definition: b15f.cpp:367
void discard(void)
Definition: b15f.cpp:72
constexpr static uint8_t MSG_OK
Value to acknowledge a received command.
Definition: b15f.h:232
-
uint8_t digitalRead1(void)
Definition: b15f.cpp:182
+
uint8_t digitalRead1(void)
Definition: b15f.cpp:222
constexpr static uint16_t WDT_TIMEOUT
Time in ms after which the watch dog timer resets the MCU.
Definition: b15f.h:235
void reconnect(void)
Definition: b15f.cpp:57
constexpr static uint32_t BAUDRATE
USART baudrate for communication with the MCU.
Definition: b15f.h:237
-
static void setAbortHandler(errorhandler_t func)
Definition: b15f.cpp:415
-
bool analogWrite0(uint16_t port)
Definition: b15f.cpp:200
+
static void setAbortHandler(errorhandler_t func)
Definition: b15f.cpp:473
+
bool analogWrite0(uint16_t port)
Definition: b15f.cpp:250
constexpr static uint8_t RECONNECT_TRIES
Maximum count of reconnect attempts after which the driver stops.
Definition: b15f.h:236
-
bool testIntConv(void)
Definition: b15f.cpp:105
+
bool testIntConv(void)
Definition: b15f.cpp:114
diff --git a/docs/html/backup_8cpp_source.html b/docs/html/backup_8cpp_source.html index ceb3907..c5c60b4 100644 --- a/docs/html/backup_8cpp_source.html +++ b/docs/html/backup_8cpp_source.html @@ -71,11 +71,11 @@ $(function() {
1 
2 void USART::writeByte(uint8_t b)
3 {
4  int sent = write(file_desc, &b, 1);
5  if (sent != 1)
6  {
7  std::cout << "WARNUNG: Fehler beim Senden (" << sent << "): writeByte(), wiederhole..." << std::endl;
8  usleep(100000);
9  sent = write(file_desc, &b, 1);
10  if (sent != 1)
11  throw USARTException("Fehler beim Senden: writeByte()");
12  }
13 
14 }
15 
16 void USART::writeInt(uint16_t d)
17 {
18  int sent = write(file_desc, reinterpret_cast<char *>(&d), 2);
19  if (sent != 2)
20  throw USARTException("Fehler beim Senden: writeInt()");
21 }
22 
23 void USART::writeU32(uint32_t w)
24 {
25  int sent = write(file_desc, reinterpret_cast<char *>(&w), 4);
26  if (sent != 4)
27  throw USARTException("Fehler beim Senden: writeU32()");
28 }
29 
30 uint8_t USART::readByte(void)
31 {
32  char b;
33  auto start = std::chrono::steady_clock::now();
34  auto end = start;
35  uint16_t elapsed = 0;
36  while (elapsed < timeout * 100)
37  {
38  int code = read(file_desc, &b, 1);
39  if (code > 0)
40  return static_cast<uint8_t>(b);
41 
42  end = std::chrono::steady_clock::now();
43  elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
44  }
45 
46  throw TimeoutException("Verbindung unterbrochen.", timeout);
47 }
48 
49 uint16_t USART::readInt(void)
50 {
51  return readByte() | readByte() << 8;
52 }
- + diff --git a/docs/html/classB15F-members.html b/docs/html/classB15F-members.html index ea2b029..4d727c9 100644 --- a/docs/html/classB15F-members.html +++ b/docs/html/classB15F-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/docs/html/classB15F.html b/docs/html/classB15F.html index 2f7b525..f5da455 100644 --- a/docs/html/classB15F.html +++ b/docs/html/classB15F.html @@ -202,7 +202,7 @@ constexpr static uint32_t  -

Definition at line 403 of file b15f.cpp.

+

Definition at line 461 of file b15f.cpp.

@@ -236,7 +236,7 @@ constexpr static uint32_t  -

Definition at line 398 of file b15f.cpp.

+

Definition at line 455 of file b15f.cpp.

@@ -262,7 +262,7 @@ constexpr static uint32_t  -

Definition at line 145 of file b15f.cpp.

+

Definition at line 167 of file b15f.cpp.

@@ -294,7 +294,7 @@ constexpr static uint32_t  -

Definition at line 220 of file b15f.cpp.

+

Definition at line 280 of file b15f.cpp.

@@ -386,7 +386,7 @@ constexpr static uint32_t  -

Definition at line 241 of file b15f.cpp.

+

Definition at line 303 of file b15f.cpp.

@@ -418,7 +418,7 @@ constexpr static uint32_t  -

Definition at line 200 of file b15f.cpp.

+

Definition at line 250 of file b15f.cpp.

@@ -450,7 +450,7 @@ constexpr static uint32_t  -

Definition at line 210 of file b15f.cpp.

+

Definition at line 265 of file b15f.cpp.

@@ -476,7 +476,7 @@ constexpr static uint32_t  -

Definition at line 363 of file b15f.cpp.

+

Definition at line 420 of file b15f.cpp.

@@ -502,7 +502,7 @@ constexpr static uint32_t  -

Definition at line 368 of file b15f.cpp.

+

Definition at line 425 of file b15f.cpp.

@@ -529,7 +529,7 @@ constexpr static uint32_t  -

Definition at line 173 of file b15f.cpp.

+

Definition at line 208 of file b15f.cpp.

@@ -556,7 +556,7 @@ constexpr static uint32_t  -

Definition at line 182 of file b15f.cpp.

+

Definition at line 222 of file b15f.cpp.

@@ -588,7 +588,7 @@ constexpr static uint32_t  -

Definition at line 153 of file b15f.cpp.

+

Definition at line 180 of file b15f.cpp.

@@ -620,7 +620,7 @@ constexpr static uint32_t  -

Definition at line 163 of file b15f.cpp.

+

Definition at line 194 of file b15f.cpp.

@@ -680,7 +680,7 @@ constexpr static uint32_t  -

Definition at line 382 of file b15f.cpp.

+

Definition at line 439 of file b15f.cpp.

@@ -706,7 +706,7 @@ constexpr static uint32_t  -

Definition at line 118 of file b15f.cpp.

+

Definition at line 134 of file b15f.cpp.

@@ -740,7 +740,7 @@ constexpr static uint32_t  -

Definition at line 373 of file b15f.cpp.

+

Definition at line 430 of file b15f.cpp.

@@ -772,7 +772,7 @@ constexpr static uint32_t  -

Definition at line 345 of file b15f.cpp.

+

Definition at line 402 of file b15f.cpp.

@@ -805,7 +805,7 @@ constexpr static uint32_t  -

Definition at line 290 of file b15f.cpp.

+

Definition at line 347 of file b15f.cpp.

@@ -837,7 +837,7 @@ constexpr static uint32_t  -

Definition at line 310 of file b15f.cpp.

+

Definition at line 367 of file b15f.cpp.

@@ -864,7 +864,7 @@ constexpr static uint32_t  -

Definition at line 191 of file b15f.cpp.

+

Definition at line 236 of file b15f.cpp.

@@ -924,7 +924,7 @@ constexpr static uint32_t  -

Definition at line 415 of file b15f.cpp.

+

Definition at line 473 of file b15f.cpp.

@@ -967,7 +967,7 @@ constexpr static uint32_t  -

Definition at line 327 of file b15f.cpp.

+

Definition at line 384 of file b15f.cpp.

@@ -993,7 +993,7 @@ constexpr static uint32_t  -

Definition at line 90 of file b15f.cpp.

+

Definition at line 95 of file b15f.cpp.

@@ -1019,7 +1019,7 @@ constexpr static uint32_t  -

Definition at line 105 of file b15f.cpp.

+

Definition at line 114 of file b15f.cpp.

@@ -1030,7 +1030,7 @@ constexpr static uint32_t  diff --git a/docs/html/classDot-members.html b/docs/html/classDot-members.html index da5ef98..90e9a67 100644 --- a/docs/html/classDot-members.html +++ b/docs/html/classDot-members.html @@ -76,7 +76,7 @@ $(function() { diff --git a/docs/html/classDot.html b/docs/html/classDot.html index e6f418b..afdbc85 100644 --- a/docs/html/classDot.html +++ b/docs/html/classDot.html @@ -196,7 +196,7 @@ Public Member Functions diff --git a/docs/html/classDriverException-members.html b/docs/html/classDriverException-members.html index 37e5ca6..c31fd7a 100644 --- a/docs/html/classDriverException-members.html +++ b/docs/html/classDriverException-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/html/classDriverException.html b/docs/html/classDriverException.html index f40ae8c..dbd0544 100644 --- a/docs/html/classDriverException.html +++ b/docs/html/classDriverException.html @@ -109,7 +109,7 @@ std::string msg_< diff --git a/docs/html/classPlottyFile-members.html b/docs/html/classPlottyFile-members.html index 8cb5beb..0f5e431 100644 --- a/docs/html/classPlottyFile-members.html +++ b/docs/html/classPlottyFile-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/docs/html/classPlottyFile.html b/docs/html/classPlottyFile.html index cd79636..cb1c533 100644 --- a/docs/html/classPlottyFile.html +++ b/docs/html/classPlottyFile.html @@ -811,7 +811,7 @@ Public Member Functions diff --git a/docs/html/classTimeoutException-members.html b/docs/html/classTimeoutException-members.html index 156b33b..820b7b2 100644 --- a/docs/html/classTimeoutException-members.html +++ b/docs/html/classTimeoutException-members.html @@ -78,7 +78,7 @@ $(function() { diff --git a/docs/html/classTimeoutException.html b/docs/html/classTimeoutException.html index 505363b..66d4503 100644 --- a/docs/html/classTimeoutException.html +++ b/docs/html/classTimeoutException.html @@ -112,7 +112,7 @@ int m_timeout diff --git a/docs/html/classUSART-members.html b/docs/html/classUSART-members.html index 12b5a35..8366260 100644 --- a/docs/html/classUSART-members.html +++ b/docs/html/classUSART-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/docs/html/classUSART.html b/docs/html/classUSART.html index 3a81f92..4eb8a95 100644 --- a/docs/html/classUSART.html +++ b/docs/html/classUSART.html @@ -489,7 +489,7 @@ Public Member Functions diff --git a/docs/html/classUSARTException-members.html b/docs/html/classUSARTException-members.html index c9696e1..72be017 100644 --- a/docs/html/classUSARTException-members.html +++ b/docs/html/classUSARTException-members.html @@ -77,7 +77,7 @@ $(function() { diff --git a/docs/html/classUSARTException.html b/docs/html/classUSARTException.html index bab5acb..3f7d649 100644 --- a/docs/html/classUSARTException.html +++ b/docs/html/classUSARTException.html @@ -102,7 +102,7 @@ std::string 

Detailed Description

Exception for USART problems, for instance buffer overflow.

-

Definition at line 11 of file usartexception.h.

+

Definition at line 9 of file usartexception.h.

Constructor & Destructor Documentation

◆ USARTException() [1/2]

@@ -134,7 +134,7 @@ std::string  -

Definition at line 18 of file usartexception.h.

+

Definition at line 16 of file usartexception.h.

@@ -168,7 +168,7 @@ std::string  -

Definition at line 26 of file usartexception.h.

+

Definition at line 24 of file usartexception.h.

@@ -229,7 +229,7 @@ std::string  @@ -239,7 +239,7 @@ std::string  diff --git a/docs/html/classView-members.html b/docs/html/classView-members.html index a9ed5a9..fc7095a 100644 --- a/docs/html/classView-members.html +++ b/docs/html/classView-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/docs/html/classView.html b/docs/html/classView.html index fa71626..bd00dda 100644 --- a/docs/html/classView.html +++ b/docs/html/classView.html @@ -157,7 +157,7 @@ constexpr static int KEY_E diff --git a/docs/html/classViewInfo-members.html b/docs/html/classViewInfo-members.html index 8c6fde2..73d04e5 100644 --- a/docs/html/classViewInfo-members.html +++ b/docs/html/classViewInfo-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/docs/html/classViewInfo.html b/docs/html/classViewInfo.html index 204d1a1..79587c4 100644 --- a/docs/html/classViewInfo.html +++ b/docs/html/classViewInfo.html @@ -185,7 +185,7 @@ static std::vector< std::string >  diff --git a/docs/html/classViewMonitor-members.html b/docs/html/classViewMonitor-members.html index e3e7551..60da14d 100644 --- a/docs/html/classViewMonitor-members.html +++ b/docs/html/classViewMonitor-members.html @@ -103,7 +103,7 @@ $(function() { diff --git a/docs/html/classViewMonitor.html b/docs/html/classViewMonitor.html index 91b330c..4915a9b 100644 --- a/docs/html/classViewMonitor.html +++ b/docs/html/classViewMonitor.html @@ -197,7 +197,7 @@ constexpr static int KEY_E diff --git a/docs/html/classViewPromt-members.html b/docs/html/classViewPromt-members.html index 7209583..70dad1e 100644 --- a/docs/html/classViewPromt-members.html +++ b/docs/html/classViewPromt-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/docs/html/classViewPromt.html b/docs/html/classViewPromt.html index c896e6b..a74c7ff 100644 --- a/docs/html/classViewPromt.html +++ b/docs/html/classViewPromt.html @@ -205,7 +205,7 @@ static std::vector< std::string >  diff --git a/docs/html/classViewSelection-members.html b/docs/html/classViewSelection-members.html index d819e76..b76a262 100644 --- a/docs/html/classViewSelection-members.html +++ b/docs/html/classViewSelection-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/docs/html/classViewSelection.html b/docs/html/classViewSelection.html index 0af6fb2..9f4a292 100644 --- a/docs/html/classViewSelection.html +++ b/docs/html/classViewSelection.html @@ -172,7 +172,7 @@ static std::vector< std::string >  diff --git a/docs/html/classes.html b/docs/html/classes.html index e13d485..5da6c23 100644 --- a/docs/html/classes.html +++ b/docs/html/classes.html @@ -105,7 +105,7 @@ $(function() { diff --git a/docs/html/cli_8cpp_source.html b/docs/html/cli_8cpp_source.html index ae2abad..c8a025e 100644 --- a/docs/html/cli_8cpp_source.html +++ b/docs/html/cli_8cpp_source.html @@ -68,11 +68,11 @@ $(function() {
1 #define B15F_CLI_DEBUG
2 
3 #include <stdio.h>
4 #include <ncurses.h> // sudo apt-get install libncurses5-dev
5 #include <vector>
6 #include <string>
7 #include <iostream>
8 #include <signal.h>
9 #include <sys/ioctl.h>
10 #include <unistd.h>
11 #include <signal.h>
12 #include <future>
13 #include <thread>
14 #include <chrono>
15 #include "drv/b15f.h"
16 #include "ui/ui.h"
17 #include "ui/view_selection.h"
18 #include "ui/view_info.h"
19 #include "ui/view_monitor.h"
20 #include "ui/view_promt.h"
21 
22 volatile int win_changed_cooldown = 0;
23 volatile bool t_refresh_active = false;
24 
25 void signal_handler(int signal)
26 {
27  if(signal == SIGWINCH)
28  {
29  win_changed_cooldown = 10; // 100ms
30 
31  if (!t_refresh_active)
32  {
33  if(t_refresh.joinable())
34  t_refresh.join();
35  t_refresh_active = true;
36  t_refresh = std::thread([]()
37  {
38 
39  while(win_changed_cooldown--)
40  std::this_thread::sleep_for(std::chrono::milliseconds(10));
41 
42  t_refresh_active = false;
43 
44  if(win_stack.size())
45  win_stack.back()->repaint();
46 
47  });
48  }
49 
50  }
51  else if(signal == SIGINT)
52  {
53  cleanup();
54  std::cout << "SIGINT - Abbruch." << std::endl;
55  exit(EXIT_FAILURE);
56  }
57 }
58 
59 void abort_handler(std::exception& ex)
60 {
61  ViewInfo* view = new ViewInfo();
62  view->setTitle("Fehler");
63  std::string msg(ex.what());
64  msg += "\n\nBeende in 5 Sekunden.";
65  view->setText(msg.c_str());
66  view->setLabelClose("");
67  view->repaint();
68 
69  std::this_thread::sleep_for(std::chrono::milliseconds(5000));
70 
71  cleanup();
72  std::cerr << std::endl << "*** EXCEPTION ***" << std::endl << ex.what() << std::endl;
73  exit(EXIT_FAILURE);
74 }
75 
76 void init()
77 {
78  // init b15 driver
80 #ifndef B15F_CLI_DEBUG
81  std::cout << std::endl << "Starte in 3s ..." << std::endl;
82  sleep(3);
83 #endif
84  B15F::setAbortHandler(&abort_handler);
85 
86  // init all ncurses stuff
87  initscr();
88  start_color();
89  curs_set(0); // 0: invisible, 1: normal, 2: very visible
90  clear();
91  noecho();
92  cbreak(); // Line buffering disabled. pass on everything
93  mousemask(ALL_MOUSE_EVENTS, NULL);
94 
95  // connect signals to handler
96  signal(SIGWINCH, signal_handler);
97  signal(SIGINT, signal_handler);
98 
99  // set view context
100  View::setWinContext(newwin(25, 85, 0, 0));
101 }
102 
103 
104 int main()
105 {
106  init();
107 
108  int exit_code = EXIT_SUCCESS;
109 
110  show_main(0);
111 
112  cleanup();
113 
114  return exit_code;
115 }
-
static B15F & getInstance(void)
Definition: b15f.cpp:373
-
static void setAbortHandler(errorhandler_t func)
Definition: b15f.cpp:415
+
static B15F & getInstance(void)
Definition: b15f.cpp:430
+
static void setAbortHandler(errorhandler_t func)
Definition: b15f.cpp:473
diff --git a/docs/html/dir_1788f8309b1a812dcb800a185471cf6c.html b/docs/html/dir_1788f8309b1a812dcb800a185471cf6c.html index 871f95a..a908015 100644 --- a/docs/html/dir_1788f8309b1a812dcb800a185471cf6c.html +++ b/docs/html/dir_1788f8309b1a812dcb800a185471cf6c.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/html/dir_19f2f1b99f19c12fa55b8d312cf373ed.html b/docs/html/dir_19f2f1b99f19c12fa55b8d312cf373ed.html index a53fe67..24fcf59 100644 --- a/docs/html/dir_19f2f1b99f19c12fa55b8d312cf373ed.html +++ b/docs/html/dir_19f2f1b99f19c12fa55b8d312cf373ed.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/html/dir_3d3c8ff3ebf9841b39117ac899f41936.html b/docs/html/dir_3d3c8ff3ebf9841b39117ac899f41936.html index f86514e..5939e6f 100644 --- a/docs/html/dir_3d3c8ff3ebf9841b39117ac899f41936.html +++ b/docs/html/dir_3d3c8ff3ebf9841b39117ac899f41936.html @@ -77,7 +77,7 @@ Directories diff --git a/docs/html/dir_587c94d866dbb2f408f78cf41f9b2f8d.html b/docs/html/dir_587c94d866dbb2f408f78cf41f9b2f8d.html index 878320b..7af269d 100644 --- a/docs/html/dir_587c94d866dbb2f408f78cf41f9b2f8d.html +++ b/docs/html/dir_587c94d866dbb2f408f78cf41f9b2f8d.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/html/dir_90e361ec3542f3dd076ea3ad19547437.html b/docs/html/dir_90e361ec3542f3dd076ea3ad19547437.html index 7a3fec8..38d6b31 100644 --- a/docs/html/dir_90e361ec3542f3dd076ea3ad19547437.html +++ b/docs/html/dir_90e361ec3542f3dd076ea3ad19547437.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/html/dir_95e29a8b8ee7c54052c171a88bb95675.html b/docs/html/dir_95e29a8b8ee7c54052c171a88bb95675.html index 4c678a4..8c90198 100644 --- a/docs/html/dir_95e29a8b8ee7c54052c171a88bb95675.html +++ b/docs/html/dir_95e29a8b8ee7c54052c171a88bb95675.html @@ -77,7 +77,7 @@ Directories diff --git a/docs/html/dir_f89abcb304c928c7d889aa5625570de5.html b/docs/html/dir_f89abcb304c928c7d889aa5625570de5.html index 324da84..aa7bba6 100644 --- a/docs/html/dir_f89abcb304c928c7d889aa5625570de5.html +++ b/docs/html/dir_f89abcb304c928c7d889aa5625570de5.html @@ -73,7 +73,7 @@ $(function() { diff --git a/docs/html/dot_8cpp_source.html b/docs/html/dot_8cpp_source.html index d4fc2e5..914f15a 100644 --- a/docs/html/dot_8cpp_source.html +++ b/docs/html/dot_8cpp_source.html @@ -77,7 +77,7 @@ $(function() {
Dot(uint16_t x, uint16_t y, uint8_t curve)
Definition: dot.cpp:3
diff --git a/docs/html/dot_8h_source.html b/docs/html/dot_8h_source.html index 1b7d1f7..78c98a1 100644 --- a/docs/html/dot_8h_source.html +++ b/docs/html/dot_8h_source.html @@ -78,7 +78,7 @@ $(function() {
Dot(uint16_t x, uint16_t y, uint8_t curve)
Definition: dot.cpp:3
diff --git a/docs/html/driverexception_8h_source.html b/docs/html/driverexception_8h_source.html index 9bffda7..4f01106 100644 --- a/docs/html/driverexception_8h_source.html +++ b/docs/html/driverexception_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/html/feature__tests_8c_source.html b/docs/html/feature__tests_8c_source.html index efcd263..c666e6f 100644 --- a/docs/html/feature__tests_8c_source.html +++ b/docs/html/feature__tests_8c_source.html @@ -73,7 +73,7 @@ $(function() {
1 
2 const char features[] = {"\n"
3  "C_FEATURE:"
4 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304
5  "1"
6 #else
7  "0"
8 #endif
9  "c_function_prototypes\n"
10  "C_FEATURE:"
11 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12  "1"
13 #else
14  "0"
15 #endif
16  "c_restrict\n"
17  "C_FEATURE:"
18 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L
19  "1"
20 #else
21  "0"
22 #endif
23  "c_static_assert\n"
24  "C_FEATURE:"
25 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26  "1"
27 #else
28  "0"
29 #endif
30  "c_variadic_macros\n"
31 
32  };
33 
34 int main(int argc, char** argv)
35 {
36  (void)argv;
37  return features[argc];
38 }
diff --git a/docs/html/feature__tests_8cxx_source.html b/docs/html/feature__tests_8cxx_source.html index ee23257..aed34e6 100644 --- a/docs/html/feature__tests_8cxx_source.html +++ b/docs/html/feature__tests_8cxx_source.html @@ -73,7 +73,7 @@ $(function() {
1 
2  const char features[] = {"\n"
3 "CXX_FEATURE:"
4 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L
5 "1"
6 #else
7 "0"
8 #endif
9 "cxx_aggregate_default_initializers\n"
10 "CXX_FEATURE:"
11 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
12 "1"
13 #else
14 "0"
15 #endif
16 "cxx_alias_templates\n"
17 "CXX_FEATURE:"
18 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
19 "1"
20 #else
21 "0"
22 #endif
23 "cxx_alignas\n"
24 "CXX_FEATURE:"
25 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
26 "1"
27 #else
28 "0"
29 #endif
30 "cxx_alignof\n"
31 "CXX_FEATURE:"
32 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
33 "1"
34 #else
35 "0"
36 #endif
37 "cxx_attributes\n"
38 "CXX_FEATURE:"
39 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
40 "1"
41 #else
42 "0"
43 #endif
44 "cxx_attribute_deprecated\n"
45 "CXX_FEATURE:"
46 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
47 "1"
48 #else
49 "0"
50 #endif
51 "cxx_auto_type\n"
52 "CXX_FEATURE:"
53 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
54 "1"
55 #else
56 "0"
57 #endif
58 "cxx_binary_literals\n"
59 "CXX_FEATURE:"
60 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
61 "1"
62 #else
63 "0"
64 #endif
65 "cxx_constexpr\n"
66 "CXX_FEATURE:"
67 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
68 "1"
69 #else
70 "0"
71 #endif
72 "cxx_contextual_conversions\n"
73 "CXX_FEATURE:"
74 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
75 "1"
76 #else
77 "0"
78 #endif
79 "cxx_decltype\n"
80 "CXX_FEATURE:"
81 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
82 "1"
83 #else
84 "0"
85 #endif
86 "cxx_decltype_auto\n"
87 "CXX_FEATURE:"
88 #if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L
89 "1"
90 #else
91 "0"
92 #endif
93 "cxx_decltype_incomplete_return_types\n"
94 "CXX_FEATURE:"
95 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
96 "1"
97 #else
98 "0"
99 #endif
100 "cxx_default_function_template_args\n"
101 "CXX_FEATURE:"
102 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
103 "1"
104 #else
105 "0"
106 #endif
107 "cxx_defaulted_functions\n"
108 "CXX_FEATURE:"
109 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
110 "1"
111 #else
112 "0"
113 #endif
114 "cxx_defaulted_move_initializers\n"
115 "CXX_FEATURE:"
116 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
117 "1"
118 #else
119 "0"
120 #endif
121 "cxx_delegating_constructors\n"
122 "CXX_FEATURE:"
123 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
124 "1"
125 #else
126 "0"
127 #endif
128 "cxx_deleted_functions\n"
129 "CXX_FEATURE:"
130 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
131 "1"
132 #else
133 "0"
134 #endif
135 "cxx_digit_separators\n"
136 "CXX_FEATURE:"
137 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
138 "1"
139 #else
140 "0"
141 #endif
142 "cxx_enum_forward_declarations\n"
143 "CXX_FEATURE:"
144 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
145 "1"
146 #else
147 "0"
148 #endif
149 "cxx_explicit_conversions\n"
150 "CXX_FEATURE:"
151 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
152 "1"
153 #else
154 "0"
155 #endif
156 "cxx_extended_friend_declarations\n"
157 "CXX_FEATURE:"
158 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
159 "1"
160 #else
161 "0"
162 #endif
163 "cxx_extern_templates\n"
164 "CXX_FEATURE:"
165 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
166 "1"
167 #else
168 "0"
169 #endif
170 "cxx_final\n"
171 "CXX_FEATURE:"
172 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
173 "1"
174 #else
175 "0"
176 #endif
177 "cxx_func_identifier\n"
178 "CXX_FEATURE:"
179 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
180 "1"
181 #else
182 "0"
183 #endif
184 "cxx_generalized_initializers\n"
185 "CXX_FEATURE:"
186 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
187 "1"
188 #else
189 "0"
190 #endif
191 "cxx_generic_lambdas\n"
192 "CXX_FEATURE:"
193 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
194 "1"
195 #else
196 "0"
197 #endif
198 "cxx_inheriting_constructors\n"
199 "CXX_FEATURE:"
200 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
201 "1"
202 #else
203 "0"
204 #endif
205 "cxx_inline_namespaces\n"
206 "CXX_FEATURE:"
207 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
208 "1"
209 #else
210 "0"
211 #endif
212 "cxx_lambdas\n"
213 "CXX_FEATURE:"
214 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
215 "1"
216 #else
217 "0"
218 #endif
219 "cxx_lambda_init_captures\n"
220 "CXX_FEATURE:"
221 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
222 "1"
223 #else
224 "0"
225 #endif
226 "cxx_local_type_template_args\n"
227 "CXX_FEATURE:"
228 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
229 "1"
230 #else
231 "0"
232 #endif
233 "cxx_long_long_type\n"
234 "CXX_FEATURE:"
235 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
236 "1"
237 #else
238 "0"
239 #endif
240 "cxx_noexcept\n"
241 "CXX_FEATURE:"
242 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
243 "1"
244 #else
245 "0"
246 #endif
247 "cxx_nonstatic_member_init\n"
248 "CXX_FEATURE:"
249 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
250 "1"
251 #else
252 "0"
253 #endif
254 "cxx_nullptr\n"
255 "CXX_FEATURE:"
256 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
257 "1"
258 #else
259 "0"
260 #endif
261 "cxx_override\n"
262 "CXX_FEATURE:"
263 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
264 "1"
265 #else
266 "0"
267 #endif
268 "cxx_range_for\n"
269 "CXX_FEATURE:"
270 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
271 "1"
272 #else
273 "0"
274 #endif
275 "cxx_raw_string_literals\n"
276 "CXX_FEATURE:"
277 #if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L
278 "1"
279 #else
280 "0"
281 #endif
282 "cxx_reference_qualified_functions\n"
283 "CXX_FEATURE:"
284 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L
285 "1"
286 #else
287 "0"
288 #endif
289 "cxx_relaxed_constexpr\n"
290 "CXX_FEATURE:"
291 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
292 "1"
293 #else
294 "0"
295 #endif
296 "cxx_return_type_deduction\n"
297 "CXX_FEATURE:"
298 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
299 "1"
300 #else
301 "0"
302 #endif
303 "cxx_right_angle_brackets\n"
304 "CXX_FEATURE:"
305 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
306 "1"
307 #else
308 "0"
309 #endif
310 "cxx_rvalue_references\n"
311 "CXX_FEATURE:"
312 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
313 "1"
314 #else
315 "0"
316 #endif
317 "cxx_sizeof_member\n"
318 "CXX_FEATURE:"
319 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
320 "1"
321 #else
322 "0"
323 #endif
324 "cxx_static_assert\n"
325 "CXX_FEATURE:"
326 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
327 "1"
328 #else
329 "0"
330 #endif
331 "cxx_strong_enums\n"
332 "CXX_FEATURE:"
333 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && __cplusplus
334 "1"
335 #else
336 "0"
337 #endif
338 "cxx_template_template_parameters\n"
339 "CXX_FEATURE:"
340 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
341 "1"
342 #else
343 "0"
344 #endif
345 "cxx_thread_local\n"
346 "CXX_FEATURE:"
347 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
348 "1"
349 #else
350 "0"
351 #endif
352 "cxx_trailing_return_types\n"
353 "CXX_FEATURE:"
354 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
355 "1"
356 #else
357 "0"
358 #endif
359 "cxx_unicode_literals\n"
360 "CXX_FEATURE:"
361 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
362 "1"
363 #else
364 "0"
365 #endif
366 "cxx_uniform_initialization\n"
367 "CXX_FEATURE:"
368 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
369 "1"
370 #else
371 "0"
372 #endif
373 "cxx_unrestricted_unions\n"
374 "CXX_FEATURE:"
375 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
376 "1"
377 #else
378 "0"
379 #endif
380 "cxx_user_literals\n"
381 "CXX_FEATURE:"
382 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L
383 "1"
384 #else
385 "0"
386 #endif
387 "cxx_variable_templates\n"
388 "CXX_FEATURE:"
389 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
390 "1"
391 #else
392 "0"
393 #endif
394 "cxx_variadic_macros\n"
395 "CXX_FEATURE:"
396 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
397 "1"
398 #else
399 "0"
400 #endif
401 "cxx_variadic_templates\n"
402 
403 };
404 
405 int main(int argc, char** argv) { (void)argv; return features[argc]; }
diff --git a/docs/html/files.html b/docs/html/files.html index 8c82b44..2e1ad56 100644 --- a/docs/html/files.html +++ b/docs/html/files.html @@ -109,7 +109,7 @@ $(function() { diff --git a/docs/html/functions.html b/docs/html/functions.html index 2c7fec8..82ac130 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -369,7 +369,7 @@ $(function() { diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index 8bfa8ab..0cf3285 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -337,7 +337,7 @@ $(function() { diff --git a/docs/html/functions_vars.html b/docs/html/functions_vars.html index e93604a..69c203a 100644 --- a/docs/html/functions_vars.html +++ b/docs/html/functions_vars.html @@ -91,7 +91,7 @@ $(function() { diff --git a/docs/html/hierarchy.html b/docs/html/hierarchy.html index ed00fde..e30ebdb 100644 --- a/docs/html/hierarchy.html +++ b/docs/html/hierarchy.html @@ -86,7 +86,7 @@ $(function() { diff --git a/docs/html/index.html b/docs/html/index.html index fc7e07d..92a0872 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -72,7 +72,7 @@ Dort befindet sich auch eine Übersicht der verfügbaren Befehle.

diff --git a/docs/html/plottyfile_8cpp_source.html b/docs/html/plottyfile_8cpp_source.html index ee3e7d4..f354875 100644 --- a/docs/html/plottyfile_8cpp_source.html +++ b/docs/html/plottyfile_8cpp_source.html @@ -101,7 +101,7 @@ $(function() {
std::string getUnitX(void) const
Definition: plottyfile.cpp:105
diff --git a/docs/html/plottyfile_8h_source.html b/docs/html/plottyfile_8h_source.html index f547f4d..d015346 100644 --- a/docs/html/plottyfile_8h_source.html +++ b/docs/html/plottyfile_8h_source.html @@ -102,7 +102,7 @@ $(function() {
std::string getUnitX(void) const
Definition: plottyfile.cpp:105
diff --git a/docs/html/timeoutexception_8h_source.html b/docs/html/timeoutexception_8h_source.html index a66ca6e..5aac1f4 100644 --- a/docs/html/timeoutexception_8h_source.html +++ b/docs/html/timeoutexception_8h_source.html @@ -74,7 +74,7 @@ $(function() { diff --git a/docs/html/ui_8cpp_source.html b/docs/html/ui_8cpp_source.html index ea37cff..f460c1a 100644 --- a/docs/html/ui_8cpp_source.html +++ b/docs/html/ui_8cpp_source.html @@ -73,22 +73,22 @@ $(function() {
1 #include "ui.h"
2 #include "../drv/b15f.h"
3 
4 std::vector<View*> win_stack;
5 std::thread t_refresh;
6 
7 void show_main(int)
8 {
9  ViewSelection* view = new ViewSelection();
10  view->setTitle("B15F - Command Line Interface");
11  view->addChoice("[ Monitor - Eingaben beobachten ]", &show_monitor);
12  view->addChoice("[ Digitale Ausgabe BE0 ]", &show_digital_output0);
13  view->addChoice("[ Digitale Ausgabe BE1 ]", &show_digital_output1);
14  view->addChoice("[ Analoge Ausgabe AA0 ]", &show_analog_output0);
15  view->addChoice("[ Analoge Ausgabe AA1 ]", &show_analog_output1);
16  view->addChoice("[ Selbsttest des B15 ]", &show_selftest_info);
17  view->addChoice("[ Informationen ]", &show_info);
18  view->addChoice("", nullptr);
19  view->addChoice("[ Beenden ]", &finish);
20  view->repaint();
21 
22  win_stack.push_back(view);
23  input(0);
24 }
25 
26 void input(int)
27 {
28  call_t nextCall;
29  int key;
30  do
31  {
32  key = wgetch(View::getWinContext());
33  win_stack.back()->repaint();
34  nextCall = win_stack.back()->keypress(key);
35 
36  if(key == -1)
37  view_back(key);
38 
39  if(nextCall)
40  nextCall(key);
41  }
42  while(win_stack.size());
43 }
44 
45 void view_back(int)
46 {
47  if(win_stack.size())
48  {
49  delete win_stack.back();
50  win_stack.pop_back();
51  }
52  if(win_stack.size())
53  win_stack.back()->repaint();
54 }
55 
56 void finish(int)
57 {
58  cleanup();
59  exit(EXIT_SUCCESS);
60 }
61 
62 void cleanup()
63 {
64  if(t_refresh.joinable())
65  t_refresh.join();
66  clrtoeol();
67  refresh();
68  endwin();
69 }
70 
71 void show_info(int)
72 {
73  ViewInfo* view = new ViewInfo();
74  view->setTitle("Info");
75  view->setText("Informationen zu Board 15 Famulus Edition\nEs war einmal...");
76  view->setLabelClose("[ Zurueck ]");
77  view->repaint();
78 
79  win_stack.push_back(view);
80  input(0);
81 }
82 
83 void show_monitor(int)
84 {
85  ViewMonitor* view = new ViewMonitor();
86  view->setTitle("Monitor");
87  view->setText("\nErfasse Messwerte...");
88  view->setLabelClose("[ Zurueck ]");
89  view->repaint();
90 
91  win_stack.push_back(view);
92  input(0);
93 }
94 
95 void show_invalid_port_input(int)
96 {
97  ViewInfo* view = new ViewInfo();
98  view->setTitle("Falsche Eingabe");
99  view->setText("Bitte geben Sie einen Wert aus dem Intervall [0, FF] an.");
100  view->setLabelClose("[ Schliessen ]");
101  view->repaint();
102 
103  win_stack.push_back(view);
104  input(0);
105 }
106 
107 void show_invalid_dac_input(int)
108 {
109  ViewInfo* view = new ViewInfo();
110  view->setTitle("Falsche Eingabe");
111  view->setText("Bitte geben Sie einen Wert aus dem Intervall [0, 1023] an.");
112  view->setLabelClose("[ Schliessen ]");
113  view->repaint();
114 
115  win_stack.push_back(view);
116  input(0);
117 }
118 
119 void write_digital_output0(int)
120 {
121  try
122  {
123  int d = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput(), 0, 16);
124  if(d > 255 || 0 > d)
125  throw std::invalid_argument("bad value");
126  uint8_t port = static_cast<uint8_t>(d);
127 
128  B15F& drv = B15F::getInstance();
129  drv.digitalWrite0(port);
130  view_back(0);
131  }
132  catch(std::invalid_argument& ex)
133  {
134  show_invalid_port_input(0);
135  }
136 }
137 
138 void write_digital_output1(int)
139 {
140  try
141  {
142  int d = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput(), 0, 16);
143  if(d > 255 || 0 > d)
144  throw std::invalid_argument("bad value");
145  uint8_t port = static_cast<uint8_t>(d);
146 
147  B15F& drv = B15F::getInstance();
148  drv.digitalWrite1(port);
149  view_back(0);
150  }
151  catch(std::invalid_argument& ex)
152  {
153  show_invalid_port_input(0);
154  }
155 }
156 
157 void write_analog_output0(int)
158 {
159  try
160  {
161  uint16_t port = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput());
162  if(port > 1023)
163  throw std::invalid_argument("bad value");
164 
165  B15F& drv = B15F::getInstance();
166  drv.analogWrite0(port);
167  view_back(0);
168  }
169  catch(std::invalid_argument& ex)
170  {
171  show_invalid_dac_input(0);
172  }
173 }
174 
175 void write_analog_output1(int)
176 {
177  try
178  {
179  uint16_t port = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput());
180  if(port > 1023)
181  throw std::invalid_argument("bad value");
182 
183  B15F& drv = B15F::getInstance();
184  drv.analogWrite1(port);
185  view_back(0);
186  }
187  catch(std::invalid_argument& ex)
188  {
189  show_invalid_dac_input(0);
190  }
191 }
192 
193 void show_digital_output0(int)
194 {
195  ViewPromt* view = new ViewPromt();
196  view->setTitle("Digitale Ausgabe BE0");
197  view->setMessage("\nAusgabe Port-Wert (hex): 0x");
198  view->setCancel("[ Zurueck ]", true);
199  view->setConfirm("[ OK ]", &write_digital_output0);
200  view->repaint();
201 
202  win_stack.push_back(view);
203  input(0);
204 }
205 
206 void show_digital_output1(int)
207 {
208  ViewPromt* view = new ViewPromt();
209  view->setTitle("Digitale Ausgabe BE1");
210  view->setMessage("\nAusgabe Port-Wert (hex): 0x");
211  view->setCancel("[ Zurueck ]", true);
212  view->setConfirm("[ OK ]", &write_digital_output1);
213  view->repaint();
214 
215  win_stack.push_back(view);
216  input(0);
217 }
218 
219 void show_analog_output0(int)
220 {
221  ViewPromt* view = new ViewPromt();
222  view->setTitle("Analoge Ausgabe AA0");
223  view->setMessage("\nAusgabe 10-Bit-Wert (0...1023): ");
224  view->setCancel("[ Zurueck ]", true);
225  view->setConfirm("[ OK ]", &write_analog_output0);
226  view->repaint();
227 
228  win_stack.push_back(view);
229  input(0);
230 }
231 
232 void show_analog_output1(int)
233 {
234  ViewPromt* view = new ViewPromt();
235  view->setTitle("Analoge Ausgabe AA1");
236  view->setMessage("\nAusgabe 10-Bit-Wert (0...1023): ");
237  view->setCancel("[ Zurueck ]", true);
238  view->setConfirm("[ OK ]", &write_analog_output1);
239  view->repaint();
240 
241  win_stack.push_back(view);
242  input(0);
243 }
244 
245 void start_selftest(int)
246 {
247  B15F& drv = B15F::getInstance();
248  drv.activateSelfTestMode();
249 
250  ViewInfo* view = new ViewInfo();
251  view->setTitle("Selbsttest aktiv");
252  view->setText("Das B15 befindet sich jetzt im Selbsttestmodus.\n \nSelbsttest:\nZu Beginn geht der Reihe nach jede LED von BA0 bis BA1 an.\nDanach leuchten die LEDs an AA0 und AA1 kurz auf.\nZum Schluss spiegelt in einer Endlosschleife:\n* BA0 Port BE0\n* BA1 die DIP-Schalter S7\n* AA0 ADC0\n* AA1 ADC1");
253  view->setLabelClose("[ Selbsttest Beenden ]");
254  view->setCall(&stop_selftest);
255  view->repaint();
256 
257  win_stack.push_back(view);
258  input(0);
259 }
260 
261 void stop_selftest(int)
262 {
263  B15F& drv = B15F::getInstance();
264  drv.discard();
266  drv.reconnect();
267  drv.digitalWrite0(0);
268  drv.digitalWrite1(0);
269 }
270 
271 void show_selftest_info(int)
272 {
273  ViewInfo* view = new ViewInfo();
274  view->setTitle("Selbsttest");
275  view->setText("Bitte entfernen Sie jetzt alle Draehte von den Anschlussklemmen und bestaetigen\nmit Enter.");
276  view->setLabelClose("[ Weiter ]");
277  view->setCall(&start_selftest);
278  view->repaint();
279 
280  win_stack.push_back(view);
281  input(0);
282 }
-
void delay_ms(uint16_t ms)
Definition: b15f.cpp:363
-
static B15F & getInstance(void)
Definition: b15f.cpp:373
+
void delay_ms(uint16_t ms)
Definition: b15f.cpp:420
+
static B15F & getInstance(void)
Definition: b15f.cpp:430
Definition: b15f.h:26
-
bool digitalWrite0(uint8_t)
Definition: b15f.cpp:153
-
bool activateSelfTestMode(void)
Definition: b15f.cpp:145
+
bool digitalWrite0(uint8_t)
Definition: b15f.cpp:180
+
bool activateSelfTestMode(void)
Definition: b15f.cpp:167
-
bool analogWrite1(uint16_t port)
Definition: b15f.cpp:210
+
bool analogWrite1(uint16_t port)
Definition: b15f.cpp:265
-
bool digitalWrite1(uint8_t)
Definition: b15f.cpp:163
+
bool digitalWrite1(uint8_t)
Definition: b15f.cpp:194
void discard(void)
Definition: b15f.cpp:72
constexpr static uint16_t WDT_TIMEOUT
Time in ms after which the watch dog timer resets the MCU.
Definition: b15f.h:235
void reconnect(void)
Definition: b15f.cpp:57
-
bool analogWrite0(uint16_t port)
Definition: b15f.cpp:200
+
bool analogWrite0(uint16_t port)
Definition: b15f.cpp:250
diff --git a/docs/html/ui_8h_source.html b/docs/html/ui_8h_source.html index a53a18d..832cfbe 100644 --- a/docs/html/ui_8h_source.html +++ b/docs/html/ui_8h_source.html @@ -73,7 +73,7 @@ $(function() {
1 #ifndef UI_H
2 #define UI_H
3 
4 #include <vector>
5 #include "view_selection.h"
6 #include "view_info.h"
7 #include "view_monitor.h"
8 #include "view_promt.h"
9 
10 void show_main(int);
11 void input(int);
12 void view_back(int);
13 void finish(int);
14 void cleanup();
15 
16 void show_info(int);
17 void show_monitor(int);
18 void show_invalid_port_input(int);
19 void show_invalid_dac_input(int);
20 void write_digital_output0(int);
21 void write_digital_output1(int);
22 void write_analog_output0(int);
23 void write_analog_output1(int);
24 void show_digital_output0(int);
25 void show_digital_output1(int);
26 void show_analog_output0(int);
27 void show_analog_output1(int);
28 
29 // selftest group
30 void show_selftest_info(int);
31 void start_selftest(int);
32 void stop_selftest(int);
33 
34 
35 extern std::vector<View*> win_stack;
36 extern std::thread t_refresh;
37 
38 #endif // UI_H
diff --git a/docs/html/usart_8cpp_source.html b/docs/html/usart_8cpp_source.html index a28c9ac..b8f3416 100644 --- a/docs/html/usart_8cpp_source.html +++ b/docs/html/usart_8cpp_source.html @@ -72,7 +72,7 @@ $(function() {
1 #include "usart.h"
2 
4 {
5  closeDevice();
6 }
7 
8 void USART::openDevice(std::string device)
9 {
10  // Benutze blockierenden Modus
11  file_desc = open(device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
12  if (file_desc <= 0)
13  throw USARTException("Fehler beim Öffnen des Gerätes");
14 
15  struct termios options;
16  int code = tcgetattr(file_desc, &options);
17  if (code)
18  throw USARTException("Fehler beim Lesen der Geräteparameter");
19 
20  options.c_cflag = CS8 | CLOCAL | CREAD;
21  options.c_iflag = IGNPAR;
22  options.c_oflag = 0;
23  options.c_lflag = 0;
24  options.c_cc[VMIN] = 0; // #bytes read returns at least
25  options.c_cc[VTIME] = timeout;
26  code = cfsetspeed(&options, baudrate);
27  if (code)
28  throw USARTException("Fehler beim Setzen der Baudrate");
29 
30  code = tcsetattr(file_desc, TCSANOW, &options);
31  if (code)
32  throw USARTException("Fehler beim Setzen der Geräteparameter");
33 
36 }
37 
39 {
40  if (file_desc > 0)
41  {
42  int code = close(file_desc);
43  if (code)
44  throw USARTException("Fehler beim Schließen des Gerätes");
45  file_desc = -1;
46  }
47 }
48 
50 {
51  int code = tcflush(file_desc, TCIFLUSH);
52  if (code)
53  throw USARTException("Fehler beim Leeren des Eingangspuffers");
54 }
55 
57 {
58  int code = tcflush(file_desc, TCOFLUSH);
59  if (code)
60  throw USARTException("Fehler beim Leeren des Ausgangspuffers");
61 }
62 
64 {
65  int code = tcdrain(file_desc);
66  if (code)
67  throw USARTException("Fehler beim Versenden des Ausgangspuffers");
68 }
69 
70 void USART::receive(uint8_t *buffer, uint16_t offset, uint8_t len)
71 {
72  int n = read(file_desc, buffer + offset, len);
73  if (n != len)
74  throw USARTException(
75  std::string(__FUNCTION__) + " failed: " + std::string(__FILE__) + "#" + std::to_string(__LINE__));
76 }
77 
78 void USART::transmit(uint8_t *buffer, uint16_t offset, uint8_t len)
79 {
80  int n = write(file_desc, buffer + offset, len);
81  if (n != len)
82  throw USARTException(
83  std::string(__FUNCTION__) + " failed: " + std::string(__FILE__) + "#" + std::to_string(__LINE__));
84 }
85 
87 {
88  return baudrate;
89 }
90 
92 {
93  return timeout;
94 }
95 
96 void USART::setBaudrate(uint32_t baudrate)
97 {
98  this->baudrate = baudrate;
99 }
100 
101 void USART::setTimeout(uint8_t timeout)
102 {
103  this->timeout = timeout;
104 }
uint32_t getBaudrate(void)
Definition: usart.cpp:86
- +
void closeDevice(void)
Definition: usart.cpp:38
void transmit(uint8_t *buffer, uint16_t offset, uint8_t len)
Definition: usart.cpp:78
void receive(uint8_t *buffer, uint16_t offset, uint8_t len)
Definition: usart.cpp:70
@@ -86,7 +86,7 @@ $(function() {
void flushOutputBuffer(void)
Definition: usart.cpp:63
diff --git a/docs/html/usart_8h_source.html b/docs/html/usart_8h_source.html index a76b9f0..e14235e 100644 --- a/docs/html/usart_8h_source.html +++ b/docs/html/usart_8h_source.html @@ -87,7 +87,7 @@ $(function() {
void flushOutputBuffer(void)
Definition: usart.cpp:63
diff --git a/docs/html/usartexception_8h_source.html b/docs/html/usartexception_8h_source.html index 5c34d82..f6ea1e0 100644 --- a/docs/html/usartexception_8h_source.html +++ b/docs/html/usartexception_8h_source.html @@ -70,16 +70,16 @@ $(function() {
usartexception.h
-
1 #ifndef USARTEXCEPTION_H
2 #define USARTEXCEPTION_H
3 
4 #include <exception>
5 #include <string>
6 
7 // SOURCE: https://stackoverflow.com/a/8152888
8 
11 class USARTException: public std::exception
12 {
13 public:
18  explicit USARTException(const char* message) : msg(message)
19  {
20  }
21 
26  explicit USARTException(const std::string& message) : msg(message)
27  {
28  }
29 
33  virtual ~USARTException() = default;
34 
39  virtual const char* what() const throw ()
40  {
41  return msg.c_str();
42  }
43 
44 protected:
45  std::string msg;
46 };
47 
48 #endif // USARTEXCEPTION_H
-
USARTException(const char *message)
- -
virtual const char * what() const
-
std::string msg
failure description
-
USARTException(const std::string &message)
+
1 #ifndef USARTEXCEPTION_H
2 #define USARTEXCEPTION_H
3 
4 #include <exception>
5 #include <string>
6 
9 class USARTException: public std::exception
10 {
11 public:
16  explicit USARTException(const char* message) : msg(message)
17  {
18  }
19 
24  explicit USARTException(const std::string& message) : msg(message)
25  {
26  }
27 
31  virtual ~USARTException() = default;
32 
37  virtual const char* what() const throw ()
38  {
39  return msg.c_str();
40  }
41 
42 protected:
43  std::string msg;
44 };
45 
46 #endif // USARTEXCEPTION_H
+
USARTException(const char *message)
+ +
virtual const char * what() const
+
std::string msg
failure description
+
USARTException(const std::string &message)
virtual ~USARTException()=default
diff --git a/docs/html/view_8cpp_source.html b/docs/html/view_8cpp_source.html index 02e2fa7..9c20ba1 100644 --- a/docs/html/view_8cpp_source.html +++ b/docs/html/view_8cpp_source.html @@ -71,10 +71,10 @@ $(function() {
1 #include "view.h"
2 
3 WINDOW* View::win = nullptr;
4 
5 View::View()
6 {
7  if(!win)
8  {
9  B15F::abort("View::win not initialized, missing context");
10  }
11  getmaxyx(win, height, width); // init width and height
12  keypad(win, TRUE);
13 }
14 
15 View::~View()
16 {
17 }
18 
19 void View::setWinContext(WINDOW* win)
20 {
21  View::win = win;
22 }
23 
24 WINDOW* View::getWinContext()
25 {
26  return win;
27 }
28 
29 // from: https://stackoverflow.com/a/37454181
30 std::vector<std::string> View::str_split(const std::string& str, const std::string delim)
31 {
32  std::vector<std::string> tokens;
33  size_t prev = 0, pos = 0;
34  do
35  {
36  pos = str.find(delim, prev);
37  if (pos == std::string::npos) pos = str.length();
38  std::string token = str.substr(prev, pos-prev);
39  if (!token.empty()) tokens.push_back(token);
40  prev = pos + delim.length();
41  }
42  while (pos < str.length() && prev < str.length());
43  return tokens;
44 }
45 
46 
47 void View::setTitle(std::string title)
48 {
49  this->title = title;
50 }
51 
52 void View::repaint()
53 {
54  // get screen size
55  struct winsize size;
56  if (ioctl(0, TIOCGWINSZ, (char *) &size) < 0)
57  throw std::runtime_error("TIOCGWINSZ error");
58 
59 
60  start_x = floor((size.ws_col - width) / 2.);
61  start_y = floor((size.ws_row - height) / 2.);
62 
63  curs_set(0); // hide cursor
64  mvwin(win, start_y, start_x);
65  clear();
66  wclear(win);
67 
68  // generic draw
69  box(win, 0, 0);
70  int offset_x = (width - title.length()) / 2;
71  mvwprintw(win, 1, offset_x, "%s", title.c_str());
72 
73  // specific draw
74  draw();
75 
76  refresh();
77  wrefresh(win);
78 }
-
static void abort(std::string msg)
Definition: b15f.cpp:398
+
static void abort(std::string msg)
Definition: b15f.cpp:455
diff --git a/docs/html/view_8h_source.html b/docs/html/view_8h_source.html index 1673a6f..c435614 100644 --- a/docs/html/view_8h_source.html +++ b/docs/html/view_8h_source.html @@ -74,7 +74,7 @@ $(function() {
Definition: view.h:19
diff --git a/docs/html/view__info_8cpp_source.html b/docs/html/view__info_8cpp_source.html index 40c553d..2a83349 100644 --- a/docs/html/view__info_8cpp_source.html +++ b/docs/html/view__info_8cpp_source.html @@ -73,7 +73,7 @@ $(function() {
1 #include "view_info.h"
2 
3 ViewInfo::ViewInfo()
4 {
5  calls.push_back(nullptr);
6 }
7 
8 void ViewInfo::setText(std::string text)
9 {
10  this->text = text;
11 }
12 
13 void ViewInfo::setLabelClose(std::string label)
14 {
15  this->label_close = label;
16 }
17 
18 void ViewInfo::setCall(call_t call)
19 {
20  calls[0] = call;
21 }
22 
23 void ViewInfo::draw()
24 {
25  int li = 0;
26  for(std::string line : str_split(text, "\n"))
27  mvwprintw(win, text_offset_y + li++, text_offset_x, "%s", line.c_str());
28 
29  close_offset_x = (width - label_close.length()) / 2;
30  close_offset_y = height - 2;
31 
32  wattron(win, A_REVERSE);
33  mvwprintw(win, close_offset_y, close_offset_x, "%s", label_close.c_str());
34  wattroff(win, A_REVERSE);
35 }
36 
37 call_t ViewInfo::keypress(int& key)
38 {
39  switch(key)
40  {
41 
42  case KEY_MOUSE:
43  {
44  // http://pronix.linuxdelta.de/C/Linuxprogrammierung/Linuxsystemprogrammieren_C_Kurs_Kapitel10b.shtml
45  MEVENT event;
46  if(getmouse(&event) == OK && event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
47  {
48  size_t column = start_x + close_offset_x;
49  size_t row = start_y + close_offset_y;
50  size_t mouse_x = event.x, mouse_y = event.y;
51  if(mouse_y == row && mouse_x >= column && mouse_x < column + label_close.length())
52  key = -1; // do return from view
53  }
54  break;
55  }
56  case KEY_ENT:
57  key = -1; // do return from view
58  break;
59  default:
60  break;
61  }
62  return calls[0];
63 }
diff --git a/docs/html/view__info_8h_source.html b/docs/html/view__info_8h_source.html index 8271dec..22fae9d 100644 --- a/docs/html/view__info_8h_source.html +++ b/docs/html/view__info_8h_source.html @@ -75,7 +75,7 @@ $(function() {
Definition: view.h:19
diff --git a/docs/html/view__monitor_8cpp_source.html b/docs/html/view__monitor_8cpp_source.html index 5365229..3988fa5 100644 --- a/docs/html/view__monitor_8cpp_source.html +++ b/docs/html/view__monitor_8cpp_source.html @@ -72,19 +72,19 @@ $(function() {
1 #include "view_monitor.h"
2 
3 ViewMonitor::ViewMonitor() : t_worker(&ViewMonitor::worker, this)
4 {
5 }
6 
7 call_t ViewMonitor::keypress(int& key)
8 {
9  switch(key)
10  {
11 
12  case KEY_MOUSE:
13  {
14  // http://pronix.linuxdelta.de/C/Linuxprogrammierung/Linuxsystemprogrammieren_C_Kurs_Kapitel10b.shtml
15  MEVENT event;
16  bool hit = false;
17  if(getmouse(&event) == OK && event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
18  {
19  size_t column = start_x + close_offset_x;
20  size_t row = start_y + close_offset_y;
21  size_t mouse_x = event.x, mouse_y = event.y;
22  if(mouse_y == row && mouse_x >= column && mouse_x < column + label_close.length())
23  hit = true;
24  }
25  if(!hit)
26  break;
27 
28  // fall through to next case
29  [[fallthrough]];
30  }
31  case KEY_ENT:
32  run_worker = false;
33  key = -1; // do return from view
34  wclear(win);
35  wrefresh(win);
36  t_worker.join();
37  break;
38  default:
39  break;
40  }
41  return calls[0];
42 }
43 
44 std::string ViewMonitor::fancyDigitalString(uint8_t& b)
45 {
46  std::stringstream str;
47  str << std::bitset<8>(b).to_string();
48  str << " ";
49  str << "0x" << std::setfill ('0') << std::setw(2) << std::hex << (int) b << std::dec;
50  return str.str();
51 }
52 
53 std::string ViewMonitor::fancyAnalogString(uint16_t& v)
54 {
55  std::stringstream str;
56  double volt = round(v * 100.0 * 5.0 / 1023.0) / 100.0;
57 
58  str << std::setfill ('0') << std::setw(4) << (int) v << " " << std::fixed << std::setprecision(2) << volt << " V ";
59 
60  str << "[";
61  uint8_t p = round(v * 40.0 / 1023.0);
62  for(uint8_t i = 0; i < p; i++)
63  str << "X";
64  for(uint8_t i = 0; i < 40 - p; i++)
65  str << " ";
66  str << "]" << std::endl;
67 
68  return str.str();
69 }
70 
71 void ViewMonitor::worker()
72 {
73  B15F& drv = B15F::getInstance();
74  while(run_worker)
75  {
76  try
77  {
78  std::this_thread::sleep_for(std::chrono::milliseconds(100));
79 
80  uint8_t be0 = drv.digitalRead0();
81  uint8_t be1 = drv.digitalRead1();
82  uint8_t dsw = drv.readDipSwitch();
83  uint16_t adc[8];
84  for(uint8_t i = 0; i < sizeof(adc) / sizeof(adc[0]); i++)
85  adc[i] = drv.analogRead(i);
86 
87 
88  std::stringstream str;
89 
90  // hline
91  for(uint8_t i = 0; i < width - 2 * text_offset_x; i++)
92  if(i % 2 == 0)
93  str << "-";
94  else
95  str << " ";
96  str << std::endl;
97 
98  str << "Digitale Enigaenge:" << std::endl;
99  str << "Binaere Eingabe 0: " << fancyDigitalString(be0) << std::endl;
100  str << "Binaere Eingabe 1: " << fancyDigitalString(be1) << std::endl;
101  str << "Dip Schalter (S7): " << fancyDigitalString(dsw) << std::endl;
102 
103  // hline
104  for(uint8_t i = 0; i < width - 2 * text_offset_x; i++)
105  if(i % 2 == 0)
106  str << "-";
107  else
108  str << " ";
109  str << std::endl;
110 
111  str << "Analoge Eingaenge:" << std::endl;
112  for(uint8_t i = 0; i < sizeof(adc) / sizeof(adc[0]); i++)
113  {
114  str << "Kanal " << std::to_string((int) i) << ": ";
115  str << fancyAnalogString(adc[i]) << std::endl;
116  }
117 
118  text = str.str();
119  repaint();
120  }
121  catch(DriverException& ex)
122  {
123  std::cout << "DriverException: " << ex.what() << std::endl;
124  drv.delay_ms(1000);
125  }
126  catch(...)
127  {
128  try
129  {
130  drv.reconnect();
131  }
132  catch(...)
133  {
134  B15F::abort("yoho meine dudes");
135  return;
136  }
137  }
138  }
139 }
-
uint8_t digitalRead0(void)
Definition: b15f.cpp:173
-
uint8_t readDipSwitch(void)
Definition: b15f.cpp:191
-
void delay_ms(uint16_t ms)
Definition: b15f.cpp:363
-
static B15F & getInstance(void)
Definition: b15f.cpp:373
+
uint8_t digitalRead0(void)
Definition: b15f.cpp:208
+
uint8_t readDipSwitch(void)
Definition: b15f.cpp:236
+
void delay_ms(uint16_t ms)
Definition: b15f.cpp:420
+
static B15F & getInstance(void)
Definition: b15f.cpp:430
Definition: b15f.h:26
-
static void abort(std::string msg)
Definition: b15f.cpp:398
-
uint16_t analogRead(uint8_t channel)
Definition: b15f.cpp:220
-
uint8_t digitalRead1(void)
Definition: b15f.cpp:182
+
static void abort(std::string msg)
Definition: b15f.cpp:455
+
uint16_t analogRead(uint8_t channel)
Definition: b15f.cpp:280
+
uint8_t digitalRead1(void)
Definition: b15f.cpp:222
void reconnect(void)
Definition: b15f.cpp:57
diff --git a/docs/html/view__monitor_8h_source.html b/docs/html/view__monitor_8h_source.html index 339bb08..5908596 100644 --- a/docs/html/view__monitor_8h_source.html +++ b/docs/html/view__monitor_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/html/view__promt_8cpp_source.html b/docs/html/view__promt_8cpp_source.html index 30ebc5d..c02be54 100644 --- a/docs/html/view__promt_8cpp_source.html +++ b/docs/html/view__promt_8cpp_source.html @@ -73,7 +73,7 @@ $(function() {
1 #include "view_promt.h"
2 
3 void ViewPromt::draw()
4 {
5  curs_set(1); // show cursor
6 
7  int li = text_offset_y;
8  int ci = 0;
9  for(std::string line : str_split(message + input, "\n"))
10  {
11  mvwprintw(win, ++li, text_offset_x, "%s", line.c_str());
12  ci = line.length() + text_offset_x;
13  }
14 
15  button_offset_x = (width - label_cancel.length() - sep.length() - label_confirm.length()) / 2;
16  button_offset_y = height - text_offset_y;
17 
18  if(selection == 0)
19  {
20  wattron(win, A_REVERSE);
21  mvwprintw(win, button_offset_y, button_offset_x, "%s", label_cancel.c_str());
22  wattroff(win, A_REVERSE);
23  mvwprintw(win, button_offset_y, button_offset_x + label_cancel.length(), "%s", sep.c_str());
24  mvwprintw(win, button_offset_y, button_offset_x + label_cancel.length() + sep.length(), "%s", label_confirm.c_str());
25  }
26  else
27  {
28  mvwprintw(win, button_offset_y, button_offset_x, "%s", label_cancel.c_str());
29  mvwprintw(win, button_offset_y, button_offset_x + label_cancel.length(), "%s", sep.c_str());
30  wattron(win, A_REVERSE);
31  mvwprintw(win, button_offset_y, button_offset_x + label_cancel.length() + sep.length(), "%s", label_confirm.c_str());
32  wattroff(win, A_REVERSE);
33  }
34  wmove(win, li, ci);
35 }
36 
37 void ViewPromt::setMessage(std::string message)
38 {
39  this->message = message;
40 }
41 
42 void ViewPromt::setConfirm(std::string name, std::function<void(int)> call)
43 {
44  label_confirm = name;
45  call_confirm = call;
46 }
47 
48 void ViewPromt::setCancel(std::string name, bool cancelable)
49 {
50  label_cancel = name;
51  this->cancelable = cancelable;
52 }
53 
54 std::string ViewPromt::getInput()
55 {
56  return input;
57 }
58 
59 std::function<void(int)> ViewPromt::keypress(int& key)
60 {
61  std::function<void(int)> ret = nullptr;
62  switch(key)
63  {
64  case KEY_BACKSPACE:
65  if(input.length())
66  input.pop_back();
67  break;
68  case '\t':
69  case KEY_LEFT:
70  case KEY_RIGHT:
71  selection = (selection + 1 ) % 2;
72  break;
73  case KEY_MOUSE:
74  {
75  // http://pronix.linuxdelta.de/C/Linuxprogrammierung/Linuxsystemprogrammieren_C_Kurs_Kapitel10b.shtml
76  MEVENT event;
77  bool hit = false;
78  if(getmouse(&event) == OK && event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
79  {
80  size_t column_start = start_x + button_offset_x;
81  size_t row_start = start_y + button_offset_y;
82  size_t mouse_x = event.x, mouse_y = event.y;
83  if(mouse_y == row_start)
84  {
85  if(cancelable && mouse_x >= column_start && mouse_x < column_start + label_cancel.length())
86  {
87  if(selection == 0 || event.bstate & BUTTON1_DOUBLE_CLICKED)
88  hit = true;
89  selection = 0;
90  }
91  if(mouse_x >= column_start + label_cancel.length() + sep.length() && mouse_x < column_start + label_cancel.length() + sep.length() + label_confirm.length())
92  {
93  if(selection == 1 || event.bstate & BUTTON1_DOUBLE_CLICKED)
94  hit = true;
95  selection = 1;
96  }
97  }
98  }
99  if(!hit)
100  break;
101 
102  // fall through to next case
103  [[fallthrough]];
104  }
105  case KEY_ENT:
106  if(selection == 0) // exit
107  key = -1; // do return from view
108  else
109  ret = call_confirm;
110  break;
111  default:
112  break;
113  }
114 
115  if(key >= ' ' && key <= '~')
116  input += (char) key;
117 
118  if(key != KEY_ENT)
119  repaint();
120  return ret;
121 }
diff --git a/docs/html/view__promt_8h_source.html b/docs/html/view__promt_8h_source.html index 407553e..5ac13df 100644 --- a/docs/html/view__promt_8h_source.html +++ b/docs/html/view__promt_8h_source.html @@ -75,7 +75,7 @@ $(function() { diff --git a/docs/html/view__selection_8cpp_source.html b/docs/html/view__selection_8cpp_source.html index 0631ccf..96c404a 100644 --- a/docs/html/view__selection_8cpp_source.html +++ b/docs/html/view__selection_8cpp_source.html @@ -73,7 +73,7 @@ $(function() {
1 #include "view_selection.h"
2 
3 void ViewSelection::draw()
4 {
5  //curs_set(0); // hide cursor
6  for(size_t i = 0; i < choices.size(); i++)
7  {
8  if(selection == i)
9  wattron(win, A_REVERSE);
10  mvwprintw(win, i + choice_offset_y, choice_offset_x, "%s", choices[i].c_str());
11  if(selection == i)
12  wattroff(win, A_REVERSE);
13  }
14 }
15 
16 void ViewSelection::addChoice(std::string name, call_t call)
17 {
18  choices.push_back(name);
19  calls.push_back(call);
20 }
21 
22 call_t ViewSelection::keypress(int& key)
23 {
24  call_t ret = nullptr;
25  switch(key)
26  {
27  case KEY_UP:
28  do
29  selection = (selection - 1 + choices.size()) % choices.size();
30  while(!choices[selection].length() && choices.size());
31  break;
32 
33  case '\t':
34  case KEY_DOWN:
35  do
36  selection = (selection + 1) % choices.size();
37  while(!choices[selection].length() && choices.size());
38  break;
39 
40  case KEY_MOUSE:
41  {
42  // http://pronix.linuxdelta.de/C/Linuxprogrammierung/Linuxsystemprogrammieren_C_Kurs_Kapitel10b.shtml
43  MEVENT event;
44  bool hit = false;
45  if(getmouse(&event) == OK && event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
46  {
47  size_t column_start = start_x + choice_offset_x;
48  size_t row_start = start_y + choice_offset_y;
49  size_t mouse_x = event.x, mouse_y = event.y;
50  for(size_t i = 0; i < choices.size(); i++)
51  if(choices[i].length() && mouse_y == row_start + i && mouse_x >= column_start && mouse_x < column_start + choices[i].length())
52  {
53  if(selection == i || event.bstate & BUTTON1_DOUBLE_CLICKED)
54  hit = true;
55  selection = i;
56  }
57  }
58  if(!hit)
59  break;
60 
61  // fall through to next case
62  [[fallthrough]];
63  }
64 
65  case KEY_ENT:
66  if(selection == choices.size() - 1) // exit
67  key = -1; // do return from view
68  else
69  ret = calls[selection];
70  break;
71  default:
72  break;
73  }
74  repaint();
75  return ret;
76 }
diff --git a/docs/html/view__selection_8h_source.html b/docs/html/view__selection_8h_source.html index bad2520..c091b4d 100644 --- a/docs/html/view__selection_8h_source.html +++ b/docs/html/view__selection_8h_source.html @@ -75,7 +75,7 @@ $(function() {