diff --git a/control/bin/b15fcli b/control/bin/b15fcli
new file mode 100755
index 0000000..65fe678
Binary files /dev/null and b/control/bin/b15fcli differ
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 @@
-
-
-
+
@@ -31,7 +29,7 @@
-
+
@@ -40,7 +38,7 @@
-
+
@@ -52,8 +50,8 @@
-
-
+
+
@@ -61,17 +59,8 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -79,17 +68,17 @@
-
-
+
+
-
+
-
-
+
+
@@ -115,11 +104,11 @@
-
+
@@ -202,12 +191,12 @@
1559118962147
-
+
-
+
@@ -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() {
2 # error "A C++ compiler has been selected for C." 8 #if defined(__CLASSIC_C__) 18 #if defined(__INTEL_COMPILER) || defined(__ICC) 19 # define COMPILER_ID "Intel" 20 # if defined(_MSC_VER) 21 # define SIMULATE_ID "MSVC" 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) 29 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) 31 # if defined(__INTEL_COMPILER_BUILD_DATE) 33 # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) 35 # if defined(_MSC_VER) 37 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 38 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 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__) 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) 55 #elif defined(__BORLANDC__) 56 # define COMPILER_ID "Borland" 58 # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) 59 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) 61 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200 62 # define COMPILER_ID "Watcom" 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) 70 #elif defined(__WATCOMC__) 71 # define COMPILER_ID "OpenWatcom" 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) 79 #elif defined(__SUNPRO_C) 80 # define COMPILER_ID "SunPro" 81 # if __SUNPRO_C >= 0x5100 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) 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) 93 #elif defined(__HP_cc) 94 # define COMPILER_ID "HP" 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) 100 #elif defined(__DECC) 101 # define COMPILER_ID "Compaq" 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) 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__) 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) 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__) 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) 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__) 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) 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__) 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) 165 #elif defined(__TI_COMPILER_VERSION__) 166 # define COMPILER_ID "TI" 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) 172 #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) 173 # define COMPILER_ID "Fujitsu" 175 #elif defined(__ghs__) 176 # define COMPILER_ID "GHS" 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) 184 #elif defined(__TINYC__) 185 # define COMPILER_ID "TinyCC" 187 #elif defined(__BCC__) 188 # define COMPILER_ID "Bruce" 190 #elif defined(__SCO_VERSION__) 191 # define COMPILER_ID "SCO" 193 #elif defined(__ARMCC_VERSION) && !defined(__clang__) 194 # define COMPILER_ID "ARMCC" 195 #if __ARMCC_VERSION >= 1000000 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) 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) 208 #elif defined(__clang__) && defined(__apple_build_version__) 209 # define COMPILER_ID "AppleClang" 210 # if defined(_MSC_VER) 211 # define SIMULATE_ID "MSVC" 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) 218 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 219 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 221 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) 223 #elif defined(__clang__) 224 # define COMPILER_ID "Clang" 225 # if defined(_MSC_VER) 226 # define SIMULATE_ID "MSVC" 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) 233 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 234 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 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__) 243 # if defined(__GNUC_PATCHLEVEL__) 244 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 247 #elif defined(_MSC_VER) 248 # define COMPILER_ID "MSVC" 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 255 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) 258 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) 261 # if defined(_MSC_BUILD) 262 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) 265 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) 266 # define COMPILER_ID "ADSP" 267 #if defined(__VISUALDSPVERSION__) 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) 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__) 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) 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) 301 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) 302 # define COMPILER_ID "MIPSpro" 303 # if defined(_SGI_COMPILER_VERSION) 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) 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) 319 #elif defined(__hpux) || defined(__hpua) 320 # define COMPILER_ID "HP" 323 # define COMPILER_ID "" 330 char const * info_compiler =
"INFO" ":" "compiler[" COMPILER_ID
"]" ;
332 char const * info_simulate =
"INFO" ":" "simulate[" SIMULATE_ID
"]" ;
336 char const * qnxnto =
"INFO" ":" "qnxnto[]" ;
339 #if defined(__CRAYXE) || defined(__CRAYXC) 340 char const *info_cray =
"INFO" ":" "compiler_wrapper[CrayPrgEnv]" ;
343 #define STRINGIFY_HELPER(X) #X 344 #define STRINGIFY(X) STRINGIFY_HELPER(X) 347 #if defined(__linux) || defined(__linux__) || defined(linux) 348 # define PLATFORM_ID "Linux" 350 #elif defined(__CYGWIN__) 351 # define PLATFORM_ID "Cygwin" 353 #elif defined(__MINGW32__) 354 # define PLATFORM_ID "MinGW" 356 #elif defined(__APPLE__) 357 # define PLATFORM_ID "Darwin" 359 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 360 # define PLATFORM_ID "Windows" 362 #elif defined(__FreeBSD__) || defined(__FreeBSD) 363 # define PLATFORM_ID "FreeBSD" 365 #elif defined(__NetBSD__) || defined(__NetBSD) 366 # define PLATFORM_ID "NetBSD" 368 #elif defined(__OpenBSD__) || defined(__OPENBSD) 369 # define PLATFORM_ID "OpenBSD" 371 #elif defined(__sun) || defined(sun) 372 # define PLATFORM_ID "SunOS" 374 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) 375 # define PLATFORM_ID "AIX" 377 #elif defined(__hpux) || defined(__hpux__) 378 # define PLATFORM_ID "HP-UX" 380 #elif defined(__HAIKU__) 381 # define PLATFORM_ID "Haiku" 383 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) 384 # define PLATFORM_ID "BeOS" 386 #elif defined(__QNX__) || defined(__QNXNTO__) 387 # define PLATFORM_ID "QNX" 389 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) 390 # define PLATFORM_ID "Tru64" 392 #elif defined(__riscos) || defined(__riscos__) 393 # define PLATFORM_ID "RISCos" 395 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) 396 # define PLATFORM_ID "SINIX" 398 #elif defined(__UNIX_SV__) 399 # define PLATFORM_ID "UNIX_SV" 401 #elif defined(__bsdos__) 402 # define PLATFORM_ID "BSDOS" 404 #elif defined(_MPRAS) || defined(MPRAS) 405 # define PLATFORM_ID "MP-RAS" 407 #elif defined(__osf) || defined(__osf__) 408 # define PLATFORM_ID "OSF1" 410 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) 411 # define PLATFORM_ID "SCO_SV" 413 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) 414 # define PLATFORM_ID "ULTRIX" 416 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) 417 # define PLATFORM_ID "Xenix" 419 #elif defined(__WATCOMC__) 420 # if defined(__LINUX__) 421 # define PLATFORM_ID "Linux" 423 # elif defined(__DOS__) 424 # define PLATFORM_ID "DOS" 426 # elif defined(__OS2__) 427 # define PLATFORM_ID "OS2" 429 # elif defined(__WINDOWS__) 430 # define PLATFORM_ID "Windows3x" 436 #elif defined(__INTEGRITY) 437 # if defined(INT_178B) 438 # define PLATFORM_ID "Integrity178" 441 # define PLATFORM_ID "Integrity" 454 #if defined(_WIN32) && defined(_MSC_VER) 455 # if defined(_M_IA64) 456 # define ARCHITECTURE_ID "IA64" 458 # elif defined(_M_X64) || defined(_M_AMD64) 459 # define ARCHITECTURE_ID "x64" 461 # elif defined(_M_IX86) 462 # define ARCHITECTURE_ID "X86" 464 # elif defined(_M_ARM64) 465 # define ARCHITECTURE_ID "ARM64" 467 # elif defined(_M_ARM) 469 # define ARCHITECTURE_ID "ARMV4I" 471 # define ARCHITECTURE_ID "ARMV5I" 473 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) 476 # elif defined(_M_MIPS) 477 # define ARCHITECTURE_ID "MIPS" 479 # elif defined(_M_SH) 480 # define ARCHITECTURE_ID "SHx" 483 # define ARCHITECTURE_ID "" 486 #elif defined(__WATCOMC__) 488 # define ARCHITECTURE_ID "I86" 490 # elif defined(_M_IX86) 491 # define ARCHITECTURE_ID "X86" 494 # define ARCHITECTURE_ID "" 497 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) 498 # if defined(__ICCARM__) 499 # define ARCHITECTURE_ID "ARM" 501 # elif defined(__ICCAVR__) 502 # define ARCHITECTURE_ID "AVR" 505 # define ARCHITECTURE_ID "" 508 #elif defined(__ghs__) 509 # if defined(__PPC64__) 510 # define ARCHITECTURE_ID "PPC64" 512 # elif defined(__ppc__) 513 # define ARCHITECTURE_ID "PPC" 515 # elif defined(__ARM__) 516 # define ARCHITECTURE_ID "ARM" 518 # elif defined(__x86_64__) 519 # define ARCHITECTURE_ID "x64" 521 # elif defined(__i386__) 522 # define ARCHITECTURE_ID "X86" 525 # define ARCHITECTURE_ID "" 528 # define ARCHITECTURE_ID 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)), \ 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)), \ 554 #ifdef COMPILER_VERSION_MAJOR 555 char const info_version[] =
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,
574 #ifdef COMPILER_VERSION_INTERNAL 575 char const info_version_internal[] =
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' 585 #ifdef SIMULATE_VERSION_MAJOR 586 char const info_simulate_version[] =
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,
608 char const * info_platform =
"INFO" ":" "platform[" PLATFORM_ID
"]" ;
609 char const * info_arch =
"INFO" ":" "arch[" ARCHITECTURE_ID
"]" ;
614 #if !defined(__STDC__) 615 # if (defined(_MSC_VER) && !defined(__clang__)) \ 616 || (defined(__ibmxl__) || defined(__IBMC__)) 617 # define C_DIALECT "90" 621 #elif __STDC_VERSION__ >= 201000L 622 # define C_DIALECT "11" 623 #elif __STDC_VERSION__ >= 199901L 624 # define C_DIALECT "99" 626 # define C_DIALECT "90" 628 const char * info_language_dialect_default =
629 "INFO" ":" "dialect_default[" C_DIALECT
"]" ;
636 # if defined(__CLASSIC_C__) 637 int main(argc, argv)
int argc;
640 int main(
int argc,
char * argv[])
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];
650 #ifdef COMPILER_VERSION_INTERNAL 651 require += info_version_internal[argc];
654 require += info_simulate[argc];
656 #ifdef SIMULATE_VERSION_MAJOR 657 require += info_simulate_version[argc];
659 #if defined(__CRAYXE) || defined(__CRAYXC) 660 require += info_cray[argc];
662 require += info_language_dialect_default[argc];
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() {
5 # error "A C compiler has been selected for C++." 13 # define COMPILER_ID "Comeau" 15 # define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) 16 # define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) 18 #elif defined(__INTEL_COMPILER) || defined(__ICC) 19 # define COMPILER_ID "Intel" 20 # if defined(_MSC_VER) 21 # define SIMULATE_ID "MSVC" 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) 29 # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) 31 # if defined(__INTEL_COMPILER_BUILD_DATE) 33 # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) 35 # if defined(_MSC_VER) 37 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 38 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 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__) 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) 55 #elif defined(__BORLANDC__) 56 # define COMPILER_ID "Borland" 58 # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) 59 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) 61 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200 62 # define COMPILER_ID "Watcom" 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) 70 #elif defined(__WATCOMC__) 71 # define COMPILER_ID "OpenWatcom" 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) 79 #elif defined(__SUNPRO_CC) 80 # define COMPILER_ID "SunPro" 81 # if __SUNPRO_CC >= 0x5100 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) 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) 93 #elif defined(__HP_aCC) 94 # define COMPILER_ID "HP" 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) 100 #elif defined(__DECCXX) 101 # define COMPILER_ID "Compaq" 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) 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__) 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) 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__) 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) 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__) 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) 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__) 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) 165 #elif defined(__TI_COMPILER_VERSION__) 166 # define COMPILER_ID "TI" 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) 172 #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) 173 # define COMPILER_ID "Fujitsu" 175 #elif defined(__ghs__) 176 # define COMPILER_ID "GHS" 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) 184 #elif defined(__SCO_VERSION__) 185 # define COMPILER_ID "SCO" 187 #elif defined(__ARMCC_VERSION) && !defined(__clang__) 188 # define COMPILER_ID "ARMCC" 189 #if __ARMCC_VERSION >= 1000000 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) 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) 202 #elif defined(__clang__) && defined(__apple_build_version__) 203 # define COMPILER_ID "AppleClang" 204 # if defined(_MSC_VER) 205 # define SIMULATE_ID "MSVC" 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) 212 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 213 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 215 # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) 217 #elif defined(__clang__) 218 # define COMPILER_ID "Clang" 219 # if defined(_MSC_VER) 220 # define SIMULATE_ID "MSVC" 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) 227 # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) 228 # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) 231 #elif defined(__GNUC__) || defined(__GNUG__) 232 # define COMPILER_ID "GNU" 233 # if defined(__GNUC__) 234 # define COMPILER_VERSION_MAJOR DEC(__GNUC__) 236 # define COMPILER_VERSION_MAJOR DEC(__GNUG__) 238 # if defined(__GNUC_MINOR__) 239 # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) 241 # if defined(__GNUC_PATCHLEVEL__) 242 # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) 245 #elif defined(_MSC_VER) 246 # define COMPILER_ID "MSVC" 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 253 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) 256 # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) 259 # if defined(_MSC_BUILD) 260 # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) 263 #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) 264 # define COMPILER_ID "ADSP" 265 #if defined(__VISUALDSPVERSION__) 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) 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__) 286 #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) 287 # define COMPILER_ID "MIPSpro" 288 # if defined(_SGI_COMPILER_VERSION) 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) 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) 304 #elif defined(__hpux) || defined(__hpua) 305 # define COMPILER_ID "HP" 308 # define COMPILER_ID "" 315 char const * info_compiler =
"INFO" ":" "compiler[" COMPILER_ID
"]" ;
317 char const * info_simulate =
"INFO" ":" "simulate[" SIMULATE_ID
"]" ;
321 char const * qnxnto =
"INFO" ":" "qnxnto[]" ;
324 #if defined(__CRAYXE) || defined(__CRAYXC) 325 char const *info_cray =
"INFO" ":" "compiler_wrapper[CrayPrgEnv]" ;
328 #define STRINGIFY_HELPER(X) #X 329 #define STRINGIFY(X) STRINGIFY_HELPER(X) 332 #if defined(__linux) || defined(__linux__) || defined(linux) 333 # define PLATFORM_ID "Linux" 335 #elif defined(__CYGWIN__) 336 # define PLATFORM_ID "Cygwin" 338 #elif defined(__MINGW32__) 339 # define PLATFORM_ID "MinGW" 341 #elif defined(__APPLE__) 342 # define PLATFORM_ID "Darwin" 344 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 345 # define PLATFORM_ID "Windows" 347 #elif defined(__FreeBSD__) || defined(__FreeBSD) 348 # define PLATFORM_ID "FreeBSD" 350 #elif defined(__NetBSD__) || defined(__NetBSD) 351 # define PLATFORM_ID "NetBSD" 353 #elif defined(__OpenBSD__) || defined(__OPENBSD) 354 # define PLATFORM_ID "OpenBSD" 356 #elif defined(__sun) || defined(sun) 357 # define PLATFORM_ID "SunOS" 359 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) 360 # define PLATFORM_ID "AIX" 362 #elif defined(__hpux) || defined(__hpux__) 363 # define PLATFORM_ID "HP-UX" 365 #elif defined(__HAIKU__) 366 # define PLATFORM_ID "Haiku" 368 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) 369 # define PLATFORM_ID "BeOS" 371 #elif defined(__QNX__) || defined(__QNXNTO__) 372 # define PLATFORM_ID "QNX" 374 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) 375 # define PLATFORM_ID "Tru64" 377 #elif defined(__riscos) || defined(__riscos__) 378 # define PLATFORM_ID "RISCos" 380 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) 381 # define PLATFORM_ID "SINIX" 383 #elif defined(__UNIX_SV__) 384 # define PLATFORM_ID "UNIX_SV" 386 #elif defined(__bsdos__) 387 # define PLATFORM_ID "BSDOS" 389 #elif defined(_MPRAS) || defined(MPRAS) 390 # define PLATFORM_ID "MP-RAS" 392 #elif defined(__osf) || defined(__osf__) 393 # define PLATFORM_ID "OSF1" 395 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) 396 # define PLATFORM_ID "SCO_SV" 398 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) 399 # define PLATFORM_ID "ULTRIX" 401 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) 402 # define PLATFORM_ID "Xenix" 404 #elif defined(__WATCOMC__) 405 # if defined(__LINUX__) 406 # define PLATFORM_ID "Linux" 408 # elif defined(__DOS__) 409 # define PLATFORM_ID "DOS" 411 # elif defined(__OS2__) 412 # define PLATFORM_ID "OS2" 414 # elif defined(__WINDOWS__) 415 # define PLATFORM_ID "Windows3x" 421 #elif defined(__INTEGRITY) 422 # if defined(INT_178B) 423 # define PLATFORM_ID "Integrity178" 426 # define PLATFORM_ID "Integrity" 439 #if defined(_WIN32) && defined(_MSC_VER) 440 # if defined(_M_IA64) 441 # define ARCHITECTURE_ID "IA64" 443 # elif defined(_M_X64) || defined(_M_AMD64) 444 # define ARCHITECTURE_ID "x64" 446 # elif defined(_M_IX86) 447 # define ARCHITECTURE_ID "X86" 449 # elif defined(_M_ARM64) 450 # define ARCHITECTURE_ID "ARM64" 452 # elif defined(_M_ARM) 454 # define ARCHITECTURE_ID "ARMV4I" 456 # define ARCHITECTURE_ID "ARMV5I" 458 # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) 461 # elif defined(_M_MIPS) 462 # define ARCHITECTURE_ID "MIPS" 464 # elif defined(_M_SH) 465 # define ARCHITECTURE_ID "SHx" 468 # define ARCHITECTURE_ID "" 471 #elif defined(__WATCOMC__) 473 # define ARCHITECTURE_ID "I86" 475 # elif defined(_M_IX86) 476 # define ARCHITECTURE_ID "X86" 479 # define ARCHITECTURE_ID "" 482 #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) 483 # if defined(__ICCARM__) 484 # define ARCHITECTURE_ID "ARM" 486 # elif defined(__ICCAVR__) 487 # define ARCHITECTURE_ID "AVR" 490 # define ARCHITECTURE_ID "" 493 #elif defined(__ghs__) 494 # if defined(__PPC64__) 495 # define ARCHITECTURE_ID "PPC64" 497 # elif defined(__ppc__) 498 # define ARCHITECTURE_ID "PPC" 500 # elif defined(__ARM__) 501 # define ARCHITECTURE_ID "ARM" 503 # elif defined(__x86_64__) 504 # define ARCHITECTURE_ID "x64" 506 # elif defined(__i386__) 507 # define ARCHITECTURE_ID "X86" 510 # define ARCHITECTURE_ID "" 513 # define ARCHITECTURE_ID 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)), \ 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)), \ 539 #ifdef COMPILER_VERSION_MAJOR 540 char const info_version[] =
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,
559 #ifdef COMPILER_VERSION_INTERNAL 560 char const info_version_internal[] =
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' 570 #ifdef SIMULATE_VERSION_MAJOR 571 char const info_simulate_version[] =
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,
593 char const * info_platform =
"INFO" ":" "platform[" PLATFORM_ID
"]" ;
594 char const * info_arch =
"INFO" ":" "arch[" ARCHITECTURE_ID
"]" ;
599 #if defined(_MSC_VER) && defined(_MSVC_LANG) 600 #define CXX_STD _MSVC_LANG 602 #define CXX_STD __cplusplus 605 const char * info_language_dialect_default =
"INFO" ":" "dialect_default[" 606 #if CXX_STD > 201703L 608 #elif CXX_STD >= 201703L 610 #elif CXX_STD >= 201402L 612 #elif CXX_STD >= 201103L 621 int main(
int argc,
char * argv[])
624 require += info_compiler[argc];
625 require += info_platform[argc];
626 #ifdef COMPILER_VERSION_MAJOR 627 require += info_version[argc];
629 #ifdef COMPILER_VERSION_INTERNAL 630 require += info_version_internal[argc];
633 require += info_simulate[argc];
635 #ifdef SIMULATE_VERSION_MAJOR 636 require += info_simulate_version[argc];
638 #if defined(__CRAYXE) || defined(__CRAYXC) 639 require += info_cray[argc];
641 require += info_language_dialect_default[argc];
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
-
3 B15F * B15F::instance =
nullptr ;
4 errorhandler_t B15F::errorhandler =
nullptr ;
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)
18 if (device.length() == 0)
19 abort (
"Adapter nicht gefunden" );
21 std::cout <<
PRE <<
"Verwende Adapter: " << device << std::endl;
25 std::cout <<
PRE <<
"Stelle Verbindung mit Adapter her... " << std::flush;
28 std::cout <<
"OK" << std::endl;
32 std::cout <<
PRE <<
"Teste Verbindung... " << std::flush;
48 abort (
"Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?" );
49 std::cout <<
"OK" << std::endl;
54 std::cout <<
PRE <<
"AVR Firmware Version: " << info[0] <<
" um " << info[1] <<
" Uhr (" << info[2] <<
")" << std::endl;
69 abort (
"Verbindung kann nicht repariert werden" );
77 for (uint8_t i = 0; i < 16; i++)
79 usart.writeByte(RQ_DISC);
84 catch (std::exception& ex)
94 uint8_t dummy = rand() % 256;
96 usart.writeByte(RQ_TEST);
97 usart.writeByte(dummy);
99 uint8_t aw = usart.readByte();
100 uint8_t mirror = usart.readByte();
102 return aw ==
MSG_OK && mirror == dummy;
108 uint16_t dummy = rand() % (0xFFFF / 3);
110 usart.writeByte(RQ_INT);
111 usart.writeInt(dummy);
113 uint16_t aw = usart.readInt();
114 return aw == dummy * 3;
120 std::vector<std::string> info;
122 usart.writeByte(RQ_INFO);
124 uint8_t n = usart.readByte();
127 uint8_t len = usart.readByte();
132 str += static_cast<char>(usart.readByte());
138 uint8_t aw = usart.readByte();
140 abort (
"Board Info fehlerhalft: code " + std::to_string((
int ) aw));
147 usart.writeByte(RQ_ST);
149 uint8_t aw = usart.readByte();
155 usart.writeByte(RQ_BA0);
156 usart.writeByte(port);
158 uint8_t aw = usart.readByte();
165 usart.writeByte(RQ_BA1);
166 usart.writeByte(port);
168 uint8_t aw = usart.readByte();
176 usart.writeByte(RQ_BE0);
177 uint8_t
byte = usart.readByte();
185 usart.writeByte(RQ_BE1);
186 uint8_t
byte = usart.readByte();
194 usart.writeByte(RQ_DSW);
195 uint8_t
byte = usart.readByte();
202 usart.writeByte(RQ_AA0);
203 usart.writeInt(value);
205 uint8_t aw = usart.readByte();
212 usart.writeByte(RQ_AA1);
213 usart.writeInt(value);
215 uint8_t aw = usart.readByte();
224 abort (
"Bad ADC channel: " + std::to_string(channel));
232 usart.
transmit (&rq[0], 0,
sizeof (rq));
234 uint16_t adc = usart.readInt();
237 abort (
"Bad ADC data detected (1)" );
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)
244 buffer_a += offset_a;
245 buffer_b += offset_b;
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);
256 for (uint16_t i = 0; i < count; i++)
260 buffer_a[i] = usart.readInt();
262 if (buffer_a[i] > 1023)
263 abort (
"Bad ADC data detected (2)" );
272 buffer_b[i] = usart.readInt();
274 if (buffer_b[i] > 1023)
275 abort (
"Bad ADC data detected (3)" );
283 uint8_t aw = usart.readByte();
285 abort (
"Sequenz unterbrochen" );
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)
303 usart.
transmit (&rq[0], 0,
sizeof (rq));
305 uint8_t
byte = usart.readByte();
320 usart.
transmit (&rq[0], 0,
sizeof (rq));
322 uint8_t aw = usart.readByte();
338 usart.
transmit (&rq[0], 0,
sizeof (rq));
340 uint8_t
byte = usart.readByte();
355 usart.
transmit (&rq[0], 0,
sizeof (rq));
357 uint8_t aw = usart.readByte();
365 std::this_thread::sleep_for(std::chrono::milliseconds(ms));
370 std::this_thread::sleep_for(std::chrono::microseconds(us));
376 instance =
new B15F ();
384 std::array<char, 128> buffer;
386 std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(),
"r" ), pclose);
389 throw std::runtime_error(
"popen() failed!" );
391 while (fgets(buffer.data(), buffer.size(), pipe.get()) !=
nullptr )
393 result += buffer.data();
409 std::cerr <<
"NOTICE: B15F::errorhandler not set" << std::endl;
410 std::cout << ex.what() << std::endl;
-static std::string exec(std::string cmd)
-uint8_t getRegister(uint8_t adr)
-void delay_us(uint16_t us)
-uint8_t digitalRead0(void)
-uint8_t pwmSetFrequency(uint32_t freq)
-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)
-bool testConnection(void)
-uint8_t readDipSwitch(void)
-void delay_ms(uint16_t ms)
-bool setRegister(uint8_t adr, uint8_t val)
-static B15F & getInstance(void)
+ 3 B15F *B15F::instance =
nullptr ;
4 errorhandler_t B15F::errorhandler =
nullptr ;
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)
19 if (device.length() == 0)
20 abort (
"Adapter nicht gefunden" );
22 std::cout <<
PRE <<
"Verwende Adapter: " << device << std::endl;
25 std::cout <<
PRE <<
"Stelle Verbindung mit Adapter her... " << std::flush;
28 std::cout <<
"OK" << std::endl;
31 std::cout <<
PRE <<
"Teste Verbindung... " << std::flush;
47 abort (
"Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?" );
48 std::cout <<
"OK" << std::endl;
53 std::cout <<
PRE <<
"AVR Firmware Version: " << info[0] <<
" um " << info[1] <<
" Uhr (" << info[2] <<
")" 69 abort (
"Verbindung kann nicht repariert werden" );
82 for (uint8_t i = 0; i < 16; i++)
84 usart.
transmit (&rq[0], 0,
sizeof (rq));
89 catch (std::exception &ex)
99 uint8_t dummy = rand() % 256;
106 usart.
transmit (&rq[0], 0,
sizeof (rq));
109 usart.
receive (&aw[0], 0,
sizeof (aw));
111 return aw[0] ==
MSG_OK && aw[1] == dummy;
117 uint16_t dummy = rand() % (0xFFFF / 3);
122 static_cast<uint8_t >(dummy & 0xFF),
123 static_cast<uint8_t >(dummy >> 8)
125 usart.
transmit (&rq[0], 0,
sizeof (rq));
128 usart.
receive (reinterpret_cast<uint8_t*>(&aw), 0,
sizeof (aw));
130 return aw == dummy * 3;
136 std::vector<std::string> info;
142 usart.
transmit (&rq[0], 0,
sizeof (rq));
145 usart.
receive (&n, 0,
sizeof (n));
150 usart.
receive (&len, 0,
sizeof (len));
154 usart.
receive (reinterpret_cast<uint8_t *>(&str[0]), 0, len);
156 info.push_back(std::string(str));
160 usart.
receive (&aw, 0,
sizeof (aw));
162 abort (
"Board Info fehlerhalft: code " + std::to_string((
int ) aw));
173 usart.
transmit (&rq[0], 0,
sizeof (rq));
176 usart.
receive (&aw, 0,
sizeof (aw));
187 usart.
transmit (&rq[0], 0,
sizeof (rq));
190 usart.
receive (&aw, 0,
sizeof (aw));
201 usart.
transmit (&rq[0], 0,
sizeof (rq));
204 usart.
receive (&aw, 0,
sizeof (aw));
215 usart.
transmit (&rq[0], 0,
sizeof (rq));
218 usart.
receive (&aw, 0,
sizeof (aw));
229 usart.
transmit (&rq[0], 0,
sizeof (rq));
232 usart.
receive (&aw, 0,
sizeof (aw));
243 usart.
transmit (&rq[0], 0,
sizeof (rq));
246 usart.
receive (&aw, 0,
sizeof (aw));
255 static_cast<uint8_t >(value & 0xFF),
256 static_cast<uint8_t >(value >> 8)
258 usart.
transmit (&rq[0], 0,
sizeof (rq));
261 usart.
receive (&aw, 0,
sizeof (aw));
270 static_cast<uint8_t >(value & 0xFF),
271 static_cast<uint8_t >(value >> 8)
273 usart.
transmit (&rq[0], 0,
sizeof (rq));
276 usart.
receive (&aw, 0,
sizeof (aw));
284 abort (
"Bad ADC channel: " + std::to_string(channel));
292 usart.
transmit (&rq[0], 0,
sizeof (rq));
295 usart.
receive (reinterpret_cast<uint8_t*>(&aw), 0,
sizeof (aw));
298 abort (
"Bad ADC data detected (1)" );
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)
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)
360 usart.
transmit (&rq[0], 0,
sizeof (rq));
363 usart.
receive (&aw, 0,
sizeof (aw));
377 usart.
transmit (&rq[0], 0,
sizeof (rq));
380 usart.
receive (&aw, 0,
sizeof (aw));
395 usart.
transmit (&rq[0], 0,
sizeof (rq));
398 usart.
receive (&aw, 0,
sizeof (aw));
412 usart.
transmit (&rq[0], 0,
sizeof (rq));
415 usart.
receive (&aw, 0,
sizeof (aw));
422 std::this_thread::sleep_for(std::chrono::milliseconds(ms));
427 std::this_thread::sleep_for(std::chrono::microseconds(us));
433 instance =
new B15F ();
441 std::array<char, 128> buffer;
443 std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(),
"r" ), pclose);
446 throw std::runtime_error(
"popen() failed!" );
448 while (fgets(buffer.data(), buffer.size(), pipe.get()) !=
nullptr )
450 result += buffer.data();
467 std::cerr <<
"NOTICE: B15F::errorhandler not set" << std::endl;
468 std::cout << ex.what() << std::endl;
+static std::string exec(std::string cmd)
+uint8_t getRegister(uint8_t adr)
+void delay_us(uint16_t us)
+uint8_t digitalRead0(void)
+uint8_t pwmSetFrequency(uint32_t freq)
+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)
+bool testConnection(void)
+uint8_t readDipSwitch(void)
+void delay_ms(uint16_t ms)
+bool setRegister(uint8_t adr, uint8_t val)
+static B15F & getInstance(void)
void transmit(uint8_t *buffer, uint16_t offset, uint8_t len)
-static void abort(std::string msg)
+static void abort(std::string msg)
+void receive(uint8_t *buffer, uint16_t offset, uint8_t len)
void clearInputBuffer(void)
void clearOutputBuffer(void)
-uint16_t analogRead(uint8_t channel)
-bool digitalWrite0(uint8_t)
+uint16_t analogRead(uint8_t channel)
+bool digitalWrite0(uint8_t)
const std::string PRE
B15F stdout prefix.
void setBaudrate(uint32_t baudrate)
-bool activateSelfTestMode(void)
-std::vector< std::string > getBoardInfo(void)
+bool activateSelfTestMode(void)
+std::vector< std::string > getBoardInfo(void)
constexpr static uint16_t RECONNECT_TIMEOUT
Time in ms after which a reconnect attempt aborts.
-bool analogWrite1(uint16_t port)
-bool digitalWrite1(uint8_t)
-bool pwmSetValue(uint8_t value)
+bool analogWrite1(uint16_t port)
+bool digitalWrite1(uint8_t)
+bool pwmSetValue(uint8_t value)
constexpr static uint8_t MSG_OK
Value to acknowledge a received command.
void openDevice(std::string device)
-uint8_t digitalRead1(void)
+uint8_t digitalRead1(void)
constexpr static uint32_t BAUDRATE
USART baudrate for communication with the MCU.
-static void setAbortHandler(errorhandler_t func)
-bool analogWrite0(uint16_t port)
+static void setAbortHandler(errorhandler_t func)
+bool analogWrite0(uint16_t port)
constexpr static uint8_t RECONNECT_TRIES
Maximum count of reconnect attempts after which the driver stops.
-
+
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() {
5 #include <bits/stdc++.h> 15 #include <sys/ioctl.h> 18 #include "driverexception.h" 19 #include "timeoutexception.h" 21 typedef std::function<void(std::exception&)> errorhandler_t;
89 static std::string
exec (std::string cmd);
95 static void abort (std::string msg);
101 static void abort (std::exception& ex);
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);
233 const std::string
PRE =
"[B15F] " ;
239 constexpr
static uint32_t
BAUDRATE = 57600;
250 static B15F * instance;
251 static errorhandler_t errorhandler;
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;
-static std::string exec(std::string cmd)
+static std::string exec(std::string cmd)
constexpr static uint8_t MSG_FAIL
Value to reject a received command.
-uint8_t getRegister(uint8_t adr)
-void delay_us(uint16_t us)
-uint8_t digitalRead0(void)
-uint8_t pwmSetFrequency(uint32_t freq)
-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)
-bool testConnection(void)
-uint8_t readDipSwitch(void)
-void delay_ms(uint16_t ms)
-bool setRegister(uint8_t adr, uint8_t val)
-static B15F & getInstance(void)
+uint8_t getRegister(uint8_t adr)
+void delay_us(uint16_t us)
+uint8_t digitalRead0(void)
+uint8_t pwmSetFrequency(uint32_t freq)
+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)
+bool testConnection(void)
+uint8_t readDipSwitch(void)
+void delay_ms(uint16_t ms)
+bool setRegister(uint8_t adr, uint8_t val)
+static B15F & getInstance(void)
-static void abort(std::string msg)
+static void abort(std::string msg)
-uint16_t analogRead(uint8_t channel)
-bool digitalWrite0(uint8_t)
+uint16_t analogRead(uint8_t channel)
+bool digitalWrite0(uint8_t)
const std::string PRE
B15F stdout prefix.
-bool activateSelfTestMode(void)
-std::vector< std::string > getBoardInfo(void)
+bool activateSelfTestMode(void)
+std::vector< std::string > getBoardInfo(void)
constexpr static uint16_t RECONNECT_TIMEOUT
Time in ms after which a reconnect attempt aborts.
-bool analogWrite1(uint16_t port)
-bool digitalWrite1(uint8_t)
-bool pwmSetValue(uint8_t value)
+bool analogWrite1(uint16_t port)
+bool digitalWrite1(uint8_t)
+bool pwmSetValue(uint8_t value)
constexpr static uint8_t MSG_OK
Value to acknowledge a received command.
-uint8_t digitalRead1(void)
+uint8_t digitalRead1(void)
constexpr static uint16_t WDT_TIMEOUT
Time in ms after which the watch dog timer resets the MCU.
constexpr static uint32_t BAUDRATE
USART baudrate for communication with the MCU.
-static void setAbortHandler(errorhandler_t func)
-bool analogWrite0(uint16_t port)
+static void setAbortHandler(errorhandler_t func)
+bool analogWrite0(uint16_t port)
constexpr static uint8_t RECONNECT_TRIES
Maximum count of reconnect attempts after which the driver stops.
-
+
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() {
2 void USART::writeByte(uint8_t b)
4 int sent = write(file_desc, &b, 1);
7 std::cout <<
"WARNUNG: Fehler beim Senden (" << sent <<
"): writeByte(), wiederhole..." << std::endl;
9 sent = write(file_desc, &b, 1);
16 void USART::writeInt(uint16_t d)
18 int sent = write(file_desc, reinterpret_cast<char *>(&d), 2);
23 void USART::writeU32(uint32_t w)
25 int sent = write(file_desc, reinterpret_cast<char *>(&w), 4);
30 uint8_t USART::readByte(
void )
33 auto start = std::chrono::steady_clock::now();
36 while (elapsed < timeout * 100)
38 int code = read(file_desc, &b, 1);
40 return static_cast<uint8_t>(b);
42 end = std::chrono::steady_clock::now();
43 elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
49 uint16_t USART::readInt(
void )
51 return readByte() | readByte() << 8;
-
+
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
Exception for USART problems, for instance buffer overflow.
-
Definition at line 11 of file usartexception.h .
+
Definition at line 9 of file usartexception.h .
◆ 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() {
17 #include "ui/view_selection.h" 18 #include "ui/view_info.h" 19 #include "ui/view_monitor.h" 20 #include "ui/view_promt.h" 22 volatile int win_changed_cooldown = 0;
23 volatile bool t_refresh_active =
false ;
25 void signal_handler(
int signal)
27 if (signal == SIGWINCH)
29 win_changed_cooldown = 10;
31 if (!t_refresh_active)
33 if (t_refresh.joinable())
35 t_refresh_active =
true ;
36 t_refresh = std::thread([]()
39 while (win_changed_cooldown--)
40 std::this_thread::sleep_for(std::chrono::milliseconds(10));
42 t_refresh_active =
false ;
45 win_stack.back()->repaint();
51 else if (signal == SIGINT)
54 std::cout <<
"SIGINT - Abbruch." << std::endl;
59 void abort_handler(std::exception& ex)
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(
"" );
69 std::this_thread::sleep_for(std::chrono::milliseconds(5000));
72 std::cerr << std::endl <<
"*** EXCEPTION ***" << std::endl << ex.what() << std::endl;
80 #ifndef B15F_CLI_DEBUG 81 std::cout << std::endl <<
"Starte in 3s ..." << std::endl;
93 mousemask(ALL_MOUSE_EVENTS, NULL);
96 signal(SIGWINCH, signal_handler);
97 signal(SIGINT, signal_handler);
100 View::setWinContext(newwin(25, 85, 0, 0));
108 int exit_code = EXIT_SUCCESS;
-static B15F & getInstance(void)
-static void setAbortHandler(errorhandler_t func)
+static B15F & getInstance(void)
+static void setAbortHandler(errorhandler_t func)
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)
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)
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() {
2 const char features[] = {
"\n" 4 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 9 "c_function_prototypes\n" 11 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 18 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L 25 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 34 int main(
int argc,
char ** argv)
37 return features[argc];
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() {
2 const char features[] = {
"\n" 4 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L 9 "cxx_aggregate_default_initializers\n" 11 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L 16 "cxx_alias_templates\n" 18 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L 25 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L 32 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L 39 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L 44 "cxx_attribute_deprecated\n" 46 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 53 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L 58 "cxx_binary_literals\n" 60 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 67 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L 72 "cxx_contextual_conversions\n" 74 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 81 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L 88 #if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L 93 "cxx_decltype_incomplete_return_types\n" 95 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 100 "cxx_default_function_template_args\n" 102 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 107 "cxx_defaulted_functions\n" 109 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 114 "cxx_defaulted_move_initializers\n" 116 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L 121 "cxx_delegating_constructors\n" 123 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 128 "cxx_deleted_functions\n" 130 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L 135 "cxx_digit_separators\n" 137 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 142 "cxx_enum_forward_declarations\n" 144 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 149 "cxx_explicit_conversions\n" 151 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L 156 "cxx_extended_friend_declarations\n" 158 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 163 "cxx_extern_templates\n" 165 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L 172 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 177 "cxx_func_identifier\n" 179 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 184 "cxx_generalized_initializers\n" 186 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L 191 "cxx_generic_lambdas\n" 193 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L 198 "cxx_inheriting_constructors\n" 200 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 205 "cxx_inline_namespaces\n" 207 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 214 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L 219 "cxx_lambda_init_captures\n" 221 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 226 "cxx_local_type_template_args\n" 228 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 233 "cxx_long_long_type\n" 235 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 242 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L 247 "cxx_nonstatic_member_init\n" 249 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 256 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L 263 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 270 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 275 "cxx_raw_string_literals\n" 277 #if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L 282 "cxx_reference_qualified_functions\n" 284 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L 289 "cxx_relaxed_constexpr\n" 291 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L 296 "cxx_return_type_deduction\n" 298 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 303 "cxx_right_angle_brackets\n" 305 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 310 "cxx_rvalue_references\n" 312 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 317 "cxx_sizeof_member\n" 319 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 324 "cxx_static_assert\n" 326 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 333 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && __cplusplus 338 "cxx_template_template_parameters\n" 340 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L 347 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 352 "cxx_trailing_return_types\n" 354 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 359 "cxx_unicode_literals\n" 361 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 366 "cxx_uniform_initialization\n" 368 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 373 "cxx_unrestricted_unions\n" 375 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L 380 "cxx_user_literals\n" 382 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L 387 "cxx_variable_templates\n" 389 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 394 "cxx_variadic_macros\n" 396 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) 401 "cxx_variadic_templates\n" 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
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
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() {
2 #include "../drv/b15f.h" 4 std::vector<View*> win_stack;
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);
22 win_stack.push_back(view);
32 key = wgetch(View::getWinContext());
33 win_stack.back()->repaint();
34 nextCall = win_stack.back()->keypress(key);
42 while (win_stack.size());
49 delete win_stack.back();
53 win_stack.back()->repaint();
64 if (t_refresh.joinable())
74 view->setTitle(
"Info" );
75 view->setText(
"Informationen zu Board 15 Famulus Edition\nEs war einmal..." );
76 view->setLabelClose(
"[ Zurueck ]" );
79 win_stack.push_back(view);
83 void show_monitor(
int )
86 view->setTitle(
"Monitor" );
87 view->setText(
"\nErfasse Messwerte..." );
88 view->setLabelClose(
"[ Zurueck ]" );
91 win_stack.push_back(view);
95 void show_invalid_port_input(
int )
98 view->setTitle(
"Falsche Eingabe" );
99 view->setText(
"Bitte geben Sie einen Wert aus dem Intervall [0, FF] an." );
100 view->setLabelClose(
"[ Schliessen ]" );
103 win_stack.push_back(view);
107 void show_invalid_dac_input(
int )
110 view->setTitle(
"Falsche Eingabe" );
111 view->setText(
"Bitte geben Sie einen Wert aus dem Intervall [0, 1023] an." );
112 view->setLabelClose(
"[ Schliessen ]" );
115 win_stack.push_back(view);
119 void write_digital_output0(
int )
123 int d = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput(), 0, 16);
125 throw std::invalid_argument(
"bad value" );
126 uint8_t port = static_cast<uint8_t>(d);
132 catch (std::invalid_argument& ex)
134 show_invalid_port_input(0);
138 void write_digital_output1(
int )
142 int d = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput(), 0, 16);
144 throw std::invalid_argument(
"bad value" );
145 uint8_t port = static_cast<uint8_t>(d);
151 catch (std::invalid_argument& ex)
153 show_invalid_port_input(0);
157 void write_analog_output0(
int )
161 uint16_t port = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput());
163 throw std::invalid_argument(
"bad value" );
169 catch (std::invalid_argument& ex)
171 show_invalid_dac_input(0);
175 void write_analog_output1(
int )
179 uint16_t port = std::stoi(static_cast<ViewPromt*>(win_stack.back())->getInput());
181 throw std::invalid_argument(
"bad value" );
187 catch (std::invalid_argument& ex)
189 show_invalid_dac_input(0);
193 void show_digital_output0(
int )
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);
202 win_stack.push_back(view);
206 void show_digital_output1(
int )
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);
215 win_stack.push_back(view);
219 void show_analog_output0(
int )
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);
228 win_stack.push_back(view);
232 void show_analog_output1(
int )
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);
241 win_stack.push_back(view);
245 void start_selftest(
int )
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);
257 win_stack.push_back(view);
261 void stop_selftest(
int )
271 void show_selftest_info(
int )
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);
280 win_stack.push_back(view);
-void delay_ms(uint16_t ms)
-static B15F & getInstance(void)
+void delay_ms(uint16_t ms)
+static B15F & getInstance(void)
-bool digitalWrite0(uint8_t)
-bool activateSelfTestMode(void)
+bool digitalWrite0(uint8_t)
+bool activateSelfTestMode(void)
-bool analogWrite1(uint16_t port)
+bool analogWrite1(uint16_t port)
-bool digitalWrite1(uint8_t)
+bool digitalWrite1(uint8_t)
constexpr static uint16_t WDT_TIMEOUT
Time in ms after which the watch dog timer resets the MCU.
-bool analogWrite0(uint16_t port)
+bool analogWrite0(uint16_t port)
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() {
5 #include "view_selection.h" 7 #include "view_monitor.h" 8 #include "view_promt.h" 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 );
30 void show_selftest_info(
int );
31 void start_selftest(
int );
32 void stop_selftest(
int );
35 extern std::vector<View*> win_stack;
36 extern std::thread t_refresh;
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() {
11 file_desc = open(device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
15 struct termios options;
16 int code = tcgetattr(file_desc, &options);
20 options.c_cflag = CS8 | CLOCAL | CREAD;
21 options.c_iflag = IGNPAR;
24 options.c_cc[VMIN] = 0;
25 options.c_cc[VTIME] = timeout;
26 code = cfsetspeed(&options, baudrate);
30 code = tcsetattr(file_desc, TCSANOW, &options);
42 int code = close(file_desc);
51 int code = tcflush(file_desc, TCIFLUSH);
58 int code = tcflush(file_desc, TCOFLUSH);
65 int code = tcdrain(file_desc);
72 int n = read(file_desc, buffer + offset, len);
75 std::string(__FUNCTION__) +
" failed: " + std::string(__FILE__) +
"#" + std::to_string(__LINE__));
80 int n = write(file_desc, buffer + offset, len);
83 std::string(__FUNCTION__) +
" failed: " + std::string(__FILE__) +
"#" + std::to_string(__LINE__));
98 this->baudrate = baudrate;
103 this->timeout = timeout;
uint32_t getBaudrate(void)
-
+
void transmit(uint8_t *buffer, uint16_t offset, uint8_t len)
void receive(uint8_t *buffer, uint16_t offset, uint8_t len)
@@ -86,7 +86,7 @@ $(function() {
void flushOutputBuffer(void)
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)
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 39 virtual const char *
what ()
const throw ()
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 37 virtual const char *
what ()
const throw ()
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() {
3 WINDOW* View::win =
nullptr ;
9 B15F::abort (
"View::win not initialized, missing context" );
11 getmaxyx(win, height, width);
19 void View::setWinContext(WINDOW* win)
24 WINDOW* View::getWinContext()
30 std::vector<std::string> View::str_split(
const std::string& str,
const std::string delim)
32 std::vector<std::string> tokens;
33 size_t prev = 0, pos = 0;
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();
42 while (pos < str.length() && prev < str.length());
47 void View::setTitle(std::string title)
56 if (ioctl(0, TIOCGWINSZ, (
char *) &size) < 0)
57 throw std::runtime_error(
"TIOCGWINSZ error" );
60 start_x = floor((size.ws_col - width) / 2.);
61 start_y = floor((size.ws_row - height) / 2.);
64 mvwin(win, start_y, start_x);
70 int offset_x = (width - title.length()) / 2;
71 mvwprintw(win, 1, offset_x,
"%s" , title.c_str());
-static void abort(std::string msg)
+static void abort(std::string msg)
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() {
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() {
5 calls.push_back(
nullptr );
8 void ViewInfo::setText(std::string text)
13 void ViewInfo::setLabelClose(std::string label)
15 this->label_close = label;
18 void ViewInfo::setCall(call_t call)
26 for (std::string line : str_split(text,
"\n" ))
27 mvwprintw(win, text_offset_y + li++, text_offset_x,
"%s" , line.c_str());
29 close_offset_x = (width - label_close.length()) / 2;
30 close_offset_y = height - 2;
32 wattron(win, A_REVERSE);
33 mvwprintw(win, close_offset_y, close_offset_x,
"%s" , label_close.c_str());
34 wattroff(win, A_REVERSE);
37 call_t ViewInfo::keypress(
int & key)
46 if (getmouse(&event) == OK && event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
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())
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() {
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" 3 ViewMonitor::ViewMonitor() : t_worker(&
ViewMonitor ::worker, this)
7 call_t ViewMonitor::keypress(
int & key)
17 if (getmouse(&event) == OK && event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
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())
44 std::string ViewMonitor::fancyDigitalString(uint8_t& b)
46 std::stringstream str;
47 str << std::bitset<8>(b).to_string();
49 str <<
"0x" << std::setfill (
'0' ) << std::setw(2) << std::hex << (int) b << std::dec;
53 std::string ViewMonitor::fancyAnalogString(uint16_t& v)
55 std::stringstream str;
56 double volt = round(v * 100.0 * 5.0 / 1023.0) / 100.0;
58 str << std::setfill (
'0' ) << std::setw(4) << (int) v <<
" " << std::fixed << std::setprecision(2) << volt <<
" V " ;
61 uint8_t p = round(v * 40.0 / 1023.0);
62 for (uint8_t i = 0; i < p; i++)
64 for (uint8_t i = 0; i < 40 - p; i++)
66 str <<
"]" << std::endl;
71 void ViewMonitor::worker()
78 std::this_thread::sleep_for(std::chrono::milliseconds(100));
84 for (uint8_t i = 0; i <
sizeof (adc) /
sizeof (adc[0]); i++)
88 std::stringstream str;
91 for (uint8_t i = 0; i < width - 2 * text_offset_x; i++)
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;
104 for (uint8_t i = 0; i < width - 2 * text_offset_x; i++)
111 str <<
"Analoge Eingaenge:" << std::endl;
112 for (uint8_t i = 0; i <
sizeof (adc) /
sizeof (adc[0]); i++)
114 str <<
"Kanal " << std::to_string((
int ) i) <<
": " ;
115 str << fancyAnalogString(adc[i]) << std::endl;
123 std::cout <<
"DriverException: " << ex.what() << std::endl;
-uint8_t digitalRead0(void)
-uint8_t readDipSwitch(void)
-void delay_ms(uint16_t ms)
-static B15F & getInstance(void)
+uint8_t digitalRead0(void)
+uint8_t readDipSwitch(void)
+void delay_ms(uint16_t ms)
+static B15F & getInstance(void)
-static void abort(std::string msg)
-uint16_t analogRead(uint8_t channel)
-uint8_t digitalRead1(void)
+static void abort(std::string msg)
+uint16_t analogRead(uint8_t channel)
+uint8_t digitalRead1(void)
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" 7 int li = text_offset_y;
9 for (std::string line : str_split(message + input,
"\n" ))
11 mvwprintw(win, ++li, text_offset_x,
"%s" , line.c_str());
12 ci = line.length() + text_offset_x;
15 button_offset_x = (width - label_cancel.length() - sep.length() - label_confirm.length()) / 2;
16 button_offset_y = height - text_offset_y;
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());
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);
37 void ViewPromt::setMessage(std::string message)
39 this->message = message;
42 void ViewPromt::setConfirm(std::string name, std::function<
void (
int )> call)
48 void ViewPromt::setCancel(std::string name,
bool cancelable)
51 this->cancelable = cancelable;
54 std::string ViewPromt::getInput()
59 std::function<void(
int )> ViewPromt::keypress(
int & key)
61 std::function<void(
int )> ret =
nullptr ;
71 selection = (selection + 1 ) % 2;
78 if (getmouse(&event) == OK &&
event .bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
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)
85 if (cancelable && mouse_x >= column_start && mouse_x < column_start + label_cancel.length())
87 if (selection == 0 || event.bstate & BUTTON1_DOUBLE_CLICKED)
91 if (mouse_x >= column_start + label_cancel.length() + sep.length() && mouse_x < column_start + label_cancel.length() + sep.length() + label_confirm.length())
93 if (selection == 1 || event.bstate & BUTTON1_DOUBLE_CLICKED)
115 if (key >=
' ' && key <=
'~' )
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" 3 void ViewSelection::draw()
6 for (
size_t i = 0; i < choices.size(); i++)
9 wattron(win, A_REVERSE);
10 mvwprintw(win, i + choice_offset_y, choice_offset_x,
"%s" , choices[i].c_str());
12 wattroff(win, A_REVERSE);
16 void ViewSelection::addChoice(std::string name, call_t call)
18 choices.push_back(name);
19 calls.push_back(call);
22 call_t ViewSelection::keypress(
int & key)
29 selection = (selection - 1 + choices.size()) % choices.size();
30 while (!choices[selection].length() && choices.size());
36 selection = (selection + 1) % choices.size();
37 while (!choices[selection].length() && choices.size());
45 if (getmouse(&event) == OK &&
event .bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
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())
53 if (selection == i || event.bstate & BUTTON1_DOUBLE_CLICKED)
66 if (selection == choices.size() - 1)
69 ret = calls[selection];
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() {