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.

ultralcd_st7920_u8glib_rrd_AVR.h 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. // NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the
  24. // file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
  25. #include "../../inc/MarlinConfig.h"
  26. #include "../../HAL/shared/Delay.h"
  27. #define ST7920_CLK_PIN LCD_PINS_D4
  28. #define ST7920_DAT_PIN LCD_PINS_ENABLE
  29. #define ST7920_CS_PIN LCD_PINS_RS
  30. //#define PAGE_HEIGHT 8 // 128 byte framebuffer
  31. #define PAGE_HEIGHT 16 // 256 byte framebuffer
  32. //#define PAGE_HEIGHT 32 // 512 byte framebuffer
  33. #include <U8glib-HAL.h>
  34. void ST7920_SWSPI_SND_8BIT(uint8_t val);
  35. #if DOGM_SPI_DELAY_US > 0
  36. #define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US)
  37. #else
  38. #define U8G_DELAY() DELAY_US(10)
  39. #endif
  40. #define ST7920_CS() { WRITE(ST7920_CS_PIN, HIGH); U8G_DELAY(); }
  41. #define ST7920_NCS() { WRITE(ST7920_CS_PIN, LOW); }
  42. #define ST7920_SET_CMD() { ST7920_SWSPI_SND_8BIT(0xF8); U8G_DELAY(); }
  43. #define ST7920_SET_DAT() { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); }
  44. #define ST7920_WRITE_BYTE(a) { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4U)); U8G_DELAY(); }
  45. #define ST7920_WRITE_BYTES(p,l) { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } U8G_DELAY(); }