B15F
Board 15 Famulus Edition
b15f.cpp
1 #include "b15f.h"
2 
3 B15F *B15F::instance = nullptr;
4 errorhandler_t B15F::errorhandler = nullptr;
5 
6 
7 /*************************************
8  * Grundfunktionen des B15F Treibers *
9  *************************************/
10 
12 {
13  if (!instance)
14  instance = new B15F();
15 
16  return *instance;
17 }
18 
19 void B15F::reconnect()
20 {
21  uint8_t tries = RECONNECT_TRIES;
22  while (tries--)
23  {
25  discard();
26 
27  try
28  {
30  return; // no exceptionm means success
31  }
32  catch(DriverException& eDE)
33  {
34  // discard exception
35  }
36  }
37 
38  abort("Verbindung kann nicht repariert werden");
39 }
40 
41 void B15F::discard(void)
42 {
43  try
44  {
45  uint8_t rq[] =
46  {
47  RQ_DISCARD
48  };
49 
50  usart.clearOutputBuffer();
51  for (uint8_t i = 0; i < 16; i++)
52  {
53  usart.transmit(&rq[0], 0, sizeof(rq)); // sende discard Befehl (verwerfe input)
54  delay_ms(4);
55  }
56  usart.clearInputBuffer();
57  }
58  catch (std::exception &ex)
59  {
60  abort(ex);
61  }
62 }
63 
65 {
66  // erzeuge zufälliges Byte
67  srand(time(NULL));
68  uint8_t dummy = rand() % 256;
69 
70  uint8_t rq[] =
71  {
72  RQ_TEST,
73  dummy
74  };
75 
76  assertRequestLength(rq, RQ_TEST);
77  usart.transmit(&rq[0], 0, sizeof(rq));
78 
79  uint8_t aw[2];
80  usart.receive(&aw[0], 0, sizeof(aw));
81 
82  assertCode(aw[0], MSG_OK);
83  assertCode(aw[1], dummy);
84 }
85 
86 void B15F::testIntConv()
87 {
88  srand(time(NULL));
89  uint16_t dummy = rand() % (0xFFFF / 3);
90 
91  uint8_t rq[] =
92  {
93  RQ_INT_TEST,
94  static_cast<uint8_t >(dummy & 0xFF),
95  static_cast<uint8_t >(dummy >> 8)
96  };
97 
98  assertRequestLength(rq, RQ_INT_TEST);
99  usart.transmit(&rq[0], 0, sizeof(rq));
100 
101  uint16_t aw;
102  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
103 
104  assertCode(aw, dummy * 3);
105 }
106 
107 
108 std::vector<std::string> B15F::getBoardInfo(void)
109 {
110  std::vector<std::string> info;
111 
112  uint8_t rq[] =
113  {
114  RQ_INFO
115  };
116 
117  assertRequestLength(rq, RQ_INFO);
118  usart.transmit(&rq[0], 0, sizeof(rq));
119 
120  uint8_t n;
121  usart.receive(&n, 0, sizeof(n));
122  while (n--)
123  {
124  uint8_t len;
125  usart.receive(&len, 0, sizeof(len));
126 
127  char str[len + 1];
128  usart.receive(reinterpret_cast<uint8_t *>(&str[0]), 0, len);
129  str[len] = '\0';
130 
131  info.push_back(std::string(str));
132  }
133 
134  uint8_t aw;
135  usart.receive(&aw, 0, sizeof(aw));
136  if (aw != MSG_OK)
137  abort("Board Info fehlerhalft: code " + std::to_string((int) aw));
138 
139  return info;
140 }
141 
142 void B15F::delay_ms(uint16_t ms)
143 {
144  std::this_thread::sleep_for(std::chrono::milliseconds(ms));
145 }
146 
147 void B15F::delay_us(uint16_t us)
148 {
149  std::this_thread::sleep_for(std::chrono::microseconds(us));
150 }
151 
152 void B15F::reverse(uint8_t& b)
153 {
154  b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
155  b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
156  b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
157 }
158 
159 // https://stackoverflow.com/a/478960
160 std::string B15F::exec(std::string cmd)
161 {
162  std::array<char, 128> buffer;
163  std::string result;
164  std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), pclose);
165  if (!pipe)
166  {
167  throw std::runtime_error("popen() failed!");
168  }
169  while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr)
170  {
171  result += buffer.data();
172  }
173  return result;
174 }
175 
176 void B15F::abort(std::string msg)
177 {
178  DriverException ex(msg);
179  abort(ex);
180 }
181 
182 void B15F::abort(std::exception &ex)
183 {
184  if (errorhandler)
185  errorhandler(ex);
186  else
187  {
188  std::cout << ex.what() << std::endl;
189  throw DriverException(ex.what());
190  }
191 }
192 
193 void B15F::setAbortHandler(errorhandler_t func)
194 {
195  errorhandler = func;
196 }
197 
198 /*************************************/
199 
200 
201 
202 /*************************
203  * Steuerbefehle für B15 *
204  *************************/
205 
207 {
208  uint8_t rq[] =
209  {
210  RQ_SELF_TEST
211  };
212 
213  assertRequestLength(rq, RQ_SELF_TEST);
214  usart.transmit(&rq[0], 0, sizeof(rq));
215 
216  uint8_t aw;
217  usart.receive(&aw, 0, sizeof(aw));
218  assertCode(aw, MSG_OK);
219 }
220 
221 void B15F::digitalWrite0(uint8_t port)
222 {
223  uint8_t rq[] =
224  {
225  RQ_DIGITAL_WRITE_0,
226  port
227  };
228 
229  assertRequestLength(rq, RQ_DIGITAL_WRITE_0);
230  usart.transmit(&rq[0], 0, sizeof(rq));
231 
232  uint8_t aw;
233  usart.receive(&aw, 0, sizeof(aw));
234  assertCode(aw, MSG_OK);
235 }
236 
237 void B15F::digitalWrite1(uint8_t port)
238 {
239  uint8_t rq[] =
240  {
241  RQ_DIGITAL_WRITE_1,
242  port
243  };
244 
245  assertRequestLength(rq, RQ_DIGITAL_WRITE_1);
246  usart.transmit(&rq[0], 0, sizeof(rq));
247 
248  uint8_t aw;
249  usart.receive(&aw, 0, sizeof(aw));
250  assertCode(aw, MSG_OK);
251 }
252 
253 uint8_t B15F::digitalRead0()
254 {
255  usart.clearInputBuffer();
256  uint8_t rq[] =
257  {
258  RQ_DIGITAL_READ_0
259  };
260 
261  assertRequestLength(rq, RQ_DIGITAL_READ_0);
262  usart.transmit(&rq[0], 0, sizeof(rq));
263 
264  uint8_t aw;
265  usart.receive(&aw, 0, sizeof(aw));
266  return aw;
267 }
268 
269 uint8_t B15F::digitalRead1()
270 {
271  usart.clearInputBuffer();
272  uint8_t rq[] =
273  {
274  RQ_DIGITAL_READ_1
275  };
276 
277  assertRequestLength(rq, RQ_DIGITAL_READ_1);
278  usart.transmit(&rq[0], 0, sizeof(rq));
279 
280  uint8_t aw;
281  usart.receive(&aw, 0, sizeof(aw));
282  return aw;
283 }
284 
285 uint8_t B15F::readDipSwitch()
286 {
287  usart.clearInputBuffer();
288  uint8_t rq[] =
289  {
290  RQ_READ_DIP_SWITCH
291  };
292 
293  assertRequestLength(rq, RQ_READ_DIP_SWITCH);
294  usart.transmit(&rq[0], 0, sizeof(rq));
295 
296  uint8_t aw;
297  usart.receive(&aw, 0, sizeof(aw));
298 
299  reverse(aw); // DIP Schalter muss invertiert werden!
300 
301  return aw;
302 }
303 
304 void B15F::analogWrite0(uint16_t value)
305 {
306  uint8_t rq[] =
307  {
308  RQ_ANALOG_WRITE_0,
309  static_cast<uint8_t >(value & 0xFF),
310  static_cast<uint8_t >(value >> 8)
311  };
312 
313  assertRequestLength(rq, RQ_ANALOG_WRITE_0);
314  usart.transmit(&rq[0], 0, sizeof(rq));
315 
316  uint8_t aw;
317  usart.receive(&aw, 0, sizeof(aw));
318  assertCode(aw, MSG_OK);
319 }
320 
321 void B15F::analogWrite1(uint16_t value)
322 {
323  uint8_t rq[] =
324  {
325  RQ_ANALOG_WRITE_1,
326  static_cast<uint8_t >(value & 0xFF),
327  static_cast<uint8_t >(value >> 8)
328  };
329 
330  assertRequestLength(rq, RQ_ANALOG_WRITE_1);
331  usart.transmit(&rq[0], 0, sizeof(rq));
332 
333  uint8_t aw;
334  usart.receive(&aw, 0, sizeof(aw));
335  assertCode(aw, MSG_OK);
336 }
337 
338 uint16_t B15F::analogRead(uint8_t channel)
339 {
340  usart.clearInputBuffer();
341  if (channel > 7)
342  abort("Bad ADC channel: " + std::to_string(channel));
343 
344  uint8_t rq[] =
345  {
346  RQ_ANALOG_READ,
347  channel
348  };
349 
350  assertRequestLength(rq, RQ_ANALOG_READ);
351  usart.transmit(&rq[0], 0, sizeof(rq));
352 
353  uint16_t aw;
354  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
355 
356  if (aw > 1023)
357  abort("Bad ADC data detected (1)");
358  return aw;
359 }
360 
361 void B15F::analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b,
362  uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
363 {
364  // prepare pointers
365  buffer_a += offset_a;
366  buffer_b += offset_b;
367 
368 
369  usart.clearInputBuffer();
370  uint8_t rq[] =
371  {
372  RQ_ADC_DAC_STROKE,
373  channel_a,
374  channel_b,
375  static_cast<uint8_t >(start & 0xFF),
376  static_cast<uint8_t >(start >> 8),
377  static_cast<uint8_t >(delta & 0xFF),
378  static_cast<uint8_t >(delta >> 8),
379  static_cast<uint8_t >(count & 0xFF),
380  static_cast<uint8_t >(count >> 8)
381  };
382 
383  assertRequestLength(rq, RQ_ADC_DAC_STROKE);
384  usart.transmit(&rq[0], 0, sizeof(rq));
385 
386  for (uint16_t i = 0; i < count; i++)
387  {
388  if (buffer_a)
389  {
390  usart.receive(reinterpret_cast<uint8_t *>(&buffer_a[i]), 0, 2);
391 
392  if (buffer_a[i] > 1023) // check for broken usart connection
393  abort("Bad ADC data detected (2)");
394  }
395  else
396  {
397  usart.drop(2);
398  }
399 
400  if (buffer_b)
401  {
402  usart.receive(reinterpret_cast<uint8_t *>(&buffer_b[i]), 0, 2);
403 
404  if (buffer_b[i] > 1023) // check for broken usart connection
405  abort("Bad ADC data detected (3)");
406  }
407  else
408  {
409  usart.drop(2);
410  }
411  }
412 
413  uint8_t aw;
414  usart.receive(&aw, 0, sizeof(aw));
415  assertCode(aw, MSG_OK);
416 }
417 
418 uint8_t B15F::pwmSetFrequency(uint32_t freq)
419 {
420  usart.clearInputBuffer();
421 
422  uint8_t rq[] =
423  {
424  RQ_PWM_SET_FREQ,
425  static_cast<uint8_t>((freq >> 0) & 0xFF),
426  static_cast<uint8_t>((freq >> 8) & 0xFF),
427  static_cast<uint8_t>((freq >> 16) & 0xFF),
428  static_cast<uint8_t>((freq >> 24) & 0xFF)
429  };
430 
431  assertRequestLength(rq, RQ_PWM_SET_FREQ);
432  usart.transmit(&rq[0], 0, sizeof(rq));
433 
434  uint8_t aw;
435  usart.receive(&aw, 0, sizeof(aw));
436  return aw;
437 }
438 
439 void B15F::pwmSetValue(uint8_t value)
440 {
441  usart.clearInputBuffer();
442 
443  uint8_t rq[] =
444  {
445  RQ_PWM_SET_VALUE,
446  value
447  };
448 
449  assertRequestLength(rq, RQ_PWM_SET_VALUE);
450  usart.transmit(&rq[0], 0, sizeof(rq));
451 
452  uint8_t aw;
453  usart.receive(&aw, 0, sizeof(aw));
454  assertCode(aw, MSG_OK);
455 }
456 
457 void B15F::setMem8(volatile uint8_t* adr, uint8_t val)
458 {
459  usart.clearInputBuffer();
460 
461  uint8_t rq[] =
462  {
463  RQ_SET_MEM_8,
464  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) & 0xFF),
465  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8),
466  val
467  };
468 
469  assertRequestLength(rq, RQ_SET_MEM_8);
470  usart.transmit(&rq[0], 0, sizeof(rq));
471 
472  uint8_t aw;
473  usart.receive(&aw, 0, sizeof(aw));
474  assertCode(aw, MSG_OK);
475 }
476 
477 uint8_t B15F::getMem8(volatile uint8_t* adr)
478 {
479  usart.clearInputBuffer();
480 
481  uint8_t rq[] =
482  {
483  RQ_GET_MEM_8,
484  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) & 0xFF),
485  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8)
486  };
487 
488  assertRequestLength(rq, RQ_GET_MEM_8);
489  usart.transmit(&rq[0], 0, sizeof(rq));
490 
491  uint8_t aw;
492  usart.receive(&aw, 0, sizeof(aw));
493  return aw;
494 }
495 
496 void B15F::setMem16(volatile uint16_t* adr, uint16_t val)
497 {
498  usart.clearInputBuffer();
499 
500  uint8_t rq[] =
501  {
502  RQ_SET_MEM_16,
503  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) & 0xFF),
504  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8),
505  static_cast<uint8_t >(val & 0xFF),
506  static_cast<uint8_t >(val >> 8)
507  };
508 
509  assertRequestLength(rq, RQ_SET_MEM_16);
510  usart.transmit(&rq[0], 0, sizeof(rq));
511 
512  uint16_t aw;
513  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
514  assertCode(aw, MSG_OK);
515 }
516 
517 uint16_t B15F::getMem16(volatile uint16_t* adr)
518 {
519  usart.clearInputBuffer();
520 
521  uint8_t rq[] =
522  {
523  RQ_GET_MEM_16,
524  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) & 0xFF),
525  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8)
526  };
527 
528  assertRequestLength(rq, RQ_GET_MEM_16);
529  usart.transmit(&rq[0], 0, sizeof(rq));
530 
531  uint16_t aw;
532  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
533  return aw;
534 }
535 
536 void B15F::setRegister(volatile uint8_t* adr, uint8_t val)
537 {
538  setMem8(adr, val);
539 }
540 
541 uint8_t B15F::getRegister(volatile uint8_t* adr)
542 {
543  return getMem8(adr);
544 }
545 
547 {
548  usart.clearInputBuffer();
549 
550  uint8_t rq[] =
551  {
552  RQ_COUNTER_OFFSET
553  };
554 
555  assertRequestLength(rq, RQ_COUNTER_OFFSET);
556  usart.transmit(&rq[0], 0, sizeof(rq));
557 
558  uint16_t aw;
559  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
560  return reinterpret_cast<uint16_t*>(aw);
561 }
562 
563 void B15F::setServoEnabled(void)
564 {
565  usart.clearInputBuffer();
566 
567  uint8_t rq[] =
568  {
569  RQ_SERVO_ENABLE
570  };
571 
572  assertRequestLength(rq, RQ_SERVO_ENABLE);
573  usart.transmit(&rq[0], 0, sizeof(rq));
574 
575  uint8_t aw;
576  usart.receive(&aw, 0, sizeof(aw));
577  assertCode(aw, MSG_OK);
578 }
579 
580 void B15F::setServoDisabled(void)
581 {
582  usart.clearInputBuffer();
583 
584  uint8_t rq[] =
585  {
586  RQ_SERVO_DISABLE
587  };
588 
589  assertRequestLength(rq, RQ_SERVO_DISABLE);
590  usart.transmit(&rq[0], 0, sizeof(rq));
591 
592  uint8_t aw;
593  usart.receive(&aw, 0, sizeof(aw));
594  assertCode(aw, MSG_OK);
595 }
596 
597 void B15F::setServoPosition(uint16_t pos)
598 {
599  if(pos > 19000)
600  throw DriverException("Impulslänge ist zu lang: " + std::to_string(pos));
601 
602  usart.clearInputBuffer();
603 
604  uint8_t rq[] =
605  {
606  RQ_SERVO_SET_POS,
607  static_cast<uint8_t >(pos & 0xFF),
608  static_cast<uint8_t >(pos >> 8)
609  };
610 
611  assertRequestLength(rq, RQ_SERVO_SET_POS);
612  usart.transmit(&rq[0], 0, sizeof(rq));
613 
614  uint8_t aw;
615  usart.receive(&aw, 0, sizeof(aw));
616  assertCode(aw, MSG_OK);
617 }
618 
619 /*************************/
620 
621 
622 /**********************
623  * Private Funktionen *
624  **********************/
625 
626 B15F::B15F()
627 {
628  init();
629 }
630 
631 
632 void B15F::init()
633 {
634 
635 #ifdef __arm__
636  // Raspberry Pi serial interface
637  std::string device = exec("bash -c 'ls /dev/ttyAMA* 2> /dev/null'");
638 #else
639  // normal PC serial interface
640  std::string device = exec("bash -c 'ls /dev/ttyUSB* 2> /dev/null'");
641 #endif
642 
643  while (device.find(' ') != std::string::npos || device.find('\n') != std::string::npos ||
644  device.find('\t') != std::string::npos)
645  device.pop_back();
646 
647  if (device.length() == 0)
648  abort("Adapter nicht gefunden");
649 
650  std::cout << PRE << "Verwende Adapter: " << device << std::endl;
651 
652 
653  std::cout << PRE << "Stelle Verbindung mit Adapter her... " << std::flush;
654  usart.setBaudrate(BAUDRATE);
655  usart.openDevice(device);
656  std::cout << "OK" << std::endl;
657 
658 
659  std::cout << PRE << "Teste Verbindung... " << std::flush;
660  int tries = 4;
661  while (--tries)
662  {
663  discard();
664 
665  try
666  {
667  testConnection();
668  }
669  catch(DriverException& eDE)
670  {
671  continue;
672  }
673 
674  try
675  {
676  testIntConv();
677  }
678  catch(DriverException& eDE)
679  {
680  continue;
681  }
682 
683  break;
684  }
685  if (!tries)
686  abort("Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?");
687 
688  std::cout << "OK" << std::endl;
689 
690 
691  // Gib board info aus
692  std::vector<std::string> info = getBoardInfo();
693  std::cout << PRE << "AVR Firmware Version: " << info[0] << " um " << info[1] << " Uhr (" << info[2] << ")"
694  << std::endl;
695 
696  // Überprüfe Version
697  std::string& avr_commit_hash = info[3];
698  if(avr_commit_hash.compare(COMMIT_HASH))
699  {
700  std::cout << PRE << "Unterschiedliche commit hashes: " << std::endl;
701  std::cout << std::string(PRE.length(), ' ') << "AVR: " << avr_commit_hash << std::endl;
702  std::cout << std::string(PRE.length(), ' ') << "Control: " << COMMIT_HASH << std::endl << std::endl;
703  abort("Versionen inkompatibel. Bitte Software aktualisieren!");
704  }
705 }
B15F::testIntConv
void testIntConv(void)
Definition: b15f.cpp:85
B15F::pwmSetValue
void pwmSetValue(uint8_t value)
Definition: b15f.cpp:437
B15F::exec
static std::string exec(std::string cmd)
Definition: b15f.cpp:159
B15F::analogWrite0
void analogWrite0(uint16_t port)
Definition: b15f.cpp:302
B15F::setServoPosition
void setServoPosition(uint16_t pos)
Definition: b15f.cpp:595
B15F::analogWrite1
void analogWrite1(uint16_t port)
Definition: b15f.cpp:319
B15F::getMem16
uint16_t getMem16(volatile uint16_t *adr)
Definition: b15f.cpp:515
B15F::delay_us
void delay_us(uint16_t us)
Definition: b15f.cpp:146
B15F::digitalRead0
uint8_t digitalRead0(void)
Definition: b15f.cpp:251
B15F::pwmSetFrequency
uint8_t pwmSetFrequency(uint32_t freq)
Definition: b15f.cpp:416
B15F::digitalWrite0
void digitalWrite0(uint8_t)
Definition: b15f.cpp:219
B15F::analogSequence
void analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
Definition: b15f.cpp:359
B15F::readDipSwitch
uint8_t readDipSwitch(void)
Definition: b15f.cpp:283
B15F::getRegister
uint8_t getRegister(volatile uint8_t *adr)
Definition: b15f.cpp:539
B15F::getMem8
uint8_t getMem8(volatile uint8_t *adr)
Definition: b15f.cpp:475
B15F::delay_ms
void delay_ms(uint16_t ms)
Definition: b15f.cpp:141
B15F::testConnection
void testConnection(void)
Definition: b15f.cpp:63
B15F::getInstance
static B15F & getInstance(void)
Definition: b15f.cpp:10
B15F
Definition: b15f.h:38
USART::transmit
void transmit(uint8_t *buffer, uint16_t offset, uint8_t len)
Definition: usart.cpp:75
B15F::abort
static void abort(std::string msg)
Definition: b15f.cpp:175
USART::receive
void receive(uint8_t *buffer, uint16_t offset, uint8_t len)
Definition: usart.cpp:84
USART::clearInputBuffer
void clearInputBuffer(void)
Definition: usart.cpp:54
B15F::getInterruptCounterOffset
uint16_t * getInterruptCounterOffset(void)
Definition: b15f.cpp:544
B15F::setMem16
void setMem16(volatile uint16_t *adr, uint16_t val)
Definition: b15f.cpp:494
USART::clearOutputBuffer
void clearOutputBuffer(void)
Definition: usart.cpp:61
B15F::analogRead
uint16_t analogRead(uint8_t channel)
Definition: b15f.cpp:336
B15F::activateSelfTestMode
void activateSelfTestMode(void)
Definition: b15f.cpp:204
B15F::PRE
const std::string PRE
B15F stdout prefix.
Definition: b15f.h:310
B15F::reverse
void reverse(uint8_t &b)
Definition: b15f.cpp:151
USART::setBaudrate
void setBaudrate(uint32_t baudrate)
Definition: usart.cpp:131
B15F::getBoardInfo
std::vector< std::string > getBoardInfo(void)
Definition: b15f.cpp:107
B15F::RECONNECT_TIMEOUT
constexpr static uint16_t RECONNECT_TIMEOUT
Time in ms after which a reconnect attempt aborts.
Definition: b15f.h:313
B15F::discard
void discard(void)
Definition: b15f.cpp:40
B15F::setRegister
void setRegister(volatile uint8_t *adr, uint8_t val)
Definition: b15f.cpp:534
B15F::MSG_OK
constexpr static uint8_t MSG_OK
Value to acknowledge a received command.
Definition: b15f.h:311
USART::openDevice
void openDevice(std::string device)
Definition: usart.cpp:9
B15F::digitalRead1
uint8_t digitalRead1(void)
Definition: b15f.cpp:267
B15F::reconnect
void reconnect(void)
Definition: b15f.cpp:18
B15F::BAUDRATE
constexpr static uint32_t BAUDRATE
USART baudrate for communication with the MCU.
Definition: b15f.h:316
B15F::setAbortHandler
static void setAbortHandler(errorhandler_t func)
Definition: b15f.cpp:192
USART::drop
void drop(uint8_t len)
Definition: usart.cpp:114
B15F::digitalWrite1
void digitalWrite1(uint8_t)
Definition: b15f.cpp:235
B15F::setServoEnabled
void setServoEnabled(void)
Definition: b15f.cpp:561
B15F::RECONNECT_TRIES
constexpr static uint8_t RECONNECT_TRIES
Maximum count of reconnect attempts after which the driver stops.
Definition: b15f.h:315
B15F::setMem8
void setMem8(volatile uint8_t *adr, uint8_t val)
Definition: b15f.cpp:455
B15F::setServoDisabled
void setServoDisabled(void)
Definition: b15f.cpp:578
DriverException
Definition: driverexception.h:10