Display_SITL.h 992 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #ifdef WITH_SITL_OSD
  3. #include "Display.h"
  4. #include "Display_Backend.h"
  5. #ifdef HAVE_SFML_GRAPHICS_H
  6. #include <SFML/Graphics.h>
  7. #else
  8. #include <SFML/Graphics.hpp>
  9. #endif
  10. class Display_SITL: public Display_Backend {
  11. public:
  12. static Display_SITL *probe();
  13. void hw_update() override;
  14. void set_pixel(uint16_t x, uint16_t y) override;
  15. void clear_pixel(uint16_t x, uint16_t y) override;
  16. void clear_screen() override;
  17. protected:
  18. Display_SITL();
  19. ~Display_SITL() override;
  20. private:
  21. static constexpr const uint16_t COLUMNS = 132;
  22. static constexpr const uint8_t ROWS = 64;
  23. static constexpr const uint8_t SCALE = 4; // make it more readable
  24. bool hw_init() override;
  25. void _timer();
  26. uint8_t _displaybuffer[COLUMNS * ROWS];
  27. bool _need_hw_update;
  28. static void *update_thread_start(void *obj);
  29. void update_thread(void);
  30. sf::RenderWindow *w;
  31. pthread_t thread;
  32. HAL_Semaphore mutex;
  33. };
  34. #endif // WITH_SITL_OSD