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.

bitmap_info.h 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*****************
  2. * bitmap_info.h *
  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: <http://www.gnu.org/licenses/>. *
  19. ****************************************************************************/
  20. #pragma once
  21. #ifndef FORCEDINLINE
  22. #define FORCEDINLINE __attribute__((always_inline)) inline
  23. #endif
  24. namespace FTDI {
  25. // The following functions *must* be inlined since we are relying on the compiler to do
  26. // substitution of the constants from the data structure rather than actually storing
  27. // it in PROGMEM (which would fail, since we are not using pgm_read to read them).
  28. // Plus, by inlining, all the equations are evaluated at compile-time as everything
  29. // should be a constant.
  30. typedef struct {
  31. const uint8_t format;
  32. const uint16_t linestride;
  33. const uint8_t filter;
  34. const uint8_t wrapx;
  35. const uint8_t wrapy;
  36. const uint32_t RAMG_offset;
  37. const uint16_t width;
  38. const uint16_t height;
  39. } bitmap_info_t;
  40. FORCEDINLINE uint32_t BITMAP_SOURCE (const bitmap_info_t& info) {return BITMAP_SOURCE (ftdi_memory_map::RAM_G + info.RAMG_offset);};
  41. FORCEDINLINE uint32_t BITMAP_LAYOUT (const bitmap_info_t& info) {return BITMAP_LAYOUT (info.format, info.linestride, info.height);};
  42. FORCEDINLINE uint32_t BITMAP_SIZE (const bitmap_info_t& info) {return BITMAP_SIZE (info.filter, info.wrapx, info.wrapy, info.width, info.height);}
  43. }