diff --git a/control/examples/pegel/main.cpp b/control/examples/pegel/main.cpp
index 960b8ad..2487217 100644
--- a/control/examples/pegel/main.cpp
+++ b/control/examples/pegel/main.cpp
@@ -11,7 +11,7 @@ int main()
B15F& drv = B15F::getInstance();
PlottyFile pf;
- uint16_t ba[1024];
+ uint16_t buf[1024];
const uint16_t sample_count = 1024;
const uint16_t delta = 1;
@@ -30,12 +30,12 @@ int main()
uint8_t curve = 0;
- drv.analogSequence(0, &ba[0], 0, 1, nullptr, 0, 0, delta, sample_count);
+ drv.analogSequence(0, &buf[0], 0, 1, nullptr, 0, 0, delta, sample_count);
for(uint16_t x = 0; x < sample_count * delta; x += delta)
{
- std::cout << x << " - " << ba[x] << std::endl;
- pf.addDot(Dot(x, ba[x], curve));
+ std::cout << x << " - " << buf[x] << std::endl;
+ pf.addDot(Dot(x, buf[x], curve));
}
// speichern und plotty starten
diff --git a/control/src/drv/b15f.h b/control/src/drv/b15f.h
index d183644..dc06e43 100644
--- a/control/src/drv/b15f.h
+++ b/control/src/drv/b15f.h
@@ -32,12 +32,6 @@ public:
* Grundfunktionen des B15F Treibers *
*************************************/
- /**
- * Initialisiert und testet die Verbindung zum B15
- * \throws DriverException
- */
- void init(void);
-
/**
* Versucht die Verbindung zum B15 wiederherzustellen
* \throws DriverException
@@ -182,7 +176,6 @@ public:
uint16_t analogRead(uint8_t channel);
/**
- * \brief Komplexe Analoge Sequenz
* DAC 0 wird auf den Startwert gesetzt und dann schrittweise um Delta inkrementiert.
* Für jeden eingestelleten DAC-Wert werden zwei ADCs (channel_a und channel_b) angesprochen und die Werte übermittelt.
* Die Werte werden in buffer_a für Kanal a und buffer_b für Kanal b gespeichert.
@@ -212,6 +205,12 @@ public:
constexpr static uint32_t BAUDRATE = 57600;
private:
+
+ /**
+ * Initialisiert und testet die Verbindung zum B15
+ * \throws DriverException
+ */
+ void init(void);
USART usart;
static B15F* instance;
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..99a8a8d
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,3 @@
+# Einführung
+Die wichtigste Klasse für die Steuerung des Board 15 ist [B15F](classB15F.html).
+Dort befindet sich auch eine Übersicht der verfügbaren Befehle.
diff --git a/docs/doxygen-cfg b/docs/doxygen-cfg
index edfca4d..629c77c 100644
--- a/docs/doxygen-cfg
+++ b/docs/doxygen-cfg
@@ -827,7 +827,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = "../control/src"
+INPUT = ../control/src README.md
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -1020,7 +1020,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE = README.md
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -1696,7 +1696,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.
-GENERATE_LATEX = YES
+GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
diff --git a/docs/html/b15f_8cpp_source.html b/docs/html/b15f_8cpp_source.html
index f7fbaa7..bf5bcd1 100644
--- a/docs/html/b15f_8cpp_source.html
+++ b/docs/html/b15f_8cpp_source.html
@@ -70,12 +70,12 @@ $(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;
59 uint8_t tries = RECONNECT_TRIES;
69 abort(
"Verbindung kann nicht repariert werden");
77 for(uint8_t i = 0; i < 16; i++)
84 catch(std::exception& ex)
94 uint8_t dummy = rand() % 256;
102 return aw == MSG_OK && mirror == dummy;
108 uint16_t dummy = rand() % (0xFFFF / 3);
114 return aw == dummy * 3;
120 std::vector<std::string> info;
131 str += static_cast<char>(usart.
readByte());
139 abort(
"Board Info fehlerhalft: code " + std::to_string((
int) aw));
223 abort(
"Bad ADC channel: " + std::to_string(channel));
230 int n_sent = usart.write_timeout(&rq[0], 0,
sizeof(rq), 1000);
231 if(n_sent !=
sizeof(rq))
232 abort(
"Sent failed");
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;
253 usart.
writeInt(static_cast<uint16_t>(delta));
256 for(uint16_t i = 0; i < count; i++)
262 if(buffer_a[i] > 1023)
263 abort(
"Bad ADC data detected (2)");
274 if(buffer_b[i] > 1023)
275 abort(
"Bad ADC data detected (3)");
285 abort(
"Sequenz unterbrochen");
292 std::this_thread::sleep_for(std::chrono::milliseconds(ms));
297 std::this_thread::sleep_for(std::chrono::microseconds(us));
303 instance =
new B15F();
310 std::array<char, 128> buffer;
312 std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(),
"r"), pclose);
314 throw std::runtime_error(
"popen() failed!");
316 while (fgets(buffer.data(), buffer.size(), pipe.get()) !=
nullptr) {
317 result += buffer.data();
333 std::cerr <<
"NOTICE: B15F::errorhandler not set" << std::endl;
334 std::cout << ex.what() << std::endl;
+ 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;
59 uint8_t tries = RECONNECT_TRIES;
69 abort(
"Verbindung kann nicht repariert werden");
77 for(uint8_t i = 0; i < 16; i++)
84 catch(std::exception& ex)
94 uint8_t dummy = rand() % 256;
102 return aw == MSG_OK && mirror == dummy;
108 uint16_t dummy = rand() % (0xFFFF / 3);
114 return aw == dummy * 3;
120 std::vector<std::string> info;
131 str += static_cast<char>(usart.
readByte());
139 abort(
"Board Info fehlerhalft: code " + std::to_string((
int) aw));
223 abort(
"Bad ADC channel: " + std::to_string(channel));
230 int n_sent = usart.write_timeout(&rq[0], 0,
sizeof(rq), 1000);
231 if(n_sent !=
sizeof(rq))
232 abort(
"Sent failed");
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;
253 usart.
writeInt(static_cast<uint16_t>(delta));
256 for(uint16_t i = 0; i < count; i++)
262 if(buffer_a[i] > 1023)
263 abort(
"Bad ADC data detected (2)");
274 if(buffer_b[i] > 1023)
275 abort(
"Bad ADC data detected (3)");
285 abort(
"Sequenz unterbrochen");
292 std::this_thread::sleep_for(std::chrono::milliseconds(ms));
297 std::this_thread::sleep_for(std::chrono::microseconds(us));
303 instance =
new B15F();
310 std::array<char, 128> buffer;
312 std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(),
"r"), pclose);
314 throw std::runtime_error(
"popen() failed!");
316 while (fgets(buffer.data(), buffer.size(), pipe.get()) !=
nullptr) {
317 result += buffer.data();
333 std::cerr <<
"NOTICE: B15F::errorhandler not set" << std::endl;
334 std::cout << ex.what() << std::endl;
static std::string exec(std::string cmd)
void delay_us(uint16_t us)
uint8_t digitalRead0(void)
-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)
Komplexe Analoge Sequenz DAC 0 wird auf den Startwert gesetzt und dann schrittweise um Delta inkremen...
+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)
@@ -92,7 +92,6 @@ $(function() {
std::vector< std::string > getBoardInfo(void)
void writeByte(uint8_t b)
bool digitalWrite1(uint8_t)
-
bool analogWrite0(uint16_t)
void openDevice(std::string device)
diff --git a/docs/html/b15f_8h_source.html b/docs/html/b15f_8h_source.html
index 33242e7..4dffe52 100644
--- a/docs/html/b15f_8h_source.html
+++ b/docs/html/b15f_8h_source.html
@@ -70,11 +70,11 @@ $(function() {
b15f.h
-
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;
93 static std::string
exec(std::string cmd);
99 static void abort(std::string msg);
105 static void abort(std::exception& ex);
200 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);
206 const std::string PRE =
"[B15F] ";
207 constexpr
static uint8_t MSG_OK = 0xFF;
208 constexpr
static uint8_t MSG_FAIL = 0xFE;
209 constexpr
static uint16_t RECONNECT_TIMEOUT = 64;
210 constexpr
static uint16_t WDT_TIMEOUT = 15;
211 constexpr
static uint8_t RECONNECT_TRIES = 3;
212 constexpr
static uint32_t BAUDRATE = 57600;
217 static B15F* instance;
218 static errorhandler_t errorhandler;
221 constexpr
static uint8_t RQ_DISC = 0;
222 constexpr
static uint8_t RQ_TEST = 1;
223 constexpr
static uint8_t RQ_INFO = 2;
224 constexpr
static uint8_t RQ_INT = 3;
225 constexpr
static uint8_t RQ_ST = 4;
226 constexpr
static uint8_t RQ_BA0 = 5;
227 constexpr
static uint8_t RQ_BA1 = 6;
228 constexpr
static uint8_t RQ_BE0 = 7;
229 constexpr
static uint8_t RQ_BE1 = 8;
230 constexpr
static uint8_t RQ_DSW = 9;
231 constexpr
static uint8_t RQ_AA0 = 10;
232 constexpr
static uint8_t RQ_AA1 = 11;
233 constexpr
static uint8_t RQ_ADC = 12;
234 constexpr
static uint8_t RQ_ADC_DAC_STROKE = 13;
+ 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;
87 static std::string
exec(std::string cmd);
93 static void abort(std::string msg);
99 static void abort(std::exception& ex);
193 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);
199 const std::string PRE =
"[B15F] ";
200 constexpr
static uint8_t MSG_OK = 0xFF;
201 constexpr
static uint8_t MSG_FAIL = 0xFE;
202 constexpr
static uint16_t RECONNECT_TIMEOUT = 64;
203 constexpr
static uint16_t WDT_TIMEOUT = 15;
204 constexpr
static uint8_t RECONNECT_TRIES = 3;
205 constexpr
static uint32_t BAUDRATE = 57600;
216 static B15F* instance;
217 static errorhandler_t errorhandler;
220 constexpr
static uint8_t RQ_DISC = 0;
221 constexpr
static uint8_t RQ_TEST = 1;
222 constexpr
static uint8_t RQ_INFO = 2;
223 constexpr
static uint8_t RQ_INT = 3;
224 constexpr
static uint8_t RQ_ST = 4;
225 constexpr
static uint8_t RQ_BA0 = 5;
226 constexpr
static uint8_t RQ_BA1 = 6;
227 constexpr
static uint8_t RQ_BE0 = 7;
228 constexpr
static uint8_t RQ_BE1 = 8;
229 constexpr
static uint8_t RQ_DSW = 9;
230 constexpr
static uint8_t RQ_AA0 = 10;
231 constexpr
static uint8_t RQ_AA1 = 11;
232 constexpr
static uint8_t RQ_ADC = 12;
233 constexpr
static uint8_t RQ_ADC_DAC_STROKE = 13;
static std::string exec(std::string cmd)
void delay_us(uint16_t us)
uint8_t digitalRead0(void)
-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)
Komplexe Analoge Sequenz DAC 0 wird auf den Startwert gesetzt und dann schrittweise um Delta inkremen...
+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)
@@ -88,7 +88,6 @@ $(function() {
bool activateSelfTestMode(void)
std::vector< std::string > getBoardInfo(void)
bool digitalWrite1(uint8_t)
-
bool analogWrite0(uint16_t)
uint8_t digitalRead1(void)
diff --git a/docs/html/classB15F-members.html b/docs/html/classB15F-members.html
index cd747d3..6ad79a3 100644
--- a/docs/html/classB15F-members.html
+++ b/docs/html/classB15F-members.html
@@ -87,18 +87,17 @@ $(function() {
exec(std::string cmd) | B15F | static |
getBoardInfo(void) | B15F | |
getInstance(void) | B15F | static |
- init(void) | B15F | |
- MSG_FAIL (defined in B15F) | B15F | static |
- MSG_OK (defined in B15F) | B15F | static |
- PRE (defined in B15F) | B15F | |
- readDipSwitch(void) | B15F | |
- reconnect(void) | B15F | |
- RECONNECT_TIMEOUT (defined in B15F) | B15F | static |
- RECONNECT_TRIES (defined in B15F) | B15F | static |
- setAbortHandler(errorhandler_t func) | B15F | static |
- testConnection(void) | B15F | |
- testIntConv(void) | B15F | |
- WDT_TIMEOUT (defined in B15F) | B15F | static |
+ MSG_FAIL (defined in B15F) | B15F | static |
+ MSG_OK (defined in B15F) | B15F | static |
+ PRE (defined in B15F) | B15F | |
+ readDipSwitch(void) | B15F | |
+ reconnect(void) | B15F | |
+ RECONNECT_TIMEOUT (defined in B15F) | B15F | static |
+ RECONNECT_TRIES (defined in B15F) | B15F | static |
+ setAbortHandler(errorhandler_t func) | B15F | static |
+ testConnection(void) | B15F | |
+ testIntConv(void) | B15F | |
+ WDT_TIMEOUT (defined in B15F) | B15F | static |