Compare commits
53 Commits
Author | SHA1 | Date |
---|---|---|
Joel Bodenmann | 41eef9dede | |
Joel Bodenmann | b40425a0ae | |
inmarket | f1a34c9852 | |
inmarket | 025cef93cc | |
Joel Bodenmann | e028d196f5 | |
Joel Bodenmann | fa0c779b0c | |
Joel Bodenmann | 3d543b62bc | |
Joel Bodenmann | d1279f5ef2 | |
Joel Bodenmann | 6b0ce94b15 | |
Joel Bodenmann | ad90707866 | |
Joel Bodenmann | dee588888b | |
Joel Bodenmann | 9e9fc1e824 | |
Joel Bodenmann | 325a7c8b5f | |
Joel Bodenmann | da1c2233e7 | |
Joel Bodenmann | 168cd27633 | |
Joel Bodenmann | 143a3a8847 | |
Joel Bodenmann | 56a88c440d | |
Joel Bodenmann | cc0b175e7f | |
Joel Bodenmann | ba9b9fb62b | |
Joel Bodenmann | 0f11538656 | |
Joel Bodenmann | d66739a349 | |
Joel Bodenmann | ebf5033144 | |
Joel Bodenmann | 734c5cd421 | |
Joel Bodenmann | 831c23e2ac | |
Joel Bodenmann | 2ae3cf397d | |
inmarket | 33f6fa0eb0 | |
inmarket | 2c1c87ee1b | |
Joel Bodenmann | ae6a3bc18b | |
Joel Bodenmann | 68483139c9 | |
Joel Bodenmann | 64aa71339c | |
Joel Bodenmann | a4f225700f | |
Joel Bodenmann | 71a308a01a | |
Joel Bodenmann | 50be0d6432 | |
Joel Bodenmann | 7e2decd0cd | |
Joel Bodenmann | aa9e187581 | |
Joel Bodenmann | 05b547bbbb | |
Joel Bodenmann | 1d63573408 | |
Joel Bodenmann | 1c29a88ee1 | |
Joel Bodenmann | 4261a1fb0b | |
inmarket | 3d3555ec5a | |
Joel Bodenmann | 2f82247223 | |
Joel Bodenmann | cbf9c22adf | |
Joel Bodenmann | 6d6ce043d0 | |
Joel Bodenmann | 0a55fc94bd | |
Joel Bodenmann | 0dac6b4d0f | |
Joel Bodenmann | 14f26ec934 | |
Joel Bodenmann | 7845f44f20 | |
Joel Bodenmann | 1235a9056c | |
Joel Bodenmann | 3f1f1c6a95 | |
Joel Bodenmann | 8d6b2c4707 | |
Joel Bodenmann | 317db95c46 | |
Joel Bodenmann | ec257874a7 | |
Joel Bodenmann | b17cb215f4 |
|
@ -3,6 +3,7 @@ build
|
|||
.dep
|
||||
.cproject
|
||||
.project
|
||||
.vscode
|
||||
*.sublime*
|
||||
*.stackdump
|
||||
*.lst
|
||||
|
@ -15,3 +16,7 @@ docs/html
|
|||
docs/html.zip
|
||||
docs/*.db
|
||||
docs/*.tmp
|
||||
|
||||
# CLion
|
||||
.idea/
|
||||
cmake-build-*/
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
#pragma once
|
||||
|
||||
#include <stm32f4xx_hal.h>
|
||||
#include <string.h>
|
||||
|
||||
// The command byte to put on the front of each page line
|
||||
#define SSD1312_PAGE_PREFIX 0x40 // Co = 0, D/C = 1
|
||||
|
||||
static I2C_HandleTypeDef i2cHandle;
|
||||
|
||||
static GFXINLINE void init_board(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
|
||||
// GPIO
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
|
||||
// I2C SCL
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_8;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
// I2C SDA
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
}
|
||||
|
||||
// I2C1
|
||||
{
|
||||
__HAL_RCC_I2C1_CLK_ENABLE();
|
||||
|
||||
i2cHandle.Instance = I2C1;
|
||||
i2cHandle.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||
i2cHandle.Init.ClockSpeed = 400000;
|
||||
i2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||
i2cHandle.Init.DutyCycle = I2C_DUTYCYCLE_2;
|
||||
i2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||
i2cHandle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||
if (HAL_I2C_Init(&i2cHandle) != HAL_OK)
|
||||
gfxHalt("I2C HAL init error");
|
||||
}
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state)
|
||||
{
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
||||
static GFXINLINE void acquire_bus(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void release_bus(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void write_cmd(GDisplay *g, gU8 *data, gU16 length)
|
||||
{
|
||||
(void) g;
|
||||
|
||||
gU8 buf[4]; // length is always <= 3
|
||||
buf[0] = 0x00;
|
||||
memcpy(buf+1, data, length);
|
||||
|
||||
HAL_I2C_Master_Transmit(&i2cHandle, (0x3c << 1), buf, length+1, 10000);
|
||||
}
|
||||
|
||||
static GFXINLINE void write_data(GDisplay *g, gU8 *data, gU16 length)
|
||||
{
|
||||
(void) g;
|
||||
|
||||
HAL_I2C_Master_Transmit(&i2cHandle, (0x3c << 1), data, length, 10000);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
GFXINC +=
|
||||
GFXSRC +=
|
||||
GFXDEFS += -DGFX_USE_OS_FREEBSD=GFXON
|
||||
GFXLIBS += rt
|
||||
|
||||
include $(GFXLIB)/drivers/multiple/SDL/driver.mk
|
|
@ -0,0 +1,52 @@
|
|||
# Possible Targets: all clean Debug cleanDebug Release cleanRelease
|
||||
|
||||
##############################################################################################
|
||||
# Settings
|
||||
#
|
||||
|
||||
# General settings
|
||||
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
|
||||
OPT_OS = freebsd
|
||||
OPT_LINK_OPTIMIZE = yes
|
||||
# Change this next setting (or add the explicit compiler flags) if you are not compiling for x86 linux
|
||||
OPT_CPU = x64
|
||||
|
||||
# uGFX settings
|
||||
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
|
||||
GFXLIB = ../uGFX
|
||||
GFXBOARD = FreeBSD-SDL
|
||||
GFXDEMO = modules/gdisp/basics
|
||||
|
||||
# Linux settings
|
||||
# See $(GFXLIB)/tools/gmake_scripts/os_linux.mk for the list of variables
|
||||
|
||||
##############################################################################################
|
||||
# Set these for your project
|
||||
#
|
||||
|
||||
ARCH =
|
||||
XCC = gcc10
|
||||
XAS = gcc10
|
||||
XLD = gcc10
|
||||
SRCFLAGS = -ggdb -O0
|
||||
CFLAGS = `sdl2-config --libs --cflags`
|
||||
CXXFLAGS =
|
||||
ASFLAGS =
|
||||
LDFLAGS =
|
||||
|
||||
SRC =
|
||||
OBJS =
|
||||
DEFS =
|
||||
LIBS =
|
||||
INCPATH =
|
||||
LIBPATH =
|
||||
|
||||
##############################################################################################
|
||||
# These should be at the end
|
||||
#
|
||||
|
||||
include $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk
|
||||
include $(GFXLIB)/tools/gmake_scripts/os_$(OPT_OS).mk
|
||||
include $(GFXLIB)/tools/gmake_scripts/compiler_gcc.mk
|
||||
# *** EOF ***
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
This directory contains the interface for FreeBSD using SDL.
|
||||
|
||||
As of today, this is simply a wrapper around the Linux drivers/support.
|
||||
|
||||
On this board uGFX currently supports:
|
||||
- GDISP via the SDL driver
|
||||
- GINPUT-touch via the SDL driver
|
||||
- GINPUT-keyboard via the SDL driver
|
||||
|
||||
|
||||
The folowing packages are required to run uGFX using this driver on
|
||||
a 64-bit FreeBSD system using SDL:
|
||||
+ devel/gcc10
|
||||
+ devel/sdl2
|
||||
|
||||
|
||||
The following should be added to the CFLAGS of the target makefile:
|
||||
CFLAGS = `sdl2-config --libs --cflags`
|
||||
|
||||
|
||||
There is an example Makefile and project in the examples directory.
|
||||
|
|
@ -3,11 +3,12 @@
|
|||
*****************************************************************************
|
||||
|
||||
*** After Release 2.9 ***
|
||||
CHANGE: Added type gImage to replace V2.x gdispImage
|
||||
FIX: Fixed GWIN console widget scroll
|
||||
FIX: A warning and adjusted is made if GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE is less than 40 bytes.
|
||||
CHANGE: Added type gImage to replace V2.x gdispImage.
|
||||
FIX: Fixed GWIN console widget scroll.
|
||||
FIX: A warning and adjustment is made if GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE is less than 40 bytes.
|
||||
FIX: Prevent compiler warnings on duplicate const specifiers.
|
||||
FEATURE: Added support for ChibiOS 6.x kernel.
|
||||
FEATURE: Added support for ChibiOS 7.x kernel.
|
||||
CHANGE: STM32LTDC driver: Refactor to outsource clock setup for LTDC & DMA2D peripherals to the board file.
|
||||
CHANGE: STM32LTDC driver: Remove obsolete LTDC_NO_CLOCK_INIT macro as this clock setup is now outsourced to the board file.
|
||||
CHANGE: STM32LTDC driver: Automatically enable DMA cache flushing on STM32H7 platforms.
|
||||
|
@ -17,7 +18,22 @@ CHANGE: STM32LTDC driver: Rename LTDC_DMA_CACHE_FLUSH to STM32LTDC_DMA_CACHE
|
|||
CHANGE: STM32LTDC driver: Rename GDISP_LTDC_USE_RGB565 to STM32LTDC_USE_RGB565.
|
||||
FEATURE: STM32LTDC driver: Support double buffering. This introduces STM32LTDC_USE_DOUBLEBUFFERING.
|
||||
FIX: STM32LTDC driver: Fix bug in gdisp_lld_blit_area() which affected blits with source coordinates other than (0, 0).
|
||||
FIX: Improve /demos/benchmarks/rectangles
|
||||
FIX: Improve /demos/benchmarks/rectangles.
|
||||
FIX: Win32 driver: Fix buffer position calculation in gdisp_lld_blit_area().
|
||||
FIX: Win32 driver: Fix memory leak / invalid pointer to free() when re-calculating buffer position in a specific situation.
|
||||
FIX: Prevent const qualifier being discarded in vfnprintg().
|
||||
FIX: Fix missing return value in gfxQueueFSyncPut().
|
||||
FIX: Fix missing return value in gfxQueueFSyncPush().
|
||||
FIX: Fix missing return value in gfxQueueFSyncInsert().
|
||||
FEATURE: Adding support for FreeBSD.
|
||||
FIX: Fix incorrect calls to mmap() and sem_open() in SDL2 driver (lax operating systems such as Linux & MacOS were silently tolerating these).
|
||||
FIX: Minor code improvements
|
||||
FEATURE: Add cmake support
|
||||
FIX: Add missing driver.mk to SSD1322 driver.
|
||||
FEATURE: LGDP4532 driver improvements.
|
||||
FIX: Win32 Keyboard driver now retrieves lock key states on window activate
|
||||
FEATURE: Add SSD1312 GDISP driver
|
||||
FEATURE: Add CH1115 GDISP driver
|
||||
|
||||
|
||||
*** Release 2.9 ***
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
# Define UGFX_ROOT
|
||||
set(UGFX_ROOT ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
|
||||
# Ensure that UGFX_ROOT is set
|
||||
if(NOT UGFX_ROOT)
|
||||
message(FATAL_ERROR "No UGFX_ROOT specified")
|
||||
endif()
|
||||
|
||||
# Assemble list of components
|
||||
list(APPEND ugfx_COMPONENTS_BUILTIN
|
||||
gadc
|
||||
gaudio
|
||||
gdisp
|
||||
gdriver
|
||||
gevent
|
||||
gfile
|
||||
ginput
|
||||
gmisc
|
||||
gos
|
||||
gqueue
|
||||
gtimer
|
||||
gtrans
|
||||
gwin
|
||||
)
|
||||
|
||||
# Core sources
|
||||
list(APPEND ugfx_SOURCES
|
||||
${UGFX_ROOT}/src/gfx.c
|
||||
)
|
||||
|
||||
# Core include directories
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${UGFX_ROOT}
|
||||
${UGFX_ROOT}/src
|
||||
)
|
||||
|
||||
# Include each built-in component
|
||||
foreach(component ${ugfx_COMPONENTS_BUILTIN})
|
||||
include(${UGFX_ROOT}/src/${component}/${component}.cmake)
|
||||
endforeach()
|
||||
|
||||
# Include each component
|
||||
foreach(component ${ugfx_FIND_COMPONENTS})
|
||||
include(${UGFX_ROOT}/${component}/driver.cmake)
|
||||
endforeach()
|
||||
|
||||
# Remove duplicates from non-cached variables
|
||||
list(REMOVE_DUPLICATES ugfx_SOURCES)
|
||||
list(REMOVE_DUPLICATES ugfx_INCLUDE_DIRS)
|
||||
|
||||
# Outsource heavy-lifting to cmake
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ugfx DEFAULT_MSG UGFX_ROOT ugfx_SOURCES ugfx_INCLUDE_DIRS)
|
||||
|
||||
# Create the target
|
||||
if(NOT TARGET ugfx)
|
||||
add_library(ugfx INTERFACE IMPORTED)
|
||||
endif()
|
||||
target_include_directories(
|
||||
ugfx
|
||||
INTERFACE
|
||||
${ugfx_INCLUDE_DIRS}
|
||||
)
|
||||
target_sources(
|
||||
ugfx
|
||||
INTERFACE
|
||||
${ugfx_SOURCES}
|
||||
)
|
||||
target_compile_definitions(
|
||||
ugfx
|
||||
INTERFACE
|
||||
${ugfx_DEFS}
|
||||
)
|
||||
target_link_libraries(
|
||||
ugfx
|
||||
INTERFACE
|
||||
${ugfx_LIBS}
|
||||
)
|
|
@ -42,7 +42,6 @@
|
|||
#define GDISP_NEED_VALIDATION GFXON
|
||||
#define GDISP_NEED_CLIP GFXON
|
||||
#define GDISP_NEED_TEXT GFXON
|
||||
#define GDISP_NEED_ANTIALIAS GFXON
|
||||
#define GDISP_NEED_UTF8 GFXON
|
||||
#define GDISP_NEED_TEXT_KERNING GFXON
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ static const char* FrenchStrings[] = {
|
|||
};
|
||||
static const transTable FrenchTranslation = { sizeof(FrenchStrings)/sizeof(FrenchStrings[0]), FrenchStrings };
|
||||
|
||||
void updateText()
|
||||
void updateText(void)
|
||||
{
|
||||
gCoord width = 400;
|
||||
gCoord height = 30;
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.io/license.html
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* The command byte to put in front of each page line.
|
||||
*
|
||||
* If this is defined, each page line is prefixed with the specified value in the locally
|
||||
* maintained framebuffer.
|
||||
*
|
||||
* This can be omitted and handled inside of write_data() manually instead.
|
||||
*/
|
||||
#define CH1115_PAGE_PREFIX 0x40 // Co = 0, D/C = 1
|
||||
|
||||
static GFXINLINE void init_board(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state)
|
||||
{
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
||||
static GFXINLINE void acquire_bus(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void release_bus(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void write_cmd(GDisplay *g, gU8 *data, gU16 length)
|
||||
{
|
||||
(void) g;
|
||||
(void) data;
|
||||
(void) length;
|
||||
}
|
||||
|
||||
static GFXINLINE void write_data(GDisplay *g, gU8 *data, gU16 length)
|
||||
{
|
||||
(void) g;
|
||||
(void) data;
|
||||
(void) length;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/gdisp_lld_CH1115.c
|
||||
)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
GFXINC += $(GFXLIB)/drivers/gdisp/CH1115
|
||||
GFXSRC += $(GFXLIB)/drivers/gdisp/CH1115/gdisp_lld_CH1115.c
|
||||
|
|
@ -0,0 +1,391 @@
|
|||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.io/license.html
|
||||
*/
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_CH1115
|
||||
#include "gdisp_lld_config.h"
|
||||
#include "../../../src/gdisp/gdisp_driver.h"
|
||||
|
||||
#include "board_CH1115.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifndef GDISP_SCREEN_HEIGHT
|
||||
#define GDISP_SCREEN_HEIGHT 32 // This controller should also support 64 (untested)
|
||||
#endif
|
||||
#ifndef GDISP_SCREEN_WIDTH
|
||||
#define GDISP_SCREEN_WIDTH 128
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_CONTRAST
|
||||
#define GDISP_INITIAL_CONTRAST 100
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_BACKLIGHT
|
||||
#define GDISP_INITIAL_BACKLIGHT 100
|
||||
#endif
|
||||
#ifdef CH1115_PAGE_PREFIX
|
||||
#define CH1115_PAGE_WIDTH (GDISP_SCREEN_WIDTH+1)
|
||||
#define CH1115_PAGE_OFFSET 1
|
||||
#else
|
||||
#define CH1115_PAGE_WIDTH GDISP_SCREEN_WIDTH
|
||||
#define CH1115_PAGE_OFFSET 0
|
||||
#endif
|
||||
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
// Some common routines and macros
|
||||
#define RAM(g) ((gU8 *)g->priv)
|
||||
#define xyaddr(x, y) (CH1115_PAGE_OFFSET + (x) + ((y)>>3)*CH1115_PAGE_WIDTH)
|
||||
#define xybit(y) (1<<((y)&7))
|
||||
|
||||
#define write_cmd_1(g, a) { gU8 cmd[1]; cmd[0] = a; write_cmd(g, cmd, 1); }
|
||||
#define write_cmd_2(g, a, b) { gU8 cmd[2]; cmd[0] = a; cmd[1] = b; write_cmd(g, cmd, 2); }
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* As this controller can't update on a pixel boundary we need to maintain the
|
||||
* the entire display surface in memory so that we can do the necessary bit
|
||||
* operations. Fortunately it is a small monochrome display.
|
||||
* 64 * 128 / 8 = 1024 bytes.
|
||||
*/
|
||||
|
||||
LLDSPEC gBool gdisp_lld_init(GDisplay *g)
|
||||
{
|
||||
// The private area is the display surface.
|
||||
g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT/8 * CH1115_PAGE_WIDTH);
|
||||
if (!g->priv)
|
||||
return gFalse;
|
||||
|
||||
// Fill in the prefix command byte on each page line of the display buffer
|
||||
// We can do this during initialisation as we're being careful that this byte is never overwritten.
|
||||
#ifdef CH1115_PAGE_PREFIX
|
||||
for (unsigned i = 0; i < GDISP_SCREEN_HEIGHT/8 * CH1115_PAGE_WIDTH; i += CH1115_PAGE_WIDTH)
|
||||
RAM(g)[i] = CH1115_PAGE_PREFIX;
|
||||
#endif
|
||||
|
||||
// Initialise the board interface
|
||||
init_board(g);
|
||||
|
||||
// Hardware reset
|
||||
setpin_reset(g, gTrue);
|
||||
gfxSleepMilliseconds(20);
|
||||
setpin_reset(g, gFalse);
|
||||
gfxSleepMilliseconds(200);
|
||||
|
||||
acquire_bus(g);
|
||||
|
||||
// Configuration
|
||||
// This might require display module vendor specific changes
|
||||
{
|
||||
// Display off
|
||||
write_cmd_1(g, 0xAE);
|
||||
|
||||
// Clock divider
|
||||
write_cmd_2(g, 0xD5, 0x80);
|
||||
|
||||
// Multiplex ratio
|
||||
write_cmd_2(g, 0xA8, 0x1F);
|
||||
|
||||
// Display offset
|
||||
write_cmd_2(g, 0xD3, 0x30);
|
||||
|
||||
// Display start line
|
||||
write_cmd_1(g, 0x40);
|
||||
|
||||
// Charge pump
|
||||
write_cmd_2(g, 0x8D, 0x72); // 0x10 if Vcc externally supplied
|
||||
|
||||
// Segment re-map
|
||||
write_cmd_1(g, 0xA1);
|
||||
|
||||
// COM output scan direction
|
||||
write_cmd_1(g, 0xC0);
|
||||
|
||||
// COM pin hardware configuration
|
||||
write_cmd_2(g, 0xDA, 0x10);
|
||||
|
||||
// Set internal/external current reference
|
||||
write_cmd_2(g, 0xAD, 0x50);
|
||||
|
||||
// Set contract
|
||||
write_cmd_2(g, 0x81, 0x17);
|
||||
|
||||
// Set pre-charge period
|
||||
write_cmd_2(g, 0xD9, 0xF1);
|
||||
|
||||
// Set VCOMH select level
|
||||
write_cmd_2(g, 0xDB, 0x30);
|
||||
|
||||
// Set entire display on/off
|
||||
write_cmd_1(g, 0xA4);
|
||||
|
||||
// Set normal/inverse display
|
||||
write_cmd_1(g, 0xA6);
|
||||
|
||||
// Page addressing mode
|
||||
write_cmd_2(g, 0x20, 0x02);
|
||||
|
||||
// Display on
|
||||
write_cmd_1(g, 0xAF);
|
||||
}
|
||||
|
||||
release_bus(g);
|
||||
|
||||
// Finish Init
|
||||
post_init_board(g);
|
||||
|
||||
// Initialise the GDISP structure
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Orientation = gOrientation0;
|
||||
g->g.Powermode = gPowerOn;
|
||||
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
g->g.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#if GDISP_HARDWARE_FLUSH
|
||||
LLDSPEC void gdisp_lld_flush(GDisplay *g)
|
||||
{
|
||||
gU8 * ram;
|
||||
unsigned pages;
|
||||
|
||||
// Only flush if necessary
|
||||
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
|
||||
return;
|
||||
|
||||
ram = RAM(g);
|
||||
pages = GDISP_SCREEN_HEIGHT/8;
|
||||
|
||||
acquire_bus(g);
|
||||
write_cmd_1(g, 0x40 | 0);
|
||||
while (pages--) {
|
||||
write_cmd_1(g, 0xB0 + (((GDISP_SCREEN_HEIGHT/8)-1)-pages));
|
||||
write_cmd_1(g, 0x00);
|
||||
write_cmd_1(g, 0x10);
|
||||
write_data(g, ram, CH1115_PAGE_WIDTH);
|
||||
ram += CH1115_PAGE_WIDTH;
|
||||
}
|
||||
release_bus(g);
|
||||
|
||||
g->flags &= ~GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_DRAWPIXEL
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g)
|
||||
{
|
||||
gCoord x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case gOrientation0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case gOrientation90:
|
||||
x = g->p.y;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
|
||||
break;
|
||||
case gOrientation180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
break;
|
||||
case gOrientation270:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.y;
|
||||
y = g->p.x;
|
||||
break;
|
||||
}
|
||||
if (gdispColor2Native(g->p.color) != gdispColor2Native(GFX_BLACK))
|
||||
RAM(g)[xyaddr(x, y)] |= xybit(y);
|
||||
else
|
||||
RAM(g)[xyaddr(x, y)] &= ~xybit(y);
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_PIXELREAD
|
||||
LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g)
|
||||
{
|
||||
gCoord x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case gOrientation0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case gOrientation90:
|
||||
x = g->p.y;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
|
||||
break;
|
||||
case gOrientation180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
break;
|
||||
case gOrientation270:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.y;
|
||||
y = g->p.x;
|
||||
break;
|
||||
}
|
||||
|
||||
return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? GFX_WHITE : GFX_BLACK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_FILLS
|
||||
LLDSPEC void gdisp_lld_fill_area(GDisplay *g)
|
||||
{
|
||||
gCoord sy, ey;
|
||||
gCoord sx, ex;
|
||||
gCoord col;
|
||||
unsigned spage, zpages;
|
||||
gU8 * base;
|
||||
gU8 mask;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case gOrientation0:
|
||||
sx = g->p.x;
|
||||
ex = g->p.x + g->p.cx - 1;
|
||||
sy = g->p.y;
|
||||
ey = sy + g->p.cy - 1;
|
||||
break;
|
||||
case gOrientation90:
|
||||
sx = g->p.y;
|
||||
ex = g->p.y + g->p.cy - 1;
|
||||
sy = GDISP_SCREEN_HEIGHT - g->p.x - g->p.cx;
|
||||
ey = GDISP_SCREEN_HEIGHT-1 - g->p.x;
|
||||
break;
|
||||
case gOrientation180:
|
||||
sx = GDISP_SCREEN_WIDTH - g->p.x - g->p.cx;
|
||||
ex = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
sy = GDISP_SCREEN_HEIGHT - g->p.y - g->p.cy;
|
||||
ey = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
break;
|
||||
case gOrientation270:
|
||||
sx = GDISP_SCREEN_WIDTH - g->p.y - g->p.cy;
|
||||
ex = GDISP_SCREEN_WIDTH-1 - g->p.y;
|
||||
sy = g->p.x;
|
||||
ey = g->p.x + g->p.cx - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
spage = sy / 8;
|
||||
base = RAM(g) + CH1115_PAGE_OFFSET + CH1115_PAGE_WIDTH * spage;
|
||||
mask = 0xff << (sy&7);
|
||||
zpages = (ey / 8) - spage;
|
||||
|
||||
if (gdispColor2Native(g->p.color) == gdispColor2Native(GFX_BLACK)) {
|
||||
while (zpages--) {
|
||||
for (col = sx; col <= ex; col++)
|
||||
base[col] &= ~mask;
|
||||
mask = 0xff;
|
||||
base += CH1115_PAGE_WIDTH;
|
||||
}
|
||||
mask &= (0xff >> (7 - (ey&7)));
|
||||
for (col = sx; col <= ex; col++)
|
||||
base[col] &= ~mask;
|
||||
}
|
||||
else {
|
||||
while (zpages--) {
|
||||
for (col = sx; col <= ex; col++)
|
||||
base[col] |= mask;
|
||||
mask = 0xff;
|
||||
base += CH1115_PAGE_WIDTH;
|
||||
}
|
||||
mask &= (0xff >> (7 - (ey&7)));
|
||||
for (col = sx; col <= ex; col++)
|
||||
base[col] |= mask;
|
||||
}
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
|
||||
LLDSPEC void gdisp_lld_control(GDisplay *g)
|
||||
{
|
||||
switch(g->p.x) {
|
||||
case GDISP_CONTROL_POWER:
|
||||
if (g->g.Powermode == (gPowermode)g->p.ptr)
|
||||
return;
|
||||
switch((gPowermode)g->p.ptr) {
|
||||
case gPowerOff:
|
||||
case gPowerSleep:
|
||||
case gPowerDeepSleep:
|
||||
acquire_bus(g);
|
||||
write_cmd_1(g, 0xAE);
|
||||
release_bus(g);
|
||||
break;
|
||||
case gPowerOn:
|
||||
acquire_bus(g);
|
||||
write_cmd_1(g, 0xAF);
|
||||
release_bus(g);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Powermode = (gPowermode)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if (g->g.Orientation == (gOrientation)g->p.ptr)
|
||||
return;
|
||||
|
||||
switch((gOrientation)g->p.ptr) {
|
||||
// Rotation is handled by the drawing routines
|
||||
case gOrientation0:
|
||||
case gOrientation180:
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case gOrientation90:
|
||||
case gOrientation270:
|
||||
g->g.Height = GDISP_SCREEN_WIDTH;
|
||||
g->g.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
g->g.Orientation = (gOrientation)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_CONTRAST:
|
||||
if ((unsigned)g->p.ptr > 100)
|
||||
g->p.ptr = (void *)100;
|
||||
acquire_bus(g);
|
||||
write_cmd_2(g, 0x81, (((unsigned)g->p.ptr)<<8)/101);
|
||||
release_bus(g);
|
||||
g->g.Contrast = (unsigned)g->p.ptr;
|
||||
return;
|
||||
|
||||
// Our own special controller code to inverse the display
|
||||
// 0 = normal, 1 = inverse
|
||||
case GDISP_CONTROL_INVERSE:
|
||||
acquire_bus(g);
|
||||
write_cmd_1(g, g->p.ptr ? 0xA7: 0xA6);
|
||||
release_bus(g);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GDISP_NEED_CONTROL
|
||||
|
||||
#endif // GFX_USE_GDISP
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.io/license.html
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_CONFIG_H
|
||||
#define _GDISP_LLD_CONFIG_H
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver hardware support. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define GDISP_HARDWARE_FLUSH GFXON // This controller requires flushing
|
||||
#define GDISP_HARDWARE_DRAWPIXEL GFXON
|
||||
#define GDISP_HARDWARE_PIXELREAD GFXON
|
||||
#define GDISP_HARDWARE_CONTROL GFXON
|
||||
#define GDISP_HARDWARE_FILLS GFXON
|
||||
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
|
||||
|
||||
// This controller supports a special gdispControl() to inverse the display.
|
||||
// Pass a parameter of 1 for inverse and 0 for normal.
|
||||
#define GDISP_CONTROL_INVERSE (GDISP_CONTROL_LLD+0)
|
||||
|
||||
#endif // GFX_USE_GDISP
|
||||
|
||||
#endif // _GDISP_LLD_CONFIG_H
|
|
@ -55,6 +55,12 @@
|
|||
#define dummy_read(g) { volatile gU16 dummy; dummy = read_data(g); (void) dummy; }
|
||||
#define write_reg(g, reg, data) { write_index(g, reg); write_data(g, data); }
|
||||
|
||||
// Serial write data for fast fill.
|
||||
#ifndef write_data_repeat
|
||||
#define write_data_repeat(g, data, count) { int i; for (i = 0; i < count; ++i) write_data (g, data) }
|
||||
/* TODO: should use DMA mem2mem */
|
||||
#endif
|
||||
|
||||
static void set_cursor(GDisplay *g) {
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
|
@ -78,18 +84,18 @@ static void set_viewport(GDisplay* g) {
|
|||
default:
|
||||
case gOrientation0:
|
||||
case gOrientation180:
|
||||
write_reg(g, 0x50, g->p.x);
|
||||
write_reg(g, 0x51, g->p.x + g->p.cx - 1);
|
||||
write_reg(g, 0x52, g->p.y);
|
||||
write_reg(g, 0x53, g->p.y + g->p.cy - 1);
|
||||
write_reg(g, LGDP4532_HORIZONTAL_WINDOW_ADDR1, g->p.x);
|
||||
write_reg(g, LGDP4532_HORIZONTAL_WINDOW_ADDR2, g->p.x + g->p.cx - 1);
|
||||
write_reg(g, LGDP4532_VERTICAL_WINDOW_ADDR1, g->p.y);
|
||||
write_reg(g, LGDP4532_VERTICAL_WINDOW_ADDR2, g->p.y + g->p.cy - 1);
|
||||
break;
|
||||
|
||||
case gOrientation90:
|
||||
case gOrientation270:
|
||||
write_reg(g, 0x50, g->p.y);
|
||||
write_reg(g, 0x51, g->p.y + g->p.cy - 1);
|
||||
write_reg(g, 0x52, g->p.x);
|
||||
write_reg(g, 0x53, g->p.x + g->p.cx - 1);
|
||||
write_reg(g, LGDP4532_HORIZONTAL_WINDOW_ADDR1, g->p.y);
|
||||
write_reg(g, LGDP4532_HORIZONTAL_WINDOW_ADDR2, g->p.y + g->p.cy - 1);
|
||||
write_reg(g, LGDP4532_VERTICAL_WINDOW_ADDR1, g->p.x);
|
||||
write_reg(g, LGDP4532_VERTICAL_WINDOW_ADDR2, g->p.x + g->p.cx - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -110,8 +116,6 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
|||
acquire_bus(g);
|
||||
setwritemode(g);
|
||||
|
||||
// chinese code starts here
|
||||
//############# void Power_Set(void) ################//
|
||||
write_reg(g, 0x00, 0x0001);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
|
@ -124,25 +128,24 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
|||
write_reg(g, 0x12, 0x0010);
|
||||
gfxSleepMilliseconds(10);
|
||||
write_reg(g, 0x10, 0x2620);
|
||||
write_reg(g, 0x13, 0x344d); //304d
|
||||
write_reg(g, 0x13, 0x344d);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
write_reg(g, 0x01, 0x0100);
|
||||
write_reg(g, 0x02, 0x0300);
|
||||
write_reg(g, 0x03, 0x1038);//0x1030
|
||||
write_reg(g, 0x03, 0x1030);
|
||||
write_reg(g, 0x08, 0x0604);
|
||||
write_reg(g, 0x09, 0x0000);
|
||||
write_reg(g, 0x0A, 0x0008);
|
||||
|
||||
write_reg(g, 0x41, 0x0002);
|
||||
write_reg(g, 0x60, 0xA700);
|
||||
write_reg(g, 0x60, 0x2700);
|
||||
write_reg(g, 0x61, 0x0001);
|
||||
write_reg(g, 0x90, 0x0182);
|
||||
write_reg(g, 0x93, 0x0001);
|
||||
write_reg(g, 0xa3, 0x0010);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
//################# void Gamma_Set(void) ####################//
|
||||
write_reg(g, 0x30, 0x0000);
|
||||
write_reg(g, 0x31, 0x0502);
|
||||
write_reg(g, 0x32, 0x0307);
|
||||
|
@ -155,7 +158,6 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
|||
write_reg(g, 0x39, 0x1505);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
//################## void Display_ON(void) ####################//
|
||||
write_reg(g, 0x07, 0x0001);
|
||||
gfxSleepMilliseconds(10);
|
||||
write_reg(g, 0x07, 0x0021);
|
||||
|
@ -164,7 +166,6 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
|||
write_reg(g, 0x07, 0x0033);
|
||||
gfxSleepMilliseconds(10);
|
||||
write_reg(g, 0x07, 0x0133);
|
||||
// chinese code ends here
|
||||
|
||||
// Finish Init
|
||||
post_init_board(g);
|
||||
|
@ -357,4 +358,36 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
|||
}
|
||||
#endif
|
||||
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
|
||||
set_cursor(g);
|
||||
gdisp_lld_write_color (g);
|
||||
|
||||
}
|
||||
|
||||
#if GDISP_HARDWARE_FILLS
|
||||
LLDSPEC void gdisp_lld_fill_area(GDisplay *g) {
|
||||
LLDCOLOR_TYPE c = gdispColor2Native(g->p.color);
|
||||
|
||||
acquire_bus(g);
|
||||
|
||||
// Set view port if drawing more than 1 line, or write not started
|
||||
if (g->p.cy != 1 || !ws) {
|
||||
set_viewport(g);
|
||||
}
|
||||
|
||||
set_cursor(g);
|
||||
write_data_repeat (g,c,g->p.cx*g->p.cy);
|
||||
|
||||
// Restore view port if write started and drawed more than 1 line
|
||||
if (g->p.cy != 1 && ws)
|
||||
{
|
||||
write_reg(g, LGDP4532_HORIZONTAL_WINDOW_ADDR2, svx);
|
||||
write_reg(g, LGDP4532_HORIZONTAL_WINDOW_ADDR1, svx + svcx - 1);
|
||||
write_reg(g, LGDP4532_VERTICAL_WINDOW_ADDR2, svy);
|
||||
write_reg(g, LGDP4532_VERTICAL_WINDOW_ADDR1, svy + svcy - 1);
|
||||
}
|
||||
release_bus(g);
|
||||
}
|
||||
#endif // GDISP_HARDWARE_FILLS
|
||||
|
||||
#endif /* GFX_USE_GDISP */
|
||||
|
|
|
@ -14,8 +14,18 @@
|
|||
#define GDISP_HARDWARE_STREAM_READ GFXON
|
||||
#define GDISP_HARDWARE_STREAM_POS GFXON
|
||||
#define GDISP_HARDWARE_CONTROL GFXON
|
||||
#define GDISP_HARDWARE_FILLS GFXON
|
||||
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB565
|
||||
|
||||
/* Horizontal Address Start Position */
|
||||
#define LGDP4532_HORIZONTAL_WINDOW_ADDR1 (0x50u)
|
||||
/* Horizontal Address End Position */
|
||||
#define LGDP4532_HORIZONTAL_WINDOW_ADDR2 (0x51u)
|
||||
/* Vertical Address Start Position */
|
||||
#define LGDP4532_VERTICAL_WINDOW_ADDR1 (0x52u)
|
||||
/* Vertical Address End Position */
|
||||
#define LGDP4532_VERTICAL_WINDOW_ADDR2 (0x53u)
|
||||
|
||||
#endif /* GFX_USE_GDISP */
|
||||
#endif /* _GDISP_LLD_CONFIG_H */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Description:
|
||||
|
||||
Driver for OLED with 4-wire serial interface and I²C/SPI interface
|
||||
Driver for OLED with 4-wire serial interface and I2C/SPI interface
|
||||
|
||||
Know restictions:
|
||||
- Driver works only with SSD1306 hooked up over I2C or SPI (include corresponding header)
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.io/license.html
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* The command byte to put in front of each page line.
|
||||
*
|
||||
* If this is defined, each page line is prefixed with the specified value in the locally
|
||||
* maintained framebuffer.
|
||||
*
|
||||
* This can be omitted and handled inside of write_data() manually instead.
|
||||
*/
|
||||
#define SSD1312_PAGE_PREFIX 0x40 // Co = 0, D/C = 1
|
||||
|
||||
static GFXINLINE void init_board(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, gBool state)
|
||||
{
|
||||
(void) g;
|
||||
(void) state;
|
||||
}
|
||||
|
||||
static GFXINLINE void acquire_bus(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void release_bus(GDisplay *g)
|
||||
{
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void write_cmd(GDisplay *g, gU8 *data, gU16 length)
|
||||
{
|
||||
(void) g;
|
||||
(void) data;
|
||||
(void) length;
|
||||
}
|
||||
|
||||
static GFXINLINE void write_data(GDisplay *g, gU8 *data, gU16 length)
|
||||
{
|
||||
(void) g;
|
||||
(void) data;
|
||||
(void) length;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/gdisp_lld_SSD1312.c
|
||||
)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
GFXINC += $(GFXLIB)/drivers/gdisp/SSD1312
|
||||
GFXSRC += $(GFXLIB)/drivers/gdisp/SSD1312/gdisp_lld_SSD1312.c
|
||||
|
|
@ -0,0 +1,391 @@
|
|||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.io/license.html
|
||||
*/
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_SSD1312
|
||||
#include "gdisp_lld_config.h"
|
||||
#include "../../../src/gdisp/gdisp_driver.h"
|
||||
|
||||
#include "board_SSD1312.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifndef GDISP_SCREEN_HEIGHT
|
||||
#define GDISP_SCREEN_HEIGHT 32 // This controller should also support 64 (untested)
|
||||
#endif
|
||||
#ifndef GDISP_SCREEN_WIDTH
|
||||
#define GDISP_SCREEN_WIDTH 128
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_CONTRAST
|
||||
#define GDISP_INITIAL_CONTRAST 100
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_BACKLIGHT
|
||||
#define GDISP_INITIAL_BACKLIGHT 100
|
||||
#endif
|
||||
#ifdef SSD1312_PAGE_PREFIX
|
||||
#define SSD1312_PAGE_WIDTH (GDISP_SCREEN_WIDTH+1)
|
||||
#define SSD1312_PAGE_OFFSET 1
|
||||
#else
|
||||
#define SSD1312_PAGE_WIDTH GDISP_SCREEN_WIDTH
|
||||
#define SSD1312_PAGE_OFFSET 0
|
||||
#endif
|
||||
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
// Some common routines and macros
|
||||
#define RAM(g) ((gU8 *)g->priv)
|
||||
#define xyaddr(x, y) (SSD1312_PAGE_OFFSET + (x) + ((y)>>3)*SSD1312_PAGE_WIDTH)
|
||||
#define xybit(y) (1<<((y)&7))
|
||||
|
||||
#define write_cmd_1(g, a) { gU8 cmd[1]; cmd[0] = a; write_cmd(g, cmd, 1); }
|
||||
#define write_cmd_2(g, a, b) { gU8 cmd[2]; cmd[0] = a; cmd[1] = b; write_cmd(g, cmd, 2); }
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* As this controller can't update on a pixel boundary we need to maintain the
|
||||
* the entire display surface in memory so that we can do the necessary bit
|
||||
* operations. Fortunately it is a small monochrome display.
|
||||
* 64 * 128 / 8 = 1024 bytes.
|
||||
*/
|
||||
|
||||
LLDSPEC gBool gdisp_lld_init(GDisplay *g)
|
||||
{
|
||||
// The private area is the display surface.
|
||||
g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT/8 * SSD1312_PAGE_WIDTH);
|
||||
if (!g->priv)
|
||||
return gFalse;
|
||||
|
||||
// Fill in the prefix command byte on each page line of the display buffer
|
||||
// We can do this during initialisation as we're being careful that this byte is never overwritten.
|
||||
#ifdef SSD1312_PAGE_PREFIX
|
||||
for (unsigned i = 0; i < GDISP_SCREEN_HEIGHT/8 * SSD1312_PAGE_WIDTH; i += SSD1312_PAGE_WIDTH)
|
||||
RAM(g)[i] = SSD1312_PAGE_PREFIX;
|
||||
#endif
|
||||
|
||||
// Initialise the board interface
|
||||
init_board(g);
|
||||
|
||||
// Hardware reset
|
||||
setpin_reset(g, gTrue);
|
||||
gfxSleepMilliseconds(20);
|
||||
setpin_reset(g, gFalse);
|
||||
gfxSleepMilliseconds(200);
|
||||
|
||||
acquire_bus(g);
|
||||
|
||||
// Configuration
|
||||
// This might require display module vendor specific changes
|
||||
{
|
||||
// Display off
|
||||
write_cmd_1(g, 0xAE);
|
||||
|
||||
// Clock divider
|
||||
write_cmd_2(g, 0xD5, 0x80);
|
||||
|
||||
// Multiplex ratio
|
||||
write_cmd_2(g, 0xA8, 0x1F);
|
||||
|
||||
// Display offset
|
||||
write_cmd_2(g, 0xD3, 0x30);
|
||||
|
||||
// Display start line
|
||||
write_cmd_1(g, 0x40);
|
||||
|
||||
// Charge pump
|
||||
write_cmd_2(g, 0x8D, 0x72); // 0x10 if Vcc externally supplied
|
||||
|
||||
// Segment re-map
|
||||
write_cmd_1(g, 0xA1);
|
||||
|
||||
// COM output scan direction
|
||||
write_cmd_1(g, 0xC0);
|
||||
|
||||
// COM pin hardware configuration
|
||||
write_cmd_2(g, 0xDA, 0x10);
|
||||
|
||||
// Set internal/external current reference
|
||||
write_cmd_2(g, 0xAD, 0x50);
|
||||
|
||||
// Set contract
|
||||
write_cmd_2(g, 0x81, 0x17);
|
||||
|
||||
// Set pre-charge period
|
||||
write_cmd_2(g, 0xD9, 0xF1);
|
||||
|
||||
// Set VCOMH select level
|
||||
write_cmd_2(g, 0xDB, 0x30);
|
||||
|
||||
// Set entire display on/off
|
||||
write_cmd_1(g, 0xA4);
|
||||
|
||||
// Set normal/inverse display
|
||||
write_cmd_1(g, 0xA6);
|
||||
|
||||
// Page addressing mode
|
||||
write_cmd_2(g, 0x20, 0x02);
|
||||
|
||||
// Display on
|
||||
write_cmd_1(g, 0xAF);
|
||||
}
|
||||
|
||||
release_bus(g);
|
||||
|
||||
// Finish Init
|
||||
post_init_board(g);
|
||||
|
||||
// Initialise the GDISP structure
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Orientation = gOrientation0;
|
||||
g->g.Powermode = gPowerOn;
|
||||
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
g->g.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
|
||||
return gTrue;
|
||||
}
|
||||
|
||||
#if GDISP_HARDWARE_FLUSH
|
||||
LLDSPEC void gdisp_lld_flush(GDisplay *g)
|
||||
{
|
||||
gU8 * ram;
|
||||
unsigned pages;
|
||||
|
||||
// Only flush if necessary
|
||||
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
|
||||
return;
|
||||
|
||||
ram = RAM(g);
|
||||
pages = GDISP_SCREEN_HEIGHT/8;
|
||||
|
||||
acquire_bus(g);
|
||||
write_cmd_1(g, 0x40 | 0);
|
||||
while (pages--) {
|
||||
write_cmd_1(g, 0xB0 + (((GDISP_SCREEN_HEIGHT/8)-1)-pages));
|
||||
write_cmd_1(g, 0x00);
|
||||
write_cmd_1(g, 0x10);
|
||||
write_data(g, ram, SSD1312_PAGE_WIDTH);
|
||||
ram += SSD1312_PAGE_WIDTH;
|
||||
}
|
||||
release_bus(g);
|
||||
|
||||
g->flags &= ~GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_DRAWPIXEL
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g)
|
||||
{
|
||||
gCoord x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case gOrientation0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case gOrientation90:
|
||||
x = g->p.y;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
|
||||
break;
|
||||
case gOrientation180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
break;
|
||||
case gOrientation270:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.y;
|
||||
y = g->p.x;
|
||||
break;
|
||||
}
|
||||
if (gdispColor2Native(g->p.color) != gdispColor2Native(GFX_BLACK))
|
||||
RAM(g)[xyaddr(x, y)] |= xybit(y);
|
||||
else
|
||||
RAM(g)[xyaddr(x, y)] &= ~xybit(y);
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_PIXELREAD
|
||||
LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g)
|
||||
{
|
||||
gCoord x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case gOrientation0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case gOrientation90:
|
||||
x = g->p.y;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
|
||||
break;
|
||||
case gOrientation180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
break;
|
||||
case gOrientation270:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.y;
|
||||
y = g->p.x;
|
||||
break;
|
||||
}
|
||||
|
||||
return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? GFX_WHITE : GFX_BLACK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_FILLS
|
||||
LLDSPEC void gdisp_lld_fill_area(GDisplay *g)
|
||||
{
|
||||
gCoord sy, ey;
|
||||
gCoord sx, ex;
|
||||
gCoord col;
|
||||
unsigned spage, zpages;
|
||||
gU8 * base;
|
||||
gU8 mask;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case gOrientation0:
|
||||
sx = g->p.x;
|
||||
ex = g->p.x + g->p.cx - 1;
|
||||
sy = g->p.y;
|
||||
ey = sy + g->p.cy - 1;
|
||||
break;
|
||||
case gOrientation90:
|
||||
sx = g->p.y;
|
||||
ex = g->p.y + g->p.cy - 1;
|
||||
sy = GDISP_SCREEN_HEIGHT - g->p.x - g->p.cx;
|
||||
ey = GDISP_SCREEN_HEIGHT-1 - g->p.x;
|
||||
break;
|
||||
case gOrientation180:
|
||||
sx = GDISP_SCREEN_WIDTH - g->p.x - g->p.cx;
|
||||
ex = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
sy = GDISP_SCREEN_HEIGHT - g->p.y - g->p.cy;
|
||||
ey = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
break;
|
||||
case gOrientation270:
|
||||
sx = GDISP_SCREEN_WIDTH - g->p.y - g->p.cy;
|
||||
ex = GDISP_SCREEN_WIDTH-1 - g->p.y;
|
||||
sy = g->p.x;
|
||||
ey = g->p.x + g->p.cx - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
spage = sy / 8;
|
||||
base = RAM(g) + SSD1312_PAGE_OFFSET + SSD1312_PAGE_WIDTH * spage;
|
||||
mask = 0xff << (sy&7);
|
||||
zpages = (ey / 8) - spage;
|
||||
|
||||
if (gdispColor2Native(g->p.color) == gdispColor2Native(GFX_BLACK)) {
|
||||
while (zpages--) {
|
||||
for (col = sx; col <= ex; col++)
|
||||
base[col] &= ~mask;
|
||||
mask = 0xff;
|
||||
base += SSD1312_PAGE_WIDTH;
|
||||
}
|
||||
mask &= (0xff >> (7 - (ey&7)));
|
||||
for (col = sx; col <= ex; col++)
|
||||
base[col] &= ~mask;
|
||||
}
|
||||
else {
|
||||
while (zpages--) {
|
||||
for (col = sx; col <= ex; col++)
|
||||
base[col] |= mask;
|
||||
mask = 0xff;
|
||||
base += SSD1312_PAGE_WIDTH;
|
||||
}
|
||||
mask &= (0xff >> (7 - (ey&7)));
|
||||
for (col = sx; col <= ex; col++)
|
||||
base[col] |= mask;
|
||||
}
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
|
||||
LLDSPEC void gdisp_lld_control(GDisplay *g)
|
||||
{
|
||||
switch(g->p.x) {
|
||||
case GDISP_CONTROL_POWER:
|
||||
if (g->g.Powermode == (gPowermode)g->p.ptr)
|
||||
return;
|
||||
switch((gPowermode)g->p.ptr) {
|
||||
case gPowerOff:
|
||||
case gPowerSleep:
|
||||
case gPowerDeepSleep:
|
||||
acquire_bus(g);
|
||||
write_cmd_1(g, 0xAE);
|
||||
release_bus(g);
|
||||
break;
|
||||
case gPowerOn:
|
||||
acquire_bus(g);
|
||||
write_cmd_1(g, 0xAF);
|
||||
release_bus(g);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Powermode = (gPowermode)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if (g->g.Orientation == (gOrientation)g->p.ptr)
|
||||
return;
|
||||
|
||||
switch((gOrientation)g->p.ptr) {
|
||||
// Rotation is handled by the drawing routines
|
||||
case gOrientation0:
|
||||
case gOrientation180:
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case gOrientation90:
|
||||
case gOrientation270:
|
||||
g->g.Height = GDISP_SCREEN_WIDTH;
|
||||
g->g.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
g->g.Orientation = (gOrientation)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_CONTRAST:
|
||||
if ((unsigned)g->p.ptr > 100)
|
||||
g->p.ptr = (void *)100;
|
||||
acquire_bus(g);
|
||||
write_cmd_2(g, 0x81, (((unsigned)g->p.ptr)<<8)/101);
|
||||
release_bus(g);
|
||||
g->g.Contrast = (unsigned)g->p.ptr;
|
||||
return;
|
||||
|
||||
// Our own special controller code to inverse the display
|
||||
// 0 = normal, 1 = inverse
|
||||
case GDISP_CONTROL_INVERSE:
|
||||
acquire_bus(g);
|
||||
write_cmd_1(g, g->p.ptr ? 0xA7: 0xA6);
|
||||
release_bus(g);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GDISP_NEED_CONTROL
|
||||
|
||||
#endif // GFX_USE_GDISP
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.io/license.html
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_CONFIG_H
|
||||
#define _GDISP_LLD_CONFIG_H
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver hardware support. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define GDISP_HARDWARE_FLUSH GFXON // This controller requires flushing
|
||||
#define GDISP_HARDWARE_DRAWPIXEL GFXON
|
||||
#define GDISP_HARDWARE_PIXELREAD GFXON
|
||||
#define GDISP_HARDWARE_CONTROL GFXON
|
||||
#define GDISP_HARDWARE_FILLS GFXON
|
||||
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
|
||||
|
||||
// This controller supports a special gdispControl() to inverse the display.
|
||||
// Pass a parameter of 1 for inverse and 0 for normal.
|
||||
#define GDISP_CONTROL_INVERSE (GDISP_CONTROL_LLD+0)
|
||||
|
||||
#endif // GFX_USE_GDISP
|
||||
|
||||
#endif // _GDISP_LLD_CONFIG_H
|
|
@ -0,0 +1,3 @@
|
|||
GFXINC += $(GFXLIB)/drivers/gdisp/SSD1322
|
||||
GFXSRC += $(GFXLIB)/drivers/gdisp/SSD1322/gdisp_lld_SSD1322.c
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/gdisp_lld_STM32LTDC.c
|
||||
)
|
|
@ -301,6 +301,8 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay* g) {
|
|||
|
||||
#if GDISP_NEED_CONTROL
|
||||
switch(g->g.Orientation) {
|
||||
case gOrientationPortrait:
|
||||
case gOrientationLandscape:
|
||||
case gOrientation0:
|
||||
default:
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
|
@ -339,6 +341,8 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
|
||||
#if GDISP_NEED_CONTROL
|
||||
switch(g->g.Orientation) {
|
||||
case gOrientationPortrait:
|
||||
case gOrientationLandscape:
|
||||
case gOrientation0:
|
||||
default:
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
|
@ -400,6 +404,8 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
g->g.Height = tmp;
|
||||
}
|
||||
break;
|
||||
case gOrientationPortrait:
|
||||
case gOrientationLandscape:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -474,6 +480,8 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
|
||||
#if GDISP_NEED_CONTROL
|
||||
switch(g->g.Orientation) {
|
||||
case gOrientationPortrait:
|
||||
case gOrientationLandscape:
|
||||
case gOrientation0:
|
||||
default:
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
|
|
|
@ -13,6 +13,7 @@ To use this driver:
|
|||
3. Add a `board_STM32LTDC.h` to you project directory (or board directory)
|
||||
based on one of the templates.
|
||||
|
||||
|
||||
# Configuration
|
||||
Configuration options available in `gfxconf.h`:
|
||||
|
||||
|
@ -24,6 +25,7 @@ Configuration options available in `gfxconf.h`:
|
|||
| `STM32LTDC_USE_DOUBLEBUFFERING` | `GFXOFF` | Whether to use double buffering. See the corresponding section below. |
|
||||
| `STM32LTDC_USE_RGB565` | `GFXOFF` | Whether to use RGB565 instead of RGB888. |
|
||||
|
||||
|
||||
# 2nd layer
|
||||
To use the 2nd LTDC layer:
|
||||
- set `STM32LTDC_USE_LAYER2` to `GFXON` in `gfxconf.h`.
|
||||
|
@ -35,6 +37,7 @@ For more information, see:
|
|||
- https://wiki.ugfx.io/index.php/Multiple_displays#Example_-_Same_controller
|
||||
- https://wiki.ugfx.io/index.php/Multiple_displays#Access_the_displays
|
||||
|
||||
|
||||
# Double buffering
|
||||
To use double buffering:
|
||||
- set `STM32LTDC_USE_DOUBLEBUFFERING` to `GFXON` in `gfxconf.h`.
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/gdisp_lld_framebuffer.c
|
||||
)
|
||||
|
|
@ -24,6 +24,7 @@ S6D1121 - Mid-sized color LCD displays eg RGB565 320x240
|
|||
SPFD54124B - Mid-sized color LCD displays eg RGB565 320x240
|
||||
SSD1289 - Mid-sized color LCD displays eg RGB565 320x240
|
||||
SSD1306 - Small monochrome LCD
|
||||
SSD1312 - Small monochrome LCD (usually 128x32 or 128x64 OLED)
|
||||
SSD1322 - Small 16 level grayscale LCD
|
||||
SSD1331 - Small hardware accelerated OLED display RGB565 96x64
|
||||
SSD1351 - Mid-sized color LCD displays eg RGB565 320x240
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/gmouse_lld_linux_event.c
|
||||
)
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/drivers/multiple/SDL)
|
||||
|
||||
# Defaults
|
||||
if (NOT UGFX_DEPENDENCY_SDL2_DOWNLOAD)
|
||||
set(UGFX_DEPENDENCY_SDL2_DOWNLOAD OFF)
|
||||
endif()
|
||||
|
||||
# Get or find SDL2
|
||||
if (UGFX_DEPENDENCY_SDL2_DOWNLOAD)
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
SDL2
|
||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL
|
||||
GIT_TAG release-2.26.5
|
||||
)
|
||||
FetchContent_MakeAvailable(SDL2)
|
||||
|
||||
if (NOT UGFX_DEPENDENCY_SDL2_TARGET)
|
||||
set(UGFX_DEPENDENCY_SDL2_TARGET SDL2-static)
|
||||
endif()
|
||||
else()
|
||||
find_package(
|
||||
SDL2
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
if (NOT UGFX_DEPENDENCY_SDL2_TARGET)
|
||||
set(UGFX_DEPENDENCY_SDL2_TARGET SDL2::SDL2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gdisp_lld_SDL.c
|
||||
)
|
||||
|
||||
list(APPEND ugfx_DEFS
|
||||
GFX_OS_PRE_INIT_FUNCTION=sdl_driver_init
|
||||
)
|
||||
|
||||
list(APPEND ugfx_LIBS
|
||||
${UGFX_DEPENDENCY_SDL2_TARGET}
|
||||
)
|
||||
|
|
@ -174,8 +174,8 @@ static struct SDL_UGFXContext *context;
|
|||
static sem_t *ctx_mutex;
|
||||
static sem_t *input_event;
|
||||
|
||||
#define CTX_MUTEX_NAME "ugfx_ctx_mutex"
|
||||
#define INPUT_EVENT_NAME "ugfx_input_event"
|
||||
#define CTX_MUTEX_NAME "/ugfx_ctx_mutex"
|
||||
#define INPUT_EVENT_NAME "/ugfx_input_event"
|
||||
|
||||
|
||||
static int SDL_loop (void) {
|
||||
|
@ -311,12 +311,12 @@ static void *SDL_input_event_loop (void *arg) {
|
|||
// Must be executed on early stage of initialization: before threads and timer
|
||||
|
||||
void sdl_driver_init (void) {
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING) != 0){
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) != 0){
|
||||
fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
|
||||
exit (1) ;
|
||||
}
|
||||
|
||||
if ((context = (struct SDL_UGFXContext*) mmap (0,sizeof (struct SDL_UGFXContext ),PROT_WRITE|PROT_READ,(MAP_ANONYMOUS | MAP_SHARED),0,0)) ==MAP_FAILED) {
|
||||
if ((context = (struct SDL_UGFXContext*) mmap (0, sizeof(struct SDL_UGFXContext), PROT_WRITE|PROT_READ, (MAP_ANONYMOUS | MAP_SHARED), -1, 0)) == MAP_FAILED) {
|
||||
perror("Failed to allocate shared memory");
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -24,3 +24,4 @@ and a touchscreen driver.
|
|||
|
||||
4. Modify your makefile to add `sdl2-config --libs --cflags` to the CFLAGS line. i.e.
|
||||
CFLAGS = `sdl2-config --libs --cflags`
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/drivers/multiple/Win32)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gdisp_lld_Win32.c
|
||||
)
|
||||
|
||||
list(APPEND ugfx_LIBS
|
||||
gdi32
|
||||
)
|
|
@ -647,12 +647,30 @@ static LRESULT myWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|||
#endif
|
||||
|
||||
#if GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD
|
||||
case WM_ACTIVATE:
|
||||
// Copy the lock key states into the uGFX keyboard as it might have changed while we were away
|
||||
// For simplicity we do this on both activate and deactivate.
|
||||
if (keyboard && keyboard->pLayout) {
|
||||
if (GetKeyState(VK_NUMLOCK) & 1)
|
||||
keyboard->keystate |= GKEYSTATE_NUMLOCK;
|
||||
else
|
||||
keyboard->keystate &= ~GKEYSTATE_NUMLOCK;
|
||||
if (GetKeyState(VK_CAPITAL) & 1)
|
||||
keyboard->keystate |= GKEYSTATE_CAPSLOCK;
|
||||
else
|
||||
keyboard->keystate &= ~GKEYSTATE_CAPSLOCK;
|
||||
if (GetKeyState(VK_SCROLL) & 1)
|
||||
keyboard->keystate |= GKEYSTATE_SCROLLLOCK;
|
||||
else
|
||||
keyboard->keystate &= ~GKEYSTATE_SCROLLLOCK;
|
||||
}
|
||||
break;
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_SYSKEYUP:
|
||||
case WM_KEYDOWN:
|
||||
case WM_KEYUP:
|
||||
// A layout is being used: Send scan codes to the keyboard buffer
|
||||
if (keyboard && keyboard->pLayout && keypos < (int)sizeof(keybuffer)-1 && (wParam & 0xFF) > 0x01) {
|
||||
if (keyboard && keyboard->pLayout && keypos < (int)sizeof(keybuffer)-1 && (wParam & 0xFF) >= VK_BACK) {
|
||||
if (Msg == WM_KEYUP || Msg == WM_SYSKEYUP)
|
||||
keybuffer[keypos++] = 0x00; // Keyup
|
||||
else if (HIWORD(lParam) & KF_REPEAT)
|
||||
|
@ -1279,11 +1297,17 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
|||
gPixel * buffer;
|
||||
RECT rect;
|
||||
BITMAPV4HEADER bmpInfo;
|
||||
#if GDISP_NEED_CONTROL
|
||||
gPixel* bufferBase;
|
||||
#endif
|
||||
|
||||
// Make everything relative to the start of the line
|
||||
priv = g->priv;
|
||||
buffer = g->p.ptr;
|
||||
buffer += g->p.x2*g->p.y1;
|
||||
buffer += g->p.x2 * g->p.y1 + g->p.x1;
|
||||
#if GDISP_NEED_CONTROL
|
||||
bufferBase = buffer; // Keep pointer to original buffer for correct free()-ing later on
|
||||
#endif
|
||||
|
||||
memset(&bmpInfo, 0, sizeof(bmpInfo));
|
||||
bmpInfo.bV4Size = sizeof(bmpInfo);
|
||||
|
@ -1369,7 +1393,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
|||
#endif
|
||||
|
||||
#if GDISP_NEED_CONTROL
|
||||
if (buffer != (gPixel *)g->p.ptr)
|
||||
if (bufferBase != buffer)
|
||||
free(buffer);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/drivers/multiple/X)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gdisp_lld_X.c
|
||||
)
|
||||
|
||||
list(APPEND ugfx_LIBS
|
||||
X11
|
||||
)
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
// #define GFX_FREERTOS_USE_TRACE GFXOFF
|
||||
//#define GFX_USE_OS_WIN32 GFXOFF
|
||||
//#define GFX_USE_OS_LINUX GFXOFF
|
||||
//#define GFX_USE_OS_FREEBSD GFXOFF
|
||||
//#define GFX_USE_OS_OSX GFXOFF
|
||||
//#define GFX_USE_OS_ECOS GFXOFF
|
||||
//#define GFX_USE_OS_RAWRTOS GFXOFF
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gadc)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gadc.c
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gaudio)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gaudio.c
|
||||
)
|
|
@ -569,9 +569,9 @@ void _gdispInit(void)
|
|||
#if defined(GDISP_DRIVER_LIST)
|
||||
{
|
||||
unsigned i;
|
||||
typedef const GDISPVMT const GDISPVMTLIST[1];
|
||||
typedef const GDISPVMT GDISPVMTLIST[1];
|
||||
|
||||
static const GDISPVMT * const dclist[] = {GDISP_DRIVER_LIST};
|
||||
static const GDISPVMT* dclist[] = { GDISP_DRIVER_LIST };
|
||||
|
||||
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) {
|
||||
if (!(dclist[i]->d.flags & GDISP_VFLG_DYNAMICONLY))
|
||||
|
@ -2885,6 +2885,10 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
|
|||
case gOrientationPortrait:
|
||||
g->p.ptr = g->g.Width >= g->g.Height ? (void *)gOrientation90 : (void *)gOrientation0;
|
||||
break;
|
||||
case gOrientation0:
|
||||
case gOrientation90:
|
||||
case gOrientation180:
|
||||
case gOrientation270:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gdisp)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
${ROOT_PATH}/mcufont
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gdisp.c
|
||||
${ROOT_PATH}/gdisp_fonts.c
|
||||
${ROOT_PATH}/gdisp_pixmap.c
|
||||
${ROOT_PATH}/gdisp_image.c
|
||||
${ROOT_PATH}/gdisp_image_native.c
|
||||
${ROOT_PATH}/gdisp_image_gif.c
|
||||
${ROOT_PATH}/gdisp_image_bmp.c
|
||||
${ROOT_PATH}/gdisp_image_jpg.c
|
||||
${ROOT_PATH}/gdisp_image_png.c
|
||||
|
||||
${ROOT_PATH}/mcufont/mf_encoding.c
|
||||
${ROOT_PATH}/mcufont/mf_font.c
|
||||
${ROOT_PATH}/mcufont/mf_justify.c
|
||||
${ROOT_PATH}/mcufont/mf_kerning.c
|
||||
${ROOT_PATH}/mcufont/mf_rlefont.c
|
||||
${ROOT_PATH}/mcufont/mf_bwfont.c
|
||||
${ROOT_PATH}/mcufont/mf_scaledfont.c
|
||||
${ROOT_PATH}/mcufont/mf_wordwrap.c
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gdriver)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gdriver.c
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gevent)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gevent.c
|
||||
)
|
|
@ -0,0 +1,24 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gfile)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gfile.c
|
||||
${ROOT_PATH}/gfile_fs_native.c
|
||||
${ROOT_PATH}/gfile_fs_ram.c
|
||||
${ROOT_PATH}/gfile_fs_rom.c
|
||||
${ROOT_PATH}/gfile_fs_fatfs.c
|
||||
${ROOT_PATH}/gfile_fs_petitfs.c
|
||||
${ROOT_PATH}/gfile_fs_mem.c
|
||||
${ROOT_PATH}/gfile_fs_chibios.c
|
||||
${ROOT_PATH}/gfile_fs_strings.c
|
||||
${ROOT_PATH}/gfile_printg.c
|
||||
${ROOT_PATH}/gfile_scang.c
|
||||
${ROOT_PATH}/gfile_stdio.c
|
||||
${ROOT_PATH}/gfile_fatfs_wrapper.c
|
||||
${ROOT_PATH}/gfile_fatfs_diskio_chibios.c
|
||||
${ROOT_PATH}/gfile_petitfs_wrapper.c
|
||||
${ROOT_PATH}/gfile_petitfs_diskio_chibios.c
|
||||
)
|
|
@ -54,7 +54,8 @@ static char *ltoa_wd(char *p, long num, unsigned radix, long divisor) {
|
|||
|
||||
int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) {
|
||||
int ret;
|
||||
char *p, *s, c, filler;
|
||||
char *p, c, filler;
|
||||
const char *s;
|
||||
int i, precision, width;
|
||||
gBool is_long, left_align;
|
||||
long l;
|
||||
|
@ -80,7 +81,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) {
|
|||
}
|
||||
fmt++;
|
||||
|
||||
p = s = tmpbuf;
|
||||
s = p = tmpbuf;
|
||||
left_align = gFalse;
|
||||
filler = ' ';
|
||||
width = 0;
|
||||
|
@ -140,7 +141,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) {
|
|||
s = "(null)";
|
||||
if (precision == 0)
|
||||
precision = 32767;
|
||||
for (p = s; *p && (--precision >= 0); p++);
|
||||
for (p = (char*)s; *p && (--precision >= 0); p++);
|
||||
break;
|
||||
case 'D':
|
||||
case 'd':
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/ginput)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/ginput.c
|
||||
${ROOT_PATH}/ginput_mouse.c
|
||||
${ROOT_PATH}/ginput_keyboard.c
|
||||
${ROOT_PATH}/ginput_keyboard_microcode.c
|
||||
${ROOT_PATH}/ginput_toggle.c
|
||||
${ROOT_PATH}/ginput_dial.c
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gmisc)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gmisc.c
|
||||
${ROOT_PATH}/gmisc_arrayops.c
|
||||
${ROOT_PATH}/gmisc_matrix2d.c
|
||||
${ROOT_PATH}/gmisc_trig.c
|
||||
${ROOT_PATH}/gmisc_hittest.c
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gos)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gos_chibios.c
|
||||
${ROOT_PATH}/gos_freertos.c
|
||||
${ROOT_PATH}/gos_win32.c
|
||||
${ROOT_PATH}/gos_linux.c
|
||||
${ROOT_PATH}/gos_osx.c
|
||||
${ROOT_PATH}/gos_raw32.c
|
||||
${ROOT_PATH}/gos_ecos.c
|
||||
${ROOT_PATH}/gos_rawrtos.c
|
||||
${ROOT_PATH}/gos_arduino.c
|
||||
${ROOT_PATH}/gos_cmsis.c
|
||||
${ROOT_PATH}/gos_nios.c
|
||||
${ROOT_PATH}/gos_zephyr.c
|
||||
${ROOT_PATH}/gos_x_threads.c
|
||||
${ROOT_PATH}/gos_x_heap.c
|
||||
)
|
|
@ -468,6 +468,8 @@
|
|||
#include "gos_win32.h"
|
||||
#elif GFX_USE_OS_LINUX
|
||||
#include "gos_linux.h"
|
||||
#elif GFX_USE_OS_FREEBSD
|
||||
#include "gos_linux.h"
|
||||
#elif GFX_USE_OS_OSX
|
||||
#include "gos_osx.h"
|
||||
#elif GFX_USE_OS_RAW32
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#if CH_KERNEL_MAJOR < 2 || CH_KERNEL_MAJOR > 6
|
||||
#if CH_KERNEL_MAJOR < 2 || CH_KERNEL_MAJOR > 7
|
||||
#error "GOS: Unsupported version of ChibiOS"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -49,7 +49,12 @@ typedef tprio_t gThreadpriority;
|
|||
|
||||
#define GFX_THREAD_STACK(name, sz) WORKING_AREA(name, sz)
|
||||
#define GFX_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
|
||||
|
||||
#if CH_KERNEL_MAJOR >= 6
|
||||
#define gfxThreadReturn(retval) return
|
||||
#else
|
||||
#define gfxThreadReturn(retval) return retval
|
||||
#endif
|
||||
|
||||
#if CH_KERNEL_MAJOR <= 2
|
||||
typedef struct {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "../../gfx.h"
|
||||
|
||||
#if GFX_USE_OS_LINUX
|
||||
#if GFX_USE_OS_LINUX || GFX_USE_OS_FREEBSD
|
||||
|
||||
// Linux seems to have deprecated pthread_yield() and now says to use sched_yield()
|
||||
#define USE_SCHED_NOT_PTHREAD_YIELD GFXON
|
||||
|
@ -238,4 +238,4 @@ gThreadreturn gfxThreadWait(gThread thread) {
|
|||
}
|
||||
#endif // GFX_USE_POSIX_SEMAPHORES
|
||||
|
||||
#endif /* GFX_USE_OS_LINUX */
|
||||
#endif /* GFX_USE_OS_LINUX || GFX_USE_OS_FREEBSD */
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#ifndef _GOS_LINUX_H
|
||||
#define _GOS_LINUX_H
|
||||
|
||||
#if GFX_USE_OS_LINUX
|
||||
#if GFX_USE_OS_LINUX || GFX_USE_OS_FREEBSD
|
||||
|
||||
// We don't put this in the general sys_options.h as it is Linux specific.
|
||||
#ifndef GFX_USE_POSIX_SEMAPHORES
|
||||
|
@ -88,6 +88,6 @@ void gfxSemSignal(gSem *psem);
|
|||
gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, GFX_THREAD_FUNCTION((*fn),p), void *param);
|
||||
gThreadreturn gfxThreadWait(gThread thread);
|
||||
|
||||
#endif /* GFX_USE_OS_LINUX */
|
||||
#endif /* GFX_USE_OS_LINUX || GFX_USE_OS_FREEBSD */
|
||||
|
||||
#endif /* _GOS_LINUX_H */
|
||||
|
|
|
@ -48,6 +48,13 @@
|
|||
#ifndef GFX_USE_OS_LINUX
|
||||
#define GFX_USE_OS_LINUX GFXOFF
|
||||
#endif
|
||||
/**
|
||||
* @brief Use a FreeBSD based system running X11
|
||||
* @details Defaults to GFXOFF
|
||||
*/
|
||||
#ifndef GFX_USE_OS_FREEBSD
|
||||
#define GFX_USE_OS_FREEBSD GFXOFF
|
||||
#endif
|
||||
/**
|
||||
* @brief Use a Mac OS-X based system
|
||||
* @details Defaults to GFXOFF
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
#ifndef _GOS_RULES_H
|
||||
#define _GOS_RULES_H
|
||||
|
||||
#if !GFX_USE_OS_CHIBIOS && !GFX_USE_OS_WIN32 && !GFX_USE_OS_LINUX && !GFX_USE_OS_OSX && !GFX_USE_OS_RAW32 && !GFX_USE_OS_FREERTOS && !GFX_USE_OS_ECOS && !GFX_USE_OS_RAWRTOS && !GFX_USE_OS_ARDUINO && !GFX_USE_OS_CMSIS && !GFX_USE_OS_CMSIS2 && !GFX_USE_OS_KEIL && !GFX_USE_OS_RTX5 && !GFX_USE_OS_NIOS && !GFX_USE_OS_ZEPHYR && !GFX_USE_OS_QT
|
||||
#if !GFX_USE_OS_CHIBIOS && !GFX_USE_OS_WIN32 && !GFX_USE_OS_LINUX && !GFX_USE_OS_FREEBSD && !GFX_USE_OS_OSX && !GFX_USE_OS_RAW32 && !GFX_USE_OS_FREERTOS && !GFX_USE_OS_ECOS && !GFX_USE_OS_RAWRTOS && !GFX_USE_OS_ARDUINO && !GFX_USE_OS_CMSIS && !GFX_USE_OS_CMSIS2 && !GFX_USE_OS_KEIL && !GFX_USE_OS_RTX5 && !GFX_USE_OS_NIOS && !GFX_USE_OS_ZEPHYR && !GFX_USE_OS_QT
|
||||
#error "GOS: No operating system has been defined."
|
||||
#endif
|
||||
|
||||
#if GFX_USE_OS_CHIBIOS + GFX_USE_OS_WIN32 + GFX_USE_OS_LINUX + GFX_USE_OS_OSX + GFX_USE_OS_RAW32 + GFX_USE_OS_FREERTOS + GFX_USE_OS_ECOS + GFX_USE_OS_RAWRTOS + GFX_USE_OS_ARDUINO + GFX_USE_OS_CMSIS + GFX_USE_OS_CMSIS2 + GFX_USE_OS_KEIL + GFX_USE_OS_RTX5 + GFX_USE_OS_NIOS + GFX_USE_OS_ZEPHYR + GFX_USE_OS_QT != 1 * GFXON
|
||||
#if GFX_USE_OS_CHIBIOS + GFX_USE_OS_WIN32 + GFX_USE_OS_LINUX + GFX_USE_OS_FREEBSD + GFX_USE_OS_OSX + GFX_USE_OS_RAW32 + GFX_USE_OS_FREERTOS + GFX_USE_OS_ECOS + GFX_USE_OS_RAWRTOS + GFX_USE_OS_ARDUINO + GFX_USE_OS_CMSIS + GFX_USE_OS_CMSIS2 + GFX_USE_OS_KEIL + GFX_USE_OS_RTX5 + GFX_USE_OS_NIOS + GFX_USE_OS_ZEPHYR + GFX_USE_OS_QT != 1 * GFXON
|
||||
#error "GOS: More than one operation system has been defined as GFXON."
|
||||
#endif
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
|||
#endif
|
||||
|
||||
#if GFX_EMULATE_MALLOC
|
||||
#if GFX_USE_OS_WIN32 || GFX_USE_OS_LINUX || GFX_USE_OS_OSX || GFX_USE_OS_ECOS || \
|
||||
#if GFX_USE_OS_WIN32 || GFX_USE_OS_LINUX || GFX_USE_OS_FREEBSD || GFX_USE_OS_OSX || GFX_USE_OS_ECOS || \
|
||||
(GFX_OS_HEAP_SIZE == 0 && (GFX_USE_OS_RAW32 || GFX_USE_OS_ARDUINO || GFX_USE_OS_CMSIS || GFX_USE_OS_CMSIS2 || GFX_USE_OS_KEIL || GFX_USE_OS_RTX5))
|
||||
#if GFX_DISPLAY_RULE_WARNINGS
|
||||
#if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
|
||||
|
|
|
@ -321,7 +321,7 @@ void _gqueueDeinit(void)
|
|||
}
|
||||
|
||||
gBool gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gDelay ms) {
|
||||
if (!pitem) return; // Safety
|
||||
if (!pitem) return gFalse; // Safety
|
||||
gfxSemInit(&pitem->sem, 0, 1);
|
||||
pitem->next = 0;
|
||||
|
||||
|
@ -340,7 +340,7 @@ void _gqueueDeinit(void)
|
|||
}
|
||||
|
||||
gBool gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gDelay ms) {
|
||||
if (!pitem) return; // Safety
|
||||
if (!pitem) return gFalse; // Safety
|
||||
gfxSemInit(&pitem->sem, 0, 1);
|
||||
|
||||
gfxSystemLock();
|
||||
|
@ -356,7 +356,7 @@ void _gqueueDeinit(void)
|
|||
}
|
||||
|
||||
gBool gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueFSyncItem *pafter, gDelay ms) {
|
||||
if (!pitem) return; // Safety
|
||||
if (!pitem) return gFalse; // Safety
|
||||
gfxSemInit(&pitem->sem, 0, 1);
|
||||
|
||||
gfxSystemLock();
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gqueue)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gqueue.c
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gtimer)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gtimer.c
|
||||
)
|
|
@ -51,7 +51,7 @@ const char* gtransString(const char* string)
|
|||
return _languageCurrent->strings[i];
|
||||
}
|
||||
|
||||
const char* gtransIndex(unsigned index)
|
||||
const char* gtransIndex(gU32 index)
|
||||
{
|
||||
if (!_languageCurrent) {
|
||||
return 0;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gtrans)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gtrans.c
|
||||
)
|
|
@ -27,7 +27,7 @@
|
|||
* @brief A table containing translated strings.
|
||||
*/
|
||||
typedef struct transTable {
|
||||
unsigned numEntries; /**< The number of strings that this table contains */
|
||||
gU32 numEntries; /**< The number of strings that this table contains */
|
||||
const char** strings; /**< The translated strings */
|
||||
} transTable;
|
||||
|
||||
|
@ -59,7 +59,7 @@ const char* gtransString(const char* string);
|
|||
*
|
||||
* @return The string at the given index of the current language or 0 if it doesn't exist.
|
||||
*/
|
||||
const char* gtransIndex(unsigned index);
|
||||
const char* gtransIndex(gU32 index);
|
||||
|
||||
/**
|
||||
* @brief Set the base language.
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
set(ROOT_PATH ${UGFX_ROOT}/src/gwin)
|
||||
|
||||
list(APPEND ugfx_INCLUDE_DIRS
|
||||
${ROOT_PATH}
|
||||
${UGFX_ROOT}/3rdparty/tinygl-0.4-ugfx/include
|
||||
)
|
||||
|
||||
list(APPEND ugfx_SOURCES
|
||||
${ROOT_PATH}/gwin.c
|
||||
${ROOT_PATH}/gwin_widget.c
|
||||
${ROOT_PATH}/gwin_wm.c
|
||||
${ROOT_PATH}/gwin_console.c
|
||||
${ROOT_PATH}/gwin_graph.c
|
||||
${ROOT_PATH}/gwin_button.c
|
||||
${ROOT_PATH}/gwin_slider.c
|
||||
${ROOT_PATH}/gwin_checkbox.c
|
||||
${ROOT_PATH}/gwin_image.c
|
||||
${ROOT_PATH}/gwin_label.c
|
||||
${ROOT_PATH}/gwin_radio.c
|
||||
${ROOT_PATH}/gwin_list.c
|
||||
${ROOT_PATH}/gwin_progressbar.c
|
||||
${ROOT_PATH}/gwin_progressbar.c
|
||||
${ROOT_PATH}/gwin_container.c
|
||||
${ROOT_PATH}/gwin_frame.c
|
||||
${ROOT_PATH}/gwin_tabset.c
|
||||
${ROOT_PATH}/gwin_gl3d.c
|
||||
${ROOT_PATH}/gwin_keyboard.c
|
||||
${ROOT_PATH}/gwin_keyboard_layout.c
|
||||
${ROOT_PATH}/gwin_textedit.c
|
||||
)
|
|
@ -61,6 +61,10 @@ typedef struct gwinVMT {
|
|||
} gwinVMT;
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if GWIN_NEED_WIDGET || defined(__DOXYGEN__)
|
||||
|
||||
/**
|
||||
|
@ -442,6 +446,10 @@ gBool _gwinWMAdd(GHandle gh, const GWindowInit *pInit);
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GFX_USE_GWIN */
|
||||
|
||||
#endif /* _CLASS_GWIN_H */
|
||||
|
|
|
@ -116,6 +116,10 @@ ifeq ($(basename $(OPT_OS)),osx)
|
|||
EXEFILE = $(BUILDDIR)/$(PROJECT)
|
||||
TARGETS = $(EXEFILE)
|
||||
endif
|
||||
ifeq ($(basename $(OPT_OS)),freebsd)
|
||||
EXEFILE = $(BUILDDIR)/$(PROJECT)
|
||||
TARGETS = $(EXEFILE)
|
||||
endif
|
||||
ifeq ($(EXEFILE),)
|
||||
LDFLAGS += -nostartfiles
|
||||
EXEFILE = $(BUILDDIR)/$(PROJECT).elf
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# This file is subject to the terms of the GFX License. If a copy of
|
||||
# the license was not distributed with this file, you can obtain one at:
|
||||
#
|
||||
# http://ugfx.io/license.html
|
||||
#
|
||||
|
||||
# See readme.txt for the make API
|
||||
|
||||
# Requirements:
|
||||
#
|
||||
# NONE
|
||||
#
|
||||
|
||||
LDFLAGS += -pthread
|
||||
|
|
@ -15,7 +15,7 @@ OPT_GENERATE_MAP=no|yes - Generate a map file - default no
|
|||
OPT_COPY_EXE=no|yes - Copy the final program to the local project directory - default no
|
||||
OPT_NONSTANDARD_FLAGS=no - Turn off adding the standard compiler language flags - default no
|
||||
OPT_LINK_OPTIMIZE=no - Remove unused code/data during link - default no
|
||||
OPT_OS=win32|win32.raw32|win32.chibios|linux|osx|chibios|freertos|ecos|raw32|rawrtos - Mandatory: The operating system
|
||||
OPT_OS=win32|win32.raw32|win32.chibios|linux|freebsd|osx|chibios|freertos|ecos|raw32|rawrtos - Mandatory: The operating system
|
||||
OPT_CPU=x86|x64|stm32m1|stm32m4|stm32m7|at91sam7|armv6|raspberrypi - Add some cpu dependant flags
|
||||
|
||||
BUILDDIR - Build Directory - default is ".build" or "bin/Debug" or "bin/Release" depending on the target
|
||||
|
|
Loading…
Reference in New Issue