Don't compile custom u8g without DOGLCD

This commit is contained in:
Scott Lahteine 2017-11-19 13:37:33 -06:00
parent 3af7fc07e7
commit 81bc428b48
4 changed files with 30 additions and 13 deletions

View File

@ -69,6 +69,10 @@
* beginning. * beginning.
*/ */
#include "../../inc/MarlinConfig.h"
#if ENABLED(DOGLCD)
#include <U8glib.h> #include <U8glib.h>
#include "HAL_LCD_com_defines.h" #include "HAL_LCD_com_defines.h"
@ -308,3 +312,4 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
return 1; return 1;
} }
#endif // DOGLCD

View File

@ -57,6 +57,10 @@
*/ */
#include "../../inc/MarlinConfig.h"
#if ENABLED(DOGLCD)
#include <U8glib.h> #include <U8glib.h>
#include "HAL_LCD_com_defines.h" #include "HAL_LCD_com_defines.h"
@ -226,4 +230,6 @@ u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi = { u8g_dev_st7565_64128n_HAL_2x_f
U8G_PB_DEV(u8g_dev_st7565_64128n_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_HAL_fn, U8G_COM_HAL_HW_SPI_FN); U8G_PB_DEV(u8g_dev_st7565_64128n_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_HAL_fn, U8G_COM_HAL_HW_SPI_FN);
u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi = { u8g_dev_st7565_64128n_HAL_2x_fn, &u8g_dev_st7565_64128n_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN }; u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi = { u8g_dev_st7565_64128n_HAL_2x_fn, &u8g_dev_st7565_64128n_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN };
#endif // DOGLCD

View File

@ -56,6 +56,10 @@
*/ */
#include "../../inc/MarlinConfig.h"
#if ENABLED(DOGLCD)
#include <U8glib.h> #include <U8glib.h>
#include "HAL_LCD_com_defines.h" #include "HAL_LCD_com_defines.h"
@ -200,3 +204,5 @@ u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_f
// for the ST7920 for HAL systems no matter what is selected in ultralcd_impl_DOGM.h. // for the ST7920 for HAL systems no matter what is selected in ultralcd_impl_DOGM.h.
u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI }; u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI };
#endif #endif
#endif // DOGLCD

View File

@ -23,9 +23,13 @@
// NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the // NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the
// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version. // file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
#include "../../inc/MarlinConfig.h"
#if ENABLED(DOGLCD)
#ifndef U8G_HAL_LINKS #ifndef U8G_HAL_LINKS
#include "../../Marlin.h" //#include "../../Marlin.h"
//#if ENABLED(U8GLIB_ST7920) //#if ENABLED(U8GLIB_ST7920)
//#if ( ENABLED(SHARED_SPI) || !ENABLED(SHARED_SPI) && (defined(LCD_PINS_D4) && LCD_PINS_D4 >= 0) && (defined(LCD_PINS_ENABLE) && LCD_PINS_ENABLE >= 0)) //#if ( ENABLED(SHARED_SPI) || !ENABLED(SHARED_SPI) && (defined(LCD_PINS_D4) && LCD_PINS_D4 >= 0) && (defined(LCD_PINS_ENABLE) && LCD_PINS_ENABLE >= 0))
@ -97,18 +101,15 @@
#define U8G_DELAY() u8g_10MicroDelay() #define U8G_DELAY() u8g_10MicroDelay()
#endif #endif
static void ST7920_WRITE_BYTE(uint8_t val) { static void ST7920_WRITE_BYTE(uint8_t val) {
for (uint8_t i = 0; i < 8; i++) { for (uint8_t i = 0; i < 8; i++) {
WRITE(ST7920_DAT_PIN, val & 0x80); WRITE(ST7920_DAT_PIN, val & 0x80);
WRITE(ST7920_CLK_PIN, HIGH); WRITE(ST7920_CLK_PIN, HIGH);
WRITE(ST7920_CLK_PIN, LOW); WRITE(ST7920_CLK_PIN, LOW);
val = val << 1; val <<= 1;
} }
} }
#define ST7920_SET_CMD() { ST7920_WRITE_BYTE(0xF8); U8G_DELAY(); } #define ST7920_SET_CMD() { ST7920_WRITE_BYTE(0xF8); U8G_DELAY(); }
#define ST7920_SET_DAT() { ST7920_WRITE_BYTE(0xFA); U8G_DELAY(); } #define ST7920_SET_DAT() { ST7920_WRITE_BYTE(0xFA); U8G_DELAY(); }
#define ST7920_WRITE_NIBBLES(a) { ST7920_WRITE_BYTE((uint8_t)((a)&0xF0u)); ST7920_WRITE_BYTE((uint8_t)((a)<<4u)); U8G_DELAY(); } #define ST7920_WRITE_NIBBLES(a) { ST7920_WRITE_BYTE((uint8_t)((a)&0xF0u)); ST7920_WRITE_BYTE((uint8_t)((a)<<4u)); U8G_DELAY(); }
@ -118,17 +119,13 @@ static void ST7920_WRITE_BYTE(uint8_t val) {
#define ST7920_CS() { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); } #define ST7920_CS() { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); }
#define ST7920_NCS() { WRITE(ST7920_CS_PIN,0); } #define ST7920_NCS() { WRITE(ST7920_CS_PIN,0); }
uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
uint8_t i, y; uint8_t i, y;
switch (msg) { switch (msg) {
case U8G_DEV_MSG_INIT: { case U8G_DEV_MSG_INIT: {
OUT_WRITE(ST7920_CS_PIN, LOW); OUT_WRITE(ST7920_CS_PIN, LOW);
OUT_WRITE(ST7920_DAT_PIN, LOW);
OUT_WRITE(ST7920_CLK_PIN, LOW);
OUT_WRITE(ST7920_DAT_PIN, LOW);
OUT_WRITE(ST7920_CLK_PIN, LOW);
ST7920_CS(); ST7920_CS();
u8g_Delay(120); //initial delay for boot up u8g_Delay(120); //initial delay for boot up
@ -197,4 +194,7 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g
//#endif //( ENABLED(SHARED_SPI) || !ENABLED(SHARED_SPI) && (defined(LCD_PINS_D4) && LCD_PINS_D4 >= 0) && (defined(LCD_PINS_ENABLE) && LCD_PINS_ENABLE >= 0)) //#endif //( ENABLED(SHARED_SPI) || !ENABLED(SHARED_SPI) && (defined(LCD_PINS_D4) && LCD_PINS_D4 >= 0) && (defined(LCD_PINS_ENABLE) && LCD_PINS_ENABLE >= 0))
//#endif // U8GLIB_ST7920 //#endif // U8GLIB_ST7920
#endif // AVR
#endif // U8G_HAL_LINKS
#endif // DOGLCD