My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

font_bitmaps.cpp 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*******************
  2. * font_bitmap.cpp *
  3. *******************/
  4. /****************************************************************************
  5. * Written By Marcio Teixeira 2019 - Aleph Objects, Inc. *
  6. * *
  7. * This program is free software: you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation, either version 3 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This program is distributed in the hope that it will be useful, *
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15. * GNU General Public License for more details. *
  16. * *
  17. * To view a copy of the GNU General Public License, go to the following *
  18. * location: <https://www.gnu.org/licenses/>. *
  19. ****************************************************************************/
  20. #include "../ftdi_extended.h"
  21. #if ENABLED(FTDI_EXTENDED)
  22. namespace FTDI {
  23. uint32_t write_rle_data(uint32_t addr, const uint8_t *data, size_t n) {
  24. for (; n >= 2; n -= 2) {
  25. uint8_t count = pgm_read_byte(data++);
  26. uint8_t value = pgm_read_byte(data++);
  27. CLCD::mem_write_fill(addr, value, count);
  28. addr += count;
  29. }
  30. return addr;
  31. }
  32. void set_font_bitmap(CommandProcessor& cmd, CLCD::FontMetrics &fm, uint8_t handle) {
  33. cmd.cmd(BITMAP_HANDLE(handle));
  34. cmd.cmd(BITMAP_SOURCE(fm.ptr));
  35. cmd.bitmap_layout(fm.format, fm.stride, fm.height);
  36. cmd.bitmap_size(BILINEAR, BORDER, BORDER, fm.width, fm.height);
  37. }
  38. void ext_vertex2ii(CommandProcessor &cmd, int x, int y, uint8_t handle, uint8_t cell) {
  39. if (x < 0 || y < 0 || x > 511 || y > 511) {
  40. cmd.cmd(BITMAP_HANDLE(handle));
  41. cmd.cmd(CELL(cell));
  42. cmd.cmd(VERTEX2F(x * 16, y * 16));
  43. }
  44. else {
  45. cmd.cmd(VERTEX2II(x, y, handle, cell));
  46. }
  47. }
  48. } // namespace FTDI
  49. #endif // FTDI_EXTENDED