8 bit mode
This commit is contained in:
parent
d259fb5b58
commit
5b479dc6f1
27
csrc/u8g2.h
27
csrc/u8g2.h
|
@ -60,9 +60,21 @@
|
|||
|
||||
#include "u8x8.h"
|
||||
|
||||
|
||||
/*
|
||||
The following macro enables 16 Bit mode.
|
||||
Without defining this macro all calulations are done with 8 Bit (1 Byte) variables.
|
||||
Especially on AVR architecture, this will save some space.
|
||||
If this macro is defined, then U8g2 will switch to 16 Bit mode.
|
||||
Use 16 Bit mode for any display with more than 240 pixel in one
|
||||
direction.
|
||||
*/
|
||||
//#define U8G2_16BIT
|
||||
|
||||
/*
|
||||
The following macro enables the HVLine speed optimization.
|
||||
It will consume about 40 bytes more in flash memory of the AVR.
|
||||
HVLine procedures are also used by the text drawing functions.
|
||||
*/
|
||||
#define U8G2_HVLINE_SPEED_OPTIMIZATION
|
||||
|
||||
|
@ -74,7 +86,7 @@
|
|||
|
||||
/*
|
||||
The following macro activates the early intersection check with the current visible area.
|
||||
Clipping (and low level intersection calculation) may still happen and is controlled by U8G2_WITH_CLIPPING.
|
||||
Clipping (and low level intersection calculation) will still happen and is controlled by U8G2_WITH_CLIPPING.
|
||||
This early intersection check only improves speed for the picture loop (u8g2_FirstPage/NextPage).
|
||||
With a full framebuffer in RAM and if most graphical elements are drawn within the visible area, then this
|
||||
macro can be commented to reduce code size.
|
||||
|
@ -125,6 +137,9 @@
|
|||
*/
|
||||
#define U8G2_WITH_CLIPPING
|
||||
|
||||
|
||||
|
||||
|
||||
/*==========================================*/
|
||||
|
||||
|
||||
|
@ -137,8 +152,8 @@
|
|||
#define U8G2_FONT_SECTION(name) U8X8_FONT_SECTION(name)
|
||||
|
||||
|
||||
/* the macro U8G2_USE_LARGE_FONTS disables large fonts */
|
||||
/* it has to enabled for those uC supporting marger arrays */
|
||||
/* the macro U8G2_USE_LARGE_FONTS disables large fonts (>32K) */
|
||||
/* it can be enabled for those uC supporting larger arrays */
|
||||
#ifdef __arm__
|
||||
#define U8G2_USE_LARGE_FONTS
|
||||
#endif
|
||||
|
@ -152,9 +167,15 @@ extern "C" {
|
|||
|
||||
/*==========================================*/
|
||||
|
||||
#ifdef U8G2_16BIT
|
||||
typedef uint16_t u8g2_uint_t; /* for pixel position only */
|
||||
typedef int16_t u8g2_int_t; /* introduced for circle calculation */
|
||||
typedef int32_t u8g2_long_t; /* introduced for ellipse calculation */
|
||||
#else
|
||||
typedef uint8_t u8g2_uint_t; /* for pixel position only */
|
||||
typedef int8_t u8g2_int_t; /* introduced for circle calculation */
|
||||
typedef int16_t u8g2_long_t; /* introduced for ellipse calculation */
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct u8g2_struct u8g2_t;
|
||||
|
|
|
@ -708,41 +708,6 @@ u8g2_uint_t u8g2_DrawGlyph(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, uint16_t
|
|||
return u8g2_font_draw_glyph(u8g2, x, y, encoding);
|
||||
}
|
||||
|
||||
#ifdef OBSOLETE
|
||||
u8g2_uint_t u8g2_DrawStr(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, const char *str)
|
||||
{
|
||||
u8g2_uint_t delta, sum;
|
||||
sum = 0;
|
||||
while( *str != '\0' )
|
||||
{
|
||||
delta = u8g2_DrawGlyph(u8g2, x, y, (uint8_t)*str);
|
||||
|
||||
#ifdef U8G2_WITH_FONT_ROTATION
|
||||
switch(u8g2->font_decode.dir)
|
||||
{
|
||||
case 0:
|
||||
x += delta;
|
||||
break;
|
||||
case 1:
|
||||
y += delta;
|
||||
break;
|
||||
case 2:
|
||||
x -= delta;
|
||||
break;
|
||||
case 3:
|
||||
y -= delta;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
x += delta;
|
||||
#endif
|
||||
sum += delta;
|
||||
str++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
#endif
|
||||
|
||||
static u8g2_uint_t u8g2_draw_string(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, const char *str) U8G2_NOINLINE;
|
||||
static u8g2_uint_t u8g2_draw_string(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, const char *str)
|
||||
{
|
||||
|
|
|
@ -129,8 +129,8 @@
|
|||
U8g2
|
||||
|
||||
28. Apr 2016
|
||||
Uno DOGS102 u8g(13, 11, 10, 9); SW SPI FPS: Clip=3.0 Box=3.3 @=2.0 Pix=2.2 11852 Bytes
|
||||
Uno DOGS102 u8g(10, 9); HW SPI FPS: Clip=20.8 Box=28.2 @=4.9 Pix=6.0 12002 Bytes
|
||||
Uno DOGS102 u8g(13, 11, 10, 9); SW SPI FPS: Clip=3.0 Box=3.3 @=2.1 Pix=2.4 11472 Bytes
|
||||
Uno DOGS102 u8g(10, 9); HW SPI FPS: Clip=24.5 Box=87.4 @=5.0 Pix=7.3 11554 Bytes
|
||||
|
||||
*/
|
||||
|
||||
|
@ -145,8 +145,8 @@ typedef u8g2_uint_t u8g_uint_t;
|
|||
//U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* reset=*/ 8);
|
||||
//U8G2_SSD1306_128X64_NONAME_1_6800 u8g2(U8G2_R0, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
|
||||
//U8G2_SSD1306_128X64_NONAME_1_8080 u8g2(U8G2_R0, 13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
|
||||
//U8G2_UC1701_DOGS102_1_4W_SW_SPI u8g(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
U8G2_UC1701_DOGS102_1_4W_HW_SPI u8g(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
U8G2_UC1701_DOGS102_1_4W_SW_SPI u8g(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
//U8G2_UC1701_DOGS102_1_4W_HW_SPI u8g(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
|
||||
//U8G2_ST7920_192X32_1_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ U8X8_PIN_NONE, /*dc=*/ 17, /*reset=*/ U8X8_PIN_NONE);
|
||||
//U8G2_ST7920_192X32_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 16 /* A2 */, /* CS=*/ 17 /* A3 */, /* reset=*/ U8X8_PIN_NONE);
|
||||
//U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 16 /* A2 */, /* CS=*/ 17 /* A3 */, /* reset=*/ U8X8_PIN_NONE);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags`
|
||||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags` -DU8G2_16BIT
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags`
|
||||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags` -DU8G2_16BIT
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags`
|
||||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags` -DU8G2_16BIT
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags`
|
||||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags` -DU8G2_16BIT
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags`
|
||||
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags` -DU8G2_16BIT
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
|
||||
|
||||
|
|
Loading…
Reference in New Issue