Clean up some U8G files

This commit is contained in:
Scott Lahteine 2018-11-04 18:15:18 -06:00
parent 8014e1cc9d
commit b99f0776d6
3 changed files with 17 additions and 22 deletions

View file

@ -20,8 +20,7 @@
*
*/
// use this file to select the com driver for device drivers that are NOT in the U8G library
// Use this file to select the com driver for device drivers that are NOT in the U8G library
#ifndef U8G_HAL_LINKS
@ -71,4 +70,4 @@
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_null_fn
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn
#define U8G_COM_SSD_I2C_HAL u8g_com_null_fn
#endif
#endif

View file

@ -61,9 +61,9 @@
#include "HAL_LCD_com_defines.h"
#define WIDTH 128
#define HEIGHT 64
#define PAGE_HEIGHT 8
#define LCD_PIXEL_WIDTH 128
#define LCD_PIXEL_HEIGHT 64
#define PAGE_HEIGHT 8
/* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */
static const uint8_t u8g_dev_st7920_128x64_HAL_init_seq[] PROGMEM = {
@ -91,11 +91,11 @@ void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev) {
u8g_SetAddress(u8g, dev, 0); // cmd mode
u8g_WriteByte(u8g, dev, 0x08); //display off, cursor+blink off
u8g_WriteByte(u8g, dev, 0x3E); //extended mode + GDRAM active
for (uint8_t y = 0; y < (HEIGHT) / 2; y++) { //clear GDRAM
for (uint8_t y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM
u8g_WriteByte(u8g, dev, 0x80 | y); //set y
u8g_WriteByte(u8g, dev, 0x80); //set x = 0
u8g_SetAddress(u8g, dev, 1); /* data mode */
for (uint8_t i = 0; i < 2 * (WIDTH) / 8; i++) //2x width clears both segments
for (uint8_t i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) //2x width clears both segments
u8g_WriteByte(u8g, dev, 0);
u8g_SetAddress(u8g, dev, 0); /* cmd mode */
}
@ -137,8 +137,8 @@ uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
}
u8g_SetAddress(u8g, dev, 1); /* data mode */
u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
ptr += WIDTH/8;
u8g_WriteSequence(u8g, dev, (LCD_PIXEL_WIDTH) / 8, ptr);
ptr += (LCD_PIXEL_WIDTH) / 8;
y++;
}
u8g_SetChipSelect(u8g, dev, 0);
@ -182,8 +182,8 @@ uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
}
u8g_SetAddress(u8g, dev, 1); /* data mode */
u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
ptr += WIDTH/8;
u8g_WriteSequence(u8g, dev, (LCD_PIXEL_WIDTH) / 8, ptr);
ptr += (LCD_PIXEL_WIDTH) / 8;
y++;
}
u8g_SetChipSelect(u8g, dev, 0);
@ -193,14 +193,14 @@ uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
return u8g_dev_pb32h1_base_fn(u8g, dev, msg, arg);
}
U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_SW_SPI);
U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_sw_spi, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_SW_SPI);
#define QWIDTH (WIDTH*4)
#define QWIDTH ((LCD_PIXEL_WIDTH) * 4)
uint8_t u8g_dev_st7920_128x64_HAL_4x_buf[QWIDTH] U8G_NOCOMMON ;
u8g_pb_t u8g_dev_st7920_128x64_HAL_4x_pb = { {32, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_st7920_128x64_HAL_4x_buf};
u8g_pb_t u8g_dev_st7920_128x64_HAL_4x_pb = { { 32, LCD_PIXEL_HEIGHT, 0, 0, 0 }, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_HAL_4x_buf};
u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI };
U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_HW_SPI);
U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_hw_spi, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_HW_SPI);
u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_HW_SPI };
#if defined(U8G_HAL_LINKS) || defined(__SAM3X8E__)

View file

@ -25,9 +25,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(U8GLIB_ST7920)
#if !(defined(U8G_HAL_LINKS) || defined(__SAM3X8E__))
#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__)
#include "../../HAL/shared/Delay.h"
@ -202,6 +200,4 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g
#pragma GCC reset_options
#endif // U8G_HAL_LINKS
#endif // U8GLIB_ST7920
#endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__