main.cpp 740 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "hw/board.h"
  2. #include "messages.hpp"
  3. #include <avr/io.h>
  4. #include <supervisor.h>
  5. using Queue = rl::Queue<Storage, 15>;
  6. using Planner = rl::Planner<5>;
  7. Supervisor sup;
  8. int main(int, char **) {
  9. hw::Board::init_start();
  10. hw::Board::enable_timer();
  11. hw::Board::enable_uart();
  12. sei();
  13. Queue queue;
  14. Planner planner;
  15. rl::Context context{&queue, &planner, &hw::Board::get_now};
  16. sup.bind(context);
  17. auto dht = sup.get_child<0>();
  18. auto uart = sup.get_child<1>();
  19. dht->uart_id = uart->get_id();
  20. sup.start(true);
  21. /* main cycle */
  22. sup.process();
  23. return 0;
  24. }
  25. void on_rx(char c) {}
  26. void on_tx() { sup.get_child<1>()->send_next(true); }
  27. namespace std {
  28. void __throw_bad_optional_access() {
  29. while(1) {}
  30. }
  31. }