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  reverse(port); // port ist invertiert
224 
225  uint8_t rq[] =
226  {
227  RQ_DIGITAL_WRITE_0,
228  port
229  };
230 
231  assertRequestLength(rq, RQ_DIGITAL_WRITE_0);
232  usart.transmit(&rq[0], 0, sizeof(rq));
233 
234  uint8_t aw;
235  usart.receive(&aw, 0, sizeof(aw));
236  assertCode(aw, MSG_OK);
237 }
238 
239 void B15F::digitalWrite1(uint8_t port)
240 {
241  reverse(port); // port ist invertiert
242 
243  uint8_t rq[] =
244  {
245  RQ_DIGITAL_WRITE_1,
246  port
247  };
248 
249  assertRequestLength(rq, RQ_DIGITAL_WRITE_1);
250  usart.transmit(&rq[0], 0, sizeof(rq));
251 
252  uint8_t aw;
253  usart.receive(&aw, 0, sizeof(aw));
254  assertCode(aw, MSG_OK);
255 }
256 
257 uint8_t B15F::digitalRead0()
258 {
259  usart.clearInputBuffer();
260  uint8_t rq[] =
261  {
262  RQ_DIGITAL_READ_0
263  };
264 
265  assertRequestLength(rq, RQ_DIGITAL_READ_0);
266  usart.transmit(&rq[0], 0, sizeof(rq));
267 
268  uint8_t aw;
269  usart.receive(&aw, 0, sizeof(aw));
270 
271  reverse(aw); // port ist invertiert
272 
273  return aw;
274 }
275 
276 uint8_t B15F::digitalRead1()
277 {
278  usart.clearInputBuffer();
279  uint8_t rq[] =
280  {
281  RQ_DIGITAL_READ_1
282  };
283 
284  assertRequestLength(rq, RQ_DIGITAL_READ_1);
285  usart.transmit(&rq[0], 0, sizeof(rq));
286 
287  uint8_t aw;
288  usart.receive(&aw, 0, sizeof(aw));
289 
290  reverse(aw); // port ist invertiert
291 
292  return aw;
293 }
294 
295 uint8_t B15F::readDipSwitch()
296 {
297  usart.clearInputBuffer();
298  uint8_t rq[] =
299  {
300  RQ_READ_DIP_SWITCH
301  };
302 
303  assertRequestLength(rq, RQ_READ_DIP_SWITCH);
304  usart.transmit(&rq[0], 0, sizeof(rq));
305 
306  uint8_t aw;
307  usart.receive(&aw, 0, sizeof(aw));
308 
309  reverse(aw); // DIP Schalter ist invertiert
310 
311  return aw;
312 }
313 
314 void B15F::analogWrite0(uint16_t value)
315 {
316  uint8_t rq[] =
317  {
318  RQ_ANALOG_WRITE_0,
319  static_cast<uint8_t >(value & 0xFF),
320  static_cast<uint8_t >(value >> 8)
321  };
322 
323  assertRequestLength(rq, RQ_ANALOG_WRITE_0);
324  usart.transmit(&rq[0], 0, sizeof(rq));
325 
326  uint8_t aw;
327  usart.receive(&aw, 0, sizeof(aw));
328  assertCode(aw, MSG_OK);
329 }
330 
331 void B15F::analogWrite1(uint16_t value)
332 {
333  uint8_t rq[] =
334  {
335  RQ_ANALOG_WRITE_1,
336  static_cast<uint8_t >(value & 0xFF),
337  static_cast<uint8_t >(value >> 8)
338  };
339 
340  assertRequestLength(rq, RQ_ANALOG_WRITE_1);
341  usart.transmit(&rq[0], 0, sizeof(rq));
342 
343  uint8_t aw;
344  usart.receive(&aw, 0, sizeof(aw));
345  assertCode(aw, MSG_OK);
346 }
347 
348 uint16_t B15F::analogRead(uint8_t channel)
349 {
350  usart.clearInputBuffer();
351  if (channel > 7)
352  abort("Bad ADC channel: " + std::to_string(channel));
353 
354  uint8_t rq[] =
355  {
356  RQ_ANALOG_READ,
357  channel
358  };
359 
360  assertRequestLength(rq, RQ_ANALOG_READ);
361  usart.transmit(&rq[0], 0, sizeof(rq));
362 
363  uint16_t aw;
364  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
365 
366  if (aw > 1023)
367  abort("Bad ADC data detected (1)");
368  return aw;
369 }
370 
371 void B15F::analogSequence(uint8_t channel_a, uint16_t *buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t *buffer_b,
372  uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
373 {
374  // prepare pointers
375  buffer_a += offset_a;
376  buffer_b += offset_b;
377 
378 
379  usart.clearInputBuffer();
380  uint8_t rq[] =
381  {
382  RQ_ADC_DAC_STROKE,
383  channel_a,
384  channel_b,
385  static_cast<uint8_t >(start & 0xFF),
386  static_cast<uint8_t >(start >> 8),
387  static_cast<uint8_t >(delta & 0xFF),
388  static_cast<uint8_t >(delta >> 8),
389  static_cast<uint8_t >(count & 0xFF),
390  static_cast<uint8_t >(count >> 8)
391  };
392 
393  assertRequestLength(rq, RQ_ADC_DAC_STROKE);
394  usart.transmit(&rq[0], 0, sizeof(rq));
395 
396  for (uint16_t i = 0; i < count; i++)
397  {
398  if (buffer_a)
399  {
400  usart.receive(reinterpret_cast<uint8_t *>(&buffer_a[i]), 0, 2);
401 
402  if (buffer_a[i] > 1023) // check for broken usart connection
403  abort("Bad ADC data detected (2)");
404  }
405  else
406  {
407  usart.drop(2);
408  }
409 
410  if (buffer_b)
411  {
412  usart.receive(reinterpret_cast<uint8_t *>(&buffer_b[i]), 0, 2);
413 
414  if (buffer_b[i] > 1023) // check for broken usart connection
415  abort("Bad ADC data detected (3)");
416  }
417  else
418  {
419  usart.drop(2);
420  }
421  }
422 
423  uint8_t aw;
424  usart.receive(&aw, 0, sizeof(aw));
425  assertCode(aw, MSG_OK);
426 }
427 
428 uint8_t B15F::pwmSetFrequency(uint32_t freq)
429 {
430  usart.clearInputBuffer();
431 
432  uint8_t rq[] =
433  {
434  RQ_PWM_SET_FREQ,
435  static_cast<uint8_t>((freq >> 0) & 0xFF),
436  static_cast<uint8_t>((freq >> 8) & 0xFF),
437  static_cast<uint8_t>((freq >> 16) & 0xFF),
438  static_cast<uint8_t>((freq >> 24) & 0xFF)
439  };
440 
441  assertRequestLength(rq, RQ_PWM_SET_FREQ);
442  usart.transmit(&rq[0], 0, sizeof(rq));
443 
444  uint8_t aw;
445  usart.receive(&aw, 0, sizeof(aw));
446  return aw;
447 }
448 
449 void B15F::pwmSetValue(uint8_t value)
450 {
451  usart.clearInputBuffer();
452 
453  uint8_t rq[] =
454  {
455  RQ_PWM_SET_VALUE,
456  value
457  };
458 
459  assertRequestLength(rq, RQ_PWM_SET_VALUE);
460  usart.transmit(&rq[0], 0, sizeof(rq));
461 
462  uint8_t aw;
463  usart.receive(&aw, 0, sizeof(aw));
464  assertCode(aw, MSG_OK);
465 }
466 
467 void B15F::setMem8(volatile uint8_t* adr, uint8_t val)
468 {
469  usart.clearInputBuffer();
470 
471  uint8_t rq[] =
472  {
473  RQ_SET_MEM_8,
474  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) & 0xFF),
475  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8),
476  val
477  };
478 
479  assertRequestLength(rq, RQ_SET_MEM_8);
480  usart.transmit(&rq[0], 0, sizeof(rq));
481 
482  uint8_t aw;
483  usart.receive(&aw, 0, sizeof(aw));
484  assertCode(aw, val);
485 }
486 
487 uint8_t B15F::getMem8(volatile uint8_t* adr)
488 {
489  usart.clearInputBuffer();
490 
491  uint8_t rq[] =
492  {
493  RQ_GET_MEM_8,
494  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) & 0xFF),
495  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8)
496  };
497 
498  assertRequestLength(rq, RQ_GET_MEM_8);
499  usart.transmit(&rq[0], 0, sizeof(rq));
500 
501  uint8_t aw;
502  usart.receive(&aw, 0, sizeof(aw));
503  return aw;
504 }
505 
506 void B15F::setMem16(volatile uint16_t* adr, uint16_t val)
507 {
508  usart.clearInputBuffer();
509 
510  uint8_t rq[] =
511  {
512  RQ_SET_MEM_16,
513  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) & 0xFF),
514  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8),
515  static_cast<uint8_t >(val & 0xFF),
516  static_cast<uint8_t >(val >> 8)
517  };
518 
519  assertRequestLength(rq, RQ_SET_MEM_16);
520  usart.transmit(&rq[0], 0, sizeof(rq));
521 
522  uint16_t aw;
523  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
524  assertCode(aw, val);
525 }
526 
527 uint16_t B15F::getMem16(volatile uint16_t* adr)
528 {
529  usart.clearInputBuffer();
530 
531  uint8_t rq[] =
532  {
533  RQ_GET_MEM_16,
534  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) & 0xFF),
535  static_cast<uint8_t >(reinterpret_cast<size_t>(adr) >> 8)
536  };
537 
538  assertRequestLength(rq, RQ_GET_MEM_16);
539  usart.transmit(&rq[0], 0, sizeof(rq));
540 
541  uint16_t aw;
542  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
543  return aw;
544 }
545 
546 void B15F::setRegister(volatile uint8_t* adr, uint8_t val)
547 {
548  setMem8(adr, val);
549 }
550 
551 uint8_t B15F::getRegister(volatile uint8_t* adr)
552 {
553  return getMem8(adr);
554 }
555 
557 {
558  usart.clearInputBuffer();
559 
560  uint8_t rq[] =
561  {
562  RQ_COUNTER_OFFSET
563  };
564 
565  assertRequestLength(rq, RQ_COUNTER_OFFSET);
566  usart.transmit(&rq[0], 0, sizeof(rq));
567 
568  uint16_t aw;
569  usart.receive(reinterpret_cast<uint8_t *>(&aw), 0, sizeof(aw));
570  return reinterpret_cast<uint16_t*>(aw);
571 }
572 
573 void B15F::setServoEnabled(void)
574 {
575  usart.clearInputBuffer();
576 
577  uint8_t rq[] =
578  {
579  RQ_SERVO_ENABLE
580  };
581 
582  assertRequestLength(rq, RQ_SERVO_ENABLE);
583  usart.transmit(&rq[0], 0, sizeof(rq));
584 
585  uint8_t aw;
586  usart.receive(&aw, 0, sizeof(aw));
587  assertCode(aw, MSG_OK);
588 }
589 
590 void B15F::setServoDisabled(void)
591 {
592  usart.clearInputBuffer();
593 
594  uint8_t rq[] =
595  {
596  RQ_SERVO_DISABLE
597  };
598 
599  assertRequestLength(rq, RQ_SERVO_DISABLE);
600  usart.transmit(&rq[0], 0, sizeof(rq));
601 
602  uint8_t aw;
603  usart.receive(&aw, 0, sizeof(aw));
604  assertCode(aw, MSG_OK);
605 }
606 
607 void B15F::setServoPosition(uint16_t pos)
608 {
609  if(pos > 19000)
610  throw DriverException("Impulslänge ist zu lang: " + std::to_string(pos));
611 
612  usart.clearInputBuffer();
613 
614  uint8_t rq[] =
615  {
616  RQ_SERVO_SET_POS,
617  static_cast<uint8_t >(pos & 0xFF),
618  static_cast<uint8_t >(pos >> 8)
619  };
620 
621  assertRequestLength(rq, RQ_SERVO_SET_POS);
622  usart.transmit(&rq[0], 0, sizeof(rq));
623 
624  uint8_t aw;
625  usart.receive(&aw, 0, sizeof(aw));
626  assertCode(aw, MSG_OK);
627 }
628 
629 /*************************/
630 
631 
632 /**********************
633  * Private Funktionen *
634  **********************/
635 
636 B15F::B15F()
637 {
638  init();
639 }
640 
641 
642 void B15F::init()
643 {
644 
645 #ifdef __arm__
646  // Raspberry Pi serial interface
647  std::string device = exec("bash -c 'ls /dev/ttyAMA* 2> /dev/null'");
648 #else
649  // normal PC serial interface
650  std::string device = exec("bash -c 'ls /dev/ttyUSB* 2> /dev/null'");
651 #endif
652 
653  while (device.find(' ') != std::string::npos || device.find('\n') != std::string::npos ||
654  device.find('\t') != std::string::npos)
655  device.pop_back();
656 
657  if (device.length() == 0)
658  abort("Adapter nicht gefunden");
659 
660  std::cout << PRE << "Verwende Adapter: " << device << std::endl;
661 
662 
663  std::cout << PRE << "Stelle Verbindung mit Adapter her... " << std::flush;
664  usart.setBaudrate(BAUDRATE);
665  usart.openDevice(device);
666  std::cout << "OK" << std::endl;
667 
668 
669  std::cout << PRE << "Teste Verbindung... " << std::flush;
670  int tries = 4;
671  while (--tries)
672  {
673  discard();
674 
675  try
676  {
677  testConnection();
678  }
679  catch(DriverException& eDE)
680  {
681  continue;
682  }
683 
684  try
685  {
686  testIntConv();
687  }
688  catch(DriverException& eDE)
689  {
690  continue;
691  }
692 
693  break;
694  }
695  if (!tries)
696  abort("Verbindungstest fehlgeschlagen. Neueste Version im Einsatz?");
697 
698  std::cout << "OK" << std::endl;
699 
700 
701  // Gib board info aus
702  std::vector<std::string> info = getBoardInfo();
703  std::cout << PRE << "AVR Firmware Version: " << info[0] << " um " << info[1] << " Uhr (" << info[2] << ")"
704  << std::endl;
705 
706  // Überprüfe Version
707  std::string& avr_commit_hash = info[3];
708  if(avr_commit_hash.compare(COMMIT_HASH))
709  {
710  std::cout << PRE << "Unterschiedliche commit hashes: " << std::endl;
711  std::cout << std::string(PRE.length(), ' ') << "AVR: " << avr_commit_hash << std::endl;
712  std::cout << std::string(PRE.length(), ' ') << "Control: " << COMMIT_HASH << std::endl << std::endl;
713  abort("Versionen inkompatibel. Bitte Software aktualisieren!");
714  }
715 }
B15F::testIntConv
void testIntConv(void)
Definition: b15f.cpp:85
B15F::pwmSetValue
void pwmSetValue(uint8_t value)
Definition: b15f.cpp:447
B15F::exec
static std::string exec(std::string cmd)
Definition: b15f.cpp:159
B15F::analogWrite0
void analogWrite0(uint16_t port)
Definition: b15f.cpp:312
B15F::setServoPosition
void setServoPosition(uint16_t pos)
Definition: b15f.cpp:605
B15F::analogWrite1
void analogWrite1(uint16_t port)
Definition: b15f.cpp:329
B15F::getMem16
uint16_t getMem16(volatile uint16_t *adr)
Definition: b15f.cpp:525
B15F::delay_us
void delay_us(uint16_t us)
Definition: b15f.cpp:146
B15F::digitalRead0
uint8_t digitalRead0(void)
Definition: b15f.cpp:255
B15F::pwmSetFrequency
uint8_t pwmSetFrequency(uint32_t freq)
Definition: b15f.cpp:426
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:369
B15F::readDipSwitch
uint8_t readDipSwitch(void)
Definition: b15f.cpp:293
B15F::getRegister
uint8_t getRegister(volatile uint8_t *adr)
Definition: b15f.cpp:549
B15F::getMem8
uint8_t getMem8(volatile uint8_t *adr)
Definition: b15f.cpp:485
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:554
B15F::setMem16
void setMem16(volatile uint16_t *adr, uint16_t val)
Definition: b15f.cpp:504
USART::clearOutputBuffer
void clearOutputBuffer(void)
Definition: usart.cpp:61
B15F::analogRead
uint16_t analogRead(uint8_t channel)
Definition: b15f.cpp:346
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:544
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:274
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:237
B15F::setServoEnabled
void setServoEnabled(void)
Definition: b15f.cpp:571
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:465
B15F::setServoDisabled
void setServoDisabled(void)
Definition: b15f.cpp:588
DriverException
Definition: driverexception.h:10