Browse Source

Новыя либа пока не выводит текст нормально.

unknown 1 month ago
parent
commit
cd442456be

+ 61 - 0
desk/libs/thirdparty/oled/DEV_Config.c

@@ -0,0 +1,61 @@
+/******************************************************************************
+**************************Hardware interface layer*****************************
+* | file      		:	DEV_Config.c
+* |	version			:	V1.0
+* | date			:	2020-06-17
+* | function		:	Provide the hardware underlying interface	
+******************************************************************************/
+#include "DEV_Config.h"
+#include <stdio.h>		//printf()
+#include <string.h>
+#include <stdlib.h>
+
+/********************************************************************************
+function:	System Init
+note:
+	Initialize the communication method
+********************************************************************************/
+uint8_t System_Init(void)
+{
+  return 0;
+}
+
+void System_Exit(void)
+{
+
+}
+/********************************************************************************
+function:	Hardware interface
+note:
+	SPI4W_Write_Byte(value) : 
+		HAL library hardware SPI
+		Register hardware SPI
+		Gpio analog SPI
+	I2C_Write_Byte(value, cmd):
+		HAL library hardware I2C
+********************************************************************************/
+uint8_t SPI4W_Write_Byte(uint8_t value)
+{
+    return 0;
+}
+
+void I2C_Write_Byte(uint8_t value, uint8_t Cmd)
+{
+}
+
+/********************************************************************************
+function:	Delay function
+note:
+	Driver_Delay_ms(xms) : Delay x ms
+	Driver_Delay_us(xus) : Delay x us
+********************************************************************************/
+void Driver_Delay_ms(uint32_t xms)
+{
+    HAL_Delay(xms);
+}
+
+void Driver_Delay_us(uint32_t xus)
+{
+    int j;
+    for(j=xus; j > 0; j--);
+}

+ 60 - 0
desk/libs/thirdparty/oled/DEV_Config.h

@@ -0,0 +1,60 @@
+/******************************************************************************
+**************************Hardware interface layer*****************************
+* | file      		:	DEV_Config.c
+* |	version			:	V1.0
+* | date			:	2020-06-17
+* | function		:	Provide the hardware underlying interface	
+******************************************************************************/
+#ifndef _DEV_CONFIG_H_
+#define _DEV_CONFIG_H_
+
+#include "stm32g4xx_hal.h"
+//#include "stm32f1xx_hal_gpio.h"
+#include "main.h"
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * data
+**/
+#define UBYTE   uint8_t
+#define UWORD   uint16_t
+#define UDOUBLE uint32_t
+
+#define USE_SPI_4W 		1
+#define USE_IIC 		0
+#define USE_IIC_SOFT	0
+
+#define I2C_ADR	0X3C //Hardware setting 0X3C or 0X3D
+
+#define IIC_CMD		0X00
+#define IIC_RAM		0X40
+
+//OLED GPIO
+//#define OLED_CS_0		HAL_GPIO_WritePin(OLED_CS_GPIO_Port, OLED_CS_Pin, GPIO_PIN_RESET)
+//#define OLED_CS_1		HAL_GPIO_WritePin(OLED_CS_GPIO_Port, OLED_CS_Pin, GPIO_PIN_SET)
+
+//#define OLED_DC_0		HAL_GPIO_WritePin(OLED_DC_GPIO_Port, OLED_DC_Pin, GPIO_PIN_RESET)
+//#define OLED_DC_1		HAL_GPIO_WritePin(OLED_DC_GPIO_Port, OLED_DC_Pin, GPIO_PIN_SET)
+
+//#define OLED_RST_0		HAL_GPIO_WritePin(OLED_RST_GPIO_Port, OLED_RST_Pin, GPIO_PIN_RESET)
+//#define OLED_RST_1		HAL_GPIO_WritePin(OLED_RST_GPIO_Port, OLED_RST_Pin, GPIO_PIN_SET)
+
+//SPI GPIO
+//#define SPI1_SCK_0		HAL_GPIO_WritePin(SPI1_SCK_GPIO_Port, SPI1_SCK_Pin, GPIO_PIN_RESET)
+//#define SPI1_SCK_1		HAL_GPIO_WritePin(SPI1_SCK_GPIO_Port, SPI1_SCK_Pin, GPIO_PIN_SET)
+
+//#define SPI1_MOSI_0		HAL_GPIO_WritePin(SPI1_MOSI_GPIO_Port, SPI1_MOSI_Pin, GPIO_PIN_RESET)
+//#define SPI1_MOSI_1		HAL_GPIO_WritePin(SPI1_MOSI_GPIO_Port, SPI1_MOSI_Pin, GPIO_PIN_SET)
+/*------------------------------------------------------------------------------------------------------*/
+
+UBYTE 	System_Init(void);
+void    System_Exit(void);
+
+UBYTE 	SPI4W_Write_Byte(UBYTE value);
+void 	I2C_Write_Byte(UBYTE value, UBYTE Cmd);
+
+void Driver_Delay_ms(uint32_t xms);
+void Driver_Delay_us(uint32_t xus);
+
+#endif

+ 26 - 0
desk/libs/thirdparty/oled/Debug.h

@@ -0,0 +1,26 @@
+/*****************************************************************************
+* | File      	:	Debug.h
+* | Author      :   Waveshare team
+* | Function    :	debug with printf
+* | Info        :
+*   Image scanning
+*      Please use progressive scanning to generate images or fonts
+*----------------
+* |	This version:   V1.0
+* | Date        :   2018-01-11
+* | Info        :   Basic version
+*
+******************************************************************************/
+#ifndef __DEBUG_H
+#define __DEBUG_H
+
+#include "stdio.h"
+
+#define DEBUG 1
+#if DEBUG
+	#define Debug(__info,...) printf("Debug: " __info,##__VA_ARGS__)
+#else
+	#define Debug(__info,...)  
+#endif
+
+#endif

+ 97 - 0
desk/libs/thirdparty/oled/fonts.h

@@ -0,0 +1,97 @@
+/**
+  ******************************************************************************
+  * @file    fonts.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    18-February-2014
+  * @brief   Header for fonts.c file
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __FONTS_H
+#define __FONTS_H
+
+/*�������΢���ź�24 (32x41) */
+#define MAX_HEIGHT_FONT         41
+#define MAX_WIDTH_FONT          32
+#define OFFSET_BITMAP           
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include <stdint.h>
+
+//ASCII
+typedef struct _tFont
+{    
+  const uint8_t *table;
+  uint16_t Width;
+  uint16_t Height;
+  
+} sFONT;
+
+
+//GB2312
+typedef struct                                          // ������ģ���ݽṹ
+{
+  unsigned char index[2];                               // ������������
+  const char matrix[MAX_HEIGHT_FONT*MAX_WIDTH_FONT/8];  // ����������
+}CH_CN;
+
+
+typedef struct
+{    
+  const CH_CN *table;
+  uint16_t size;
+  uint16_t ASCII_Width;
+  uint16_t Width;
+  uint16_t Height;
+  
+}cFONT;
+
+extern sFONT Font24;
+extern sFONT Font20;
+extern sFONT Font16;
+extern sFONT Font12;
+extern sFONT Font8;
+
+extern cFONT Font12CN;
+extern cFONT Font24CN;
+#ifdef __cplusplus
+}
+#endif
+  
+#endif /* __FONTS_H */
+ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 902 - 0
desk/libs/thirdparty/oled/gui/GUI_Paint.c

@@ -0,0 +1,902 @@
+/******************************************************************************
+* | File        :   GUI_Paint.c
+* | Author      :   Waveshare electronics
+* | Function    : Achieve drawing: draw points, lines, boxes, circles and
+*                   their size, solid dotted line, solid rectangle hollow
+*                   rectangle, solid circle hollow circle.
+* | Info        :
+*   Achieve display characters: Display a single character, string, number
+*   Achieve time display: adaptive size display time minutes and seconds
+*----------------
+* | This version:   V3.2
+* | Date        :   2020-08-18
+* | Info        :
+* -----------------------------------------------------------------------------
+* V3.2(2020-08-18):
+* 1.Change: Paint_SetScale(UBYTE scale)
+*        Add scale 65K
+* 2.Change: Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
+*        Add the branch for scale 65K
+* 3.Change: Paint_Clear(UWORD Color)
+*        Add the branch for scale 65K
+* -----------------------------------------------------------------------------
+* V3.1(2020-08-14):
+* 1.Change: Paint_SetScale(UBYTE scale)
+*        Add scale 16
+* 2.Change: Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
+*        Add the branch for scale 16
+* 3.Change: Paint_Clear(UWORD Color)
+*        Add the branch for scale 16
+* -----------------------------------------------------------------------------
+* V3.0(2019-04-18):
+* 1.Change: 
+*    Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
+* => Paint_DrawPoint(..., DOT_STYLE Dot_Style)
+*    Paint_DrawLine(..., LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel)
+* => Paint_DrawLine(..., DOT_PIXEL Line_width, LINE_STYLE Line_Style)
+*    Paint_DrawRectangle(..., DRAW_FILL Filled, DOT_PIXEL Dot_Pixel)
+* => Paint_DrawRectangle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
+*    Paint_DrawCircle(..., DRAW_FILL Draw_Fill, DOT_PIXEL Dot_Pixel)
+* => Paint_DrawCircle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Filll)
+*
+* -----------------------------------------------------------------------------
+* V2.0(2018-11-15):
+* 1.add: Paint_NewImage()
+*    Create an image's properties
+* 2.add: Paint_SelectImage()
+*    Select the picture to be drawn
+* 3.add: Paint_SetRotate()
+*    Set the direction of the cache    
+* 4.add: Paint_RotateImage() 
+*    Can flip the picture, Support 0-360 degrees, 
+*    but only 90.180.270 rotation is better
+* 4.add: Paint_SetMirroring() 
+*    Can Mirroring the picture, horizontal, vertical, origin
+* 5.add: Paint_DrawString_CN() 
+*    Can display Chinese(GB1312)   
+*
+* ----------------------------------------------------------------------------- 
+* V1.0(2018-07-17):
+*   Create library
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documnetation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to  whom the Software is
+* furished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*
+******************************************************************************/
+#include "GUI_Paint.h"
+#include "DEV_Config.h"
+#include "Debug.h"
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h> //memset()
+#include <math.h>
+
+PAINT Paint;
+
+static uint8_t pgm_read_byte(unsigned char const *ptr);
+static int16_t pgm_read_word(unsigned char const *ptr);
+
+static uint8_t pgm_read_byte(unsigned char const *ptr)
+{
+  return *ptr;
+}
+
+static int16_t pgm_read_word(unsigned char const *ptr)
+{
+  return ptr[0] + (ptr[1]<<8);
+}
+
+/******************************************************************************
+function: Create Image
+parameter:
+    image   :   Pointer to the image cache
+    width   :   The width of the picture
+    Height  :   The height of the picture
+    Color   :   Whether the picture is inverted
+******************************************************************************/
+void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
+{
+    Paint.Image = NULL;
+    Paint.Image = image;
+
+    Paint.WidthMemory = Width;
+    Paint.HeightMemory = Height;
+    Paint.Color = Color;    
+    Paint.Scale = 2;
+    
+    Paint.WidthByte = (Width % 8 == 0)? (Width / 8 ): (Width / 8 + 1);
+    Paint.HeightByte = Height;    
+//    printf("WidthByte = %d, HeightByte = %d\r\n", Paint.WidthByte, Paint.HeightByte);
+//    printf(" EPD_WIDTH / 8 = %d\r\n",  122 / 8);
+   
+    Paint.Rotate = Rotate;
+    Paint.Mirror = MIRROR_NONE;
+    
+    if(Rotate == ROTATE_0 || Rotate == ROTATE_180) {
+        Paint.Width = Width;
+        Paint.Height = Height;
+    } else {
+        Paint.Width = Height;
+        Paint.Height = Width;
+    }
+}
+
+/******************************************************************************
+function: Select Image
+parameter:
+    image : Pointer to the image cache
+******************************************************************************/
+void Paint_SelectImage(UBYTE *image)
+{
+    Paint.Image = image;
+}
+
+/******************************************************************************
+function: Select Image Rotate
+parameter:
+    Rotate : 0,90,180,270
+******************************************************************************/
+void Paint_SetRotate(UWORD Rotate)
+{
+    if(Rotate == ROTATE_0 || Rotate == ROTATE_90 || Rotate == ROTATE_180 || Rotate == ROTATE_270) {
+        Debug("Set image Rotate %d\r\n", Rotate);
+        Paint.Rotate = Rotate;
+    } else {
+        Debug("rotate = 0, 90, 180, 270\r\n");
+    }
+}
+
+void Paint_SetScale(UBYTE scale)
+{
+    if(scale == 2){
+        Paint.Scale = scale;
+        Paint.WidthByte = (Paint.WidthMemory % 8 == 0)? (Paint.WidthMemory / 8 ): (Paint.WidthMemory / 8 + 1);
+    }else if(scale == 4){
+        Paint.Scale = scale;
+        Paint.WidthByte = (Paint.WidthMemory % 4 == 0)? (Paint.WidthMemory / 4 ): (Paint.WidthMemory / 4 + 1);
+    }else if(scale ==16) {
+        Paint.Scale = scale;
+        Paint.WidthByte = (Paint.WidthMemory%2==0) ? (Paint.WidthMemory/2) : (Paint.WidthMemory/2+1); 
+    }else if(scale ==65) {
+        Paint.Scale = scale;
+        Paint.WidthByte = Paint.WidthMemory*2; 
+    }else{
+        Debug("Set Scale Input parameter error\r\n");
+        Debug("Scale Only support: 2 4 16 65\r\n");
+    }
+}
+/******************************************************************************
+function: Select Image mirror
+parameter:
+    mirror   :Not mirror,Horizontal mirror,Vertical mirror,Origin mirror
+******************************************************************************/
+void Paint_SetMirroring(UBYTE mirror)
+{
+    if(mirror == MIRROR_NONE || mirror == MIRROR_HORIZONTAL || 
+        mirror == MIRROR_VERTICAL || mirror == MIRROR_ORIGIN) {
+        Debug("mirror image x:%s, y:%s\r\n",(mirror & 0x01)? "mirror":"none", ((mirror >> 1) & 0x01)? "mirror":"none");
+        Paint.Mirror = mirror;
+    } else {
+        Debug("mirror should be MIRROR_NONE, MIRROR_HORIZONTAL, \
+        MIRROR_VERTICAL or MIRROR_ORIGIN\r\n");
+    }    
+}
+
+/******************************************************************************
+function: Draw Pixels
+parameter:
+    Xpoint : At point X
+    Ypoint : At point Y
+    Color  : Painted colors
+******************************************************************************/
+void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
+{
+    if(Xpoint > Paint.Width || Ypoint > Paint.Height){
+        Debug("Exceeding display boundaries\r\n");
+        return;
+    }      
+    UWORD X, Y;
+
+    switch(Paint.Rotate) {
+    case 0:
+        X = Xpoint;
+        Y = Ypoint;  
+        break;
+    case 90:
+        X = Paint.WidthMemory - Ypoint - 1;
+        Y = Xpoint;
+        break;
+    case 180:
+        X = Paint.WidthMemory - Xpoint - 1;
+        Y = Paint.HeightMemory - Ypoint - 1;
+        break;
+    case 270:
+        X = Ypoint;
+        Y = Paint.HeightMemory - Xpoint - 1;
+        break;
+    default:
+        return;
+    }
+    
+    switch(Paint.Mirror) {
+    case MIRROR_NONE:
+        break;
+    case MIRROR_HORIZONTAL:
+        X = Paint.WidthMemory - X - 1;
+        break;
+    case MIRROR_VERTICAL:
+        Y = Paint.HeightMemory - Y - 1;
+        break;
+    case MIRROR_ORIGIN:
+        X = Paint.WidthMemory - X - 1;
+        Y = Paint.HeightMemory - Y - 1;
+        break;
+    default:
+        return;
+    }
+
+    if(X > Paint.WidthMemory || Y > Paint.HeightMemory){
+        Debug("Exceeding display boundaries\r\n");
+        return;
+    }
+    
+    if(Paint.Scale == 2){
+        UDOUBLE Addr = X / 8 + Y * Paint.WidthByte;
+        UBYTE Rdata = Paint.Image[Addr];
+        if(Color == BLACK)
+            Paint.Image[Addr] = Rdata & ~(0x80 >> (X % 8));
+        else
+            Paint.Image[Addr] = Rdata | (0x80 >> (X % 8));
+    }else if(Paint.Scale == 4){
+        UDOUBLE Addr = X / 4 + Y * Paint.WidthByte;
+        Color = Color % 4;//Guaranteed color scale is 4  --- 0~3
+        UBYTE Rdata = Paint.Image[Addr];
+        
+        Rdata = Rdata & (~(0xC0 >> ((X % 4)*2)));
+        Paint.Image[Addr] = Rdata | ((Color << 6) >> ((X % 4)*2));
+    }else if(Paint.Scale == 16) {
+        UDOUBLE Addr = X / 2 + Y * Paint.WidthByte;
+        UBYTE Rdata = Paint.Image[Addr];
+        Color = Color % 16;
+        Rdata = Rdata & (~(0xf0 >> ((X % 2)*4)));
+        Paint.Image[Addr] = Rdata | ((Color << 4) >> ((X % 2)*4));
+    }else if(Paint.Scale == 65) {
+        UDOUBLE Addr = X*2 + Y*Paint.WidthByte;
+        Paint.Image[Addr] = 0xff & (Color>>8);
+        Paint.Image[Addr+1] = 0xff & Color;
+    }
+}
+
+/******************************************************************************
+function: Clear the color of the picture
+parameter:
+    Color : Painted colors
+******************************************************************************/
+void Paint_Clear(UWORD Color)
+{
+    if(Paint.Scale == 2 || Paint.Scale == 4) {
+        for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
+            for (UWORD X = 0; X < Paint.WidthByte; X++ ) {//8 pixel =  1 byte
+                UDOUBLE Addr = X + Y*Paint.WidthByte;
+                Paint.Image[Addr] = Color;
+            }
+        }
+    }else if(Paint.Scale == 16) {
+        for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
+            for (UWORD X = 0; X < Paint.WidthByte; X++ ) {//8 pixel =  1 byte
+                UDOUBLE Addr = X + Y*Paint.WidthByte;
+                Color = Color & 0x0f;
+                Paint.Image[Addr] = (Color<<4) | Color;
+            }
+        }
+    }else if(Paint.Scale == 65) {
+        for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
+            for (UWORD X = 0; X < Paint.WidthByte; X++ ) {//8 pixel =  1 byte
+                UDOUBLE Addr = X*2 + Y*Paint.WidthByte;
+                Paint.Image[Addr] = 0x0f & (Color>>8);
+                Paint.Image[Addr+1] = 0x0f & Color;
+            }
+        }
+    }
+}
+
+/******************************************************************************
+function: Clear the color of a window
+parameter:
+    Xstart : x starting point
+    Ystart : Y starting point
+    Xend   : x end point
+    Yend   : y end point
+    Color  : Painted colors
+******************************************************************************/
+void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
+{
+    UWORD X, Y;
+    for (Y = Ystart; Y < Yend; Y++) {
+        for (X = Xstart; X < Xend; X++) {//8 pixel =  1 byte
+            Paint_SetPixel(X, Y, Color);
+        }
+    }
+}
+
+/******************************************************************************
+function: Draw Point(Xpoint, Ypoint) Fill the color
+parameter:
+    Xpoint    : The Xpoint coordinate of the point
+    Ypoint    : The Ypoint coordinate of the point
+    Color   : Painted color
+    Dot_Pixel : point size
+    Dot_Style : point Style
+******************************************************************************/
+void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color,
+                     DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
+{
+    if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
+        Debug("Paint_DrawPoint Input exceeds the normal display range\r\n");
+        printf("Xpoint = %d , Paint.Width = %d  \r\n ",Xpoint,Paint.Width);
+        printf("Ypoint = %d , Paint.Height = %d  \r\n ",Ypoint,Paint.Height);
+        return;
+    }
+
+    int16_t XDir_Num , YDir_Num;
+    if (Dot_Style == DOT_FILL_AROUND) {
+        for (XDir_Num = 0; XDir_Num < 2 * Dot_Pixel - 1; XDir_Num++) {
+            for (YDir_Num = 0; YDir_Num < 2 * Dot_Pixel - 1; YDir_Num++) {
+                if(Xpoint + XDir_Num - Dot_Pixel < 0 || Ypoint + YDir_Num - Dot_Pixel < 0)
+                    break;
+                // printf("x = %d, y = %d\r\n", Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel);
+                Paint_SetPixel(Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel, Color);
+            }
+        }
+    } else {
+        for (XDir_Num = 0; XDir_Num <  Dot_Pixel; XDir_Num++) {
+            for (YDir_Num = 0; YDir_Num <  Dot_Pixel; YDir_Num++) {
+                Paint_SetPixel(Xpoint + XDir_Num - 1, Ypoint + YDir_Num - 1, Color);
+            }
+        }
+    }
+}
+
+/******************************************************************************
+function: Draw a line of arbitrary slope
+parameter:
+    Xstart :Starting Xpoint point coordinates
+    Ystart :Starting Xpoint point coordinates
+    Xend   :End point Xpoint coordinate
+    Yend   :End point Ypoint coordinate
+    Color  :The color of the line segment
+    Line_width : Line width
+    Line_Style: Solid and dotted lines
+******************************************************************************/
+void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
+                    UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style)
+{
+    if (Xstart > Paint.Width || Ystart > Paint.Height ||
+        Xend > Paint.Width || Yend > Paint.Height) {
+        Debug("Paint_DrawLine Input exceeds the normal display range\r\n");
+        return;
+    }
+
+    UWORD Xpoint = Xstart;
+    UWORD Ypoint = Ystart;
+    int dx = (int)Xend - (int)Xstart >= 0 ? Xend - Xstart : Xstart - Xend;
+    int dy = (int)Yend - (int)Ystart <= 0 ? Yend - Ystart : Ystart - Yend;
+
+    // Increment direction, 1 is positive, -1 is counter;
+    int XAddway = Xstart < Xend ? 1 : -1;
+    int YAddway = Ystart < Yend ? 1 : -1;
+
+    //Cumulative error
+    int Esp = dx + dy;
+    char Dotted_Len = 0;
+
+    for (;;) {
+        Dotted_Len++;
+        //Painted dotted line, 2 point is really virtual
+        if (Line_Style == LINE_STYLE_DOTTED && Dotted_Len % 3 == 0) {
+            //Debug("LINE_DOTTED\r\n");
+            if(Color)
+              Paint_DrawPoint(Xpoint, Ypoint, BLACK, Line_width, DOT_STYLE_DFT);
+            else
+              Paint_DrawPoint(Xpoint, Ypoint, WHITE, Line_width, DOT_STYLE_DFT);
+            Dotted_Len = 0;
+        } else {
+            Paint_DrawPoint(Xpoint, Ypoint, Color, Line_width, DOT_STYLE_DFT);
+        }
+        if (2 * Esp >= dy) {
+            if (Xpoint == Xend)
+                break;
+            Esp += dy;
+            Xpoint += XAddway;
+        }
+        if (2 * Esp <= dx) {
+            if (Ypoint == Yend)
+                break;
+            Esp += dx;
+            Ypoint += YAddway;
+        }
+    }
+}
+
+/******************************************************************************
+function: Draw a rectangle
+parameter:
+    Xstart :Rectangular  Starting Xpoint point coordinates
+    Ystart :Rectangular  Starting Xpoint point coordinates
+    Xend   :Rectangular  End point Xpoint coordinate
+    Yend   :Rectangular  End point Ypoint coordinate
+    Color  :The color of the Rectangular segment
+    Line_width: Line width
+    Draw_Fill : Whether to fill the inside of the rectangle
+******************************************************************************/
+void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
+                         UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
+{
+    if (Xstart > Paint.Width || Ystart > Paint.Height ||
+        Xend > Paint.Width || Yend > Paint.Height) {
+        Debug("Input exceeds the normal display range\r\n");
+        return;
+    }
+
+    if (Draw_Fill) {
+        UWORD Ypoint;
+        for(Ypoint = Ystart; Ypoint < Yend; Ypoint++) {
+            Paint_DrawLine(Xstart, Ypoint, Xend, Ypoint, Color , Line_width, LINE_STYLE_SOLID);
+        }
+    } else {
+        Paint_DrawLine(Xstart, Ystart, Xend, Ystart, Color, Line_width, LINE_STYLE_SOLID);
+        Paint_DrawLine(Xstart, Ystart, Xstart, Yend, Color, Line_width, LINE_STYLE_SOLID);
+        Paint_DrawLine(Xend, Yend, Xend, Ystart, Color, Line_width, LINE_STYLE_SOLID);
+        Paint_DrawLine(Xend, Yend, Xstart, Yend, Color, Line_width, LINE_STYLE_SOLID);
+    }
+}
+
+/******************************************************************************
+function: Use the 8-point method to draw a circle of the
+            specified size at the specified position->
+parameter:
+    X_Center  :Center X coordinate
+    Y_Center  :Center Y coordinate
+    Radius    :circle Radius
+    Color     :The color of the :circle segment
+    Line_width: Line width
+    Draw_Fill : Whether to fill the inside of the Circle
+******************************************************************************/
+void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius,
+                      UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
+{
+    if (X_Center > Paint.Width || Y_Center >= Paint.Height) {
+        Debug("Paint_DrawCircle Input exceeds the normal display range\r\n");
+        return;
+    }
+
+    //Draw a circle from(0, R) as a starting point
+    int16_t XCurrent, YCurrent;
+    XCurrent = 0;
+    YCurrent = Radius;
+
+    //Cumulative error,judge the next point of the logo
+    int16_t Esp = 3 - (Radius << 1 );
+
+    int16_t sCountY;
+    if (Draw_Fill == DRAW_FILL_FULL) {
+        while (XCurrent <= YCurrent ) { //Realistic circles
+            for (sCountY = XCurrent; sCountY <= YCurrent; sCountY ++ ) {
+                Paint_DrawPoint(X_Center + XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//1
+                Paint_DrawPoint(X_Center - XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//2
+                Paint_DrawPoint(X_Center - sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//3
+                Paint_DrawPoint(X_Center - sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//4
+                Paint_DrawPoint(X_Center - XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//5
+                Paint_DrawPoint(X_Center + XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//6
+                Paint_DrawPoint(X_Center + sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//7
+                Paint_DrawPoint(X_Center + sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);
+            }
+            if (Esp < 0 )
+                Esp += 4 * XCurrent + 6;
+            else {
+                Esp += 10 + 4 * (XCurrent - YCurrent );
+                YCurrent --;
+            }
+            XCurrent ++;
+        }
+    } else { //Draw a hollow circle
+        while (XCurrent <= YCurrent ) {
+            Paint_DrawPoint(X_Center + XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//1
+            Paint_DrawPoint(X_Center - XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//2
+            Paint_DrawPoint(X_Center - YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//3
+            Paint_DrawPoint(X_Center - YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//4
+            Paint_DrawPoint(X_Center - XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//5
+            Paint_DrawPoint(X_Center + XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//6
+            Paint_DrawPoint(X_Center + YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//7
+            Paint_DrawPoint(X_Center + YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//0
+
+            if (Esp < 0 )
+                Esp += 4 * XCurrent + 6;
+            else {
+                Esp += 10 + 4 * (XCurrent - YCurrent );
+                YCurrent --;
+            }
+            XCurrent ++;
+        }
+    }
+}
+
+/******************************************************************************
+function: Show English characters
+parameter:
+    Xpoint           :X coordinate
+    Ypoint           :Y coordinate
+    Acsii_Char       :To display the English characters
+    Font             :A structure pointer that displays a character size
+    Color_Foreground : Select the foreground color
+    Color_Background : Select the background color
+******************************************************************************/
+void Paint_DrawChar(UWORD Xpoint, UWORD Ypoint, const char Acsii_Char,
+                    sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
+{
+
+  UWORD Page, Column;
+
+  if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
+    //Debug("Paint_DrawChar Input exceeds the normal display range\r\n");
+    return;
+  }
+  uint32_t Char_Offset = (Acsii_Char - ' ') * Font->Height * (Font->Width / 8 + (Font->Width % 8 ? 1 : 0));
+  const unsigned char *ptr = &Font->table[Char_Offset];
+
+  for ( Page = 0; Page < Font->Height; Page ++ ) {
+    for ( Column = 0; Column < Font->Width; Column ++ ) {
+
+      //To determine whether the font background color and screen background color is consistent
+      if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
+        if (pgm_read_byte(ptr) & (0x80 >> (Column % 8)))
+          Paint_SetPixel (Xpoint + Column, Ypoint + Page, Color_Foreground );
+      } else {
+        if (pgm_read_byte(ptr) & (0x80 >> (Column % 8))) {
+          Paint_SetPixel (Xpoint + Column, Ypoint + Page, Color_Foreground );
+        } else {
+          Paint_SetPixel (Xpoint + Column, Ypoint + Page, Color_Background );
+        }
+      }
+      //One pixel is 8 bits
+      if (Column % 8 == 7) {
+        ptr++;
+      }
+    }/* Write a line */
+    if (Font->Width % 8 != 0) {
+      ptr++;
+    }
+  }/* Write all */
+}
+
+/******************************************************************************
+function: Display the string
+parameter:
+    Xstart           :X coordinate
+    Ystart           :Y coordinate
+    pString          :The first address of the English string to be displayed
+    Font             :A structure pointer that displays a character size
+    Color_Foreground : Select the foreground color
+    Color_Background : Select the background color
+******************************************************************************/
+void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString,
+                         sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
+{
+    UWORD Xpoint = Xstart;
+    UWORD Ypoint = Ystart;
+
+    if (Xstart > Paint.Width || Ystart > Paint.Height) {
+        Debug("Paint_DrawString_EN Input exceeds the normal display range\r\n");
+        return;
+    }
+
+    while (* pString != '\0') {
+        //if X direction filled , reposition to(Xstart,Ypoint),Ypoint is Y direction plus the Height of the character
+        if ((Xpoint + Font->Width ) > Paint.Width ) {
+            Xpoint = Xstart;
+            Ypoint += Font->Height;
+        }
+
+        // If the Y direction is full, reposition to(Xstart, Ystart)
+        if ((Ypoint  + Font->Height ) > Paint.Height ) {
+            Xpoint = Xstart;
+            Ypoint = Ystart;
+        }
+        Paint_DrawChar(Xpoint, Ypoint, * pString, Font, Color_Background, Color_Foreground);
+
+        //The next character of the address
+        pString ++;
+
+        //The next word of the abscissa increases the font of the broadband
+        Xpoint += Font->Width;
+    }
+}
+
+
+/******************************************************************************
+function: Display the string
+parameter:
+    Xstart  :X coordinate
+    Ystart  :Y coordinate
+    pString :The first address of the Chinese string and English
+              string to be displayed
+    Font    :A structure pointer that displays a character size
+    Color_Foreground : Select the foreground color
+    Color_Background : Select the background color
+******************************************************************************/
+void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Background, UWORD Color_Foreground)
+{
+ const unsigned char* p_text = pString;
+
+  int refcolumn = Xstart;
+  int i, j, Num;
+  /* Send the string character by character on EPD */
+  while (*p_text != 0) {
+    if (*p_text < 0x7F) {                                  //ASCII
+      for (Num = 0; Num < font->size ; Num++) {
+        if (*p_text == pgm_read_byte(&font->table[Num].index[0])) {
+          const char* ptr = &font->table[Num].matrix[0];
+
+          for (j = 0; j < font->Height; j++) {
+            for (i = 0; i < font->Width; i++) {
+              if (pgm_read_byte(ptr) & (0x80 >> (i % 8))) {
+                Paint_SetPixel(refcolumn + i,Ystart + j, Color_Foreground);
+              }
+              if (i % 8 == 7) {
+                ptr++;
+              }
+            }
+            if (font->Width % 8 != 0) {
+              ptr++;
+            }
+          }
+          break;
+        }
+      }
+      /* Point on the next character */
+      p_text += 1;
+      /* Decrement the column position by 16 */
+      refcolumn += font->ASCII_Width;
+    } else {                                   //中文
+      for (Num = 0; Num < font->size ; Num++) {
+        if ((*p_text == pgm_read_byte(&font->table[Num].index[0])) && (*(p_text + 1) == pgm_read_byte(&font->table[Num].index[1])) && (*(p_text + 2) == pgm_read_byte(&font->table[Num].index[2]))) {
+          const char* ptr = &font->table[Num].matrix[0];
+
+          for (j = 0; j < font->Height; j++) {
+            for (i = 0; i < font->Width; i++) {
+              if (pgm_read_byte(ptr) & (0x80 >> (i % 8))) {
+                Paint_SetPixel(refcolumn + i,Ystart + j, Color_Foreground);
+              }
+              if (i % 8 == 7) {
+                ptr++;
+              }
+            }
+            if (font->Width % 8 != 0) {
+              ptr++;
+            }
+          }
+          break;
+        }
+      }
+      /* Point on the next character */
+      p_text += 3;
+      /* Decrement the column position by 16 */
+      refcolumn += font->Width;
+    }
+  }
+}
+
+/******************************************************************************
+function: Display nummber
+parameter:
+    Xstart           :X coordinate
+    Ystart           : Y coordinate
+    Number           : The number displayed
+    Font             :A structure pointer that displays a character size
+    Digit            : Fractional width
+    Color_Foreground : Select the foreground color
+    Color_Background : Select the background color
+******************************************************************************/
+#define  ARRAY_LEN 255
+#if 0              
+void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint,const char * Number,
+                   sFONT* Font, UWORD Digit,UWORD Color_Foreground, UWORD Color_Background)
+{ 
+    uint8_t Str_Array[ARRAY_LEN] = {0};
+    uint8_t *pStr = Str_Array;
+    uint8_t i, len = 0;
+    int16_t arr[3] = {0, 0, 0};
+    int16_t *p = arr;
+    if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
+        Debug("Paint_DisNum Input exceeds the normal display range\r\n");
+        return;
+    }
+
+    while(Number[len] != '\0') {  
+      len++;                                    //get total length
+      (*p)++;                                   //get the integer part length 
+      if(Number[len] == '.') {
+        arr[2] = 1;
+        arr[0]--;
+        p++;               //get fractional part length
+      }
+    }
+
+    if(Digit > 0) {    
+      if(Digit <= arr[1]) {                     
+        for(i=0; i<=len-(arr[1]-Digit); i++)      //cut some Number
+          Str_Array[i] = Number[i];
+      }
+      else {
+        for(i=0; i<=len+Digit-arr[1]; i++) {
+          if(i == len && arr[2] == 0)
+            Str_Array[i] = '.';
+          else if(i >= len)                           //add '0'
+            Str_Array[i] = '0';
+          else
+            Str_Array[i] = Number[i];
+        }
+      }
+    }
+    else
+      for(i=0; i<=len-arr[1]-arr[2]; i++) {
+        Str_Array[i] = Number[i];
+        }
+  
+    //show
+    Paint_DrawString_EN(Xpoint, Ypoint, (const char*)pStr, Font, Color_Background, Color_Foreground);
+}
+#endif
+/******************************************************************************
+function: Display time
+parameter:
+    Xstart           :X coordinate
+    Ystart           : Y coordinate
+    pTime            : Time-related structures
+    Font             :A structure pointer that displays a character size
+    Color_Foreground : Select the foreground color
+    Color_Background : Select the background color
+******************************************************************************/
+void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font,
+                    UWORD Color_Foreground, UWORD Color_Background)
+{
+    uint8_t value[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
+
+    UWORD Dx = Font->Width;
+
+    //Write data into the cache
+    Paint_DrawChar(Xstart                           , Ystart, value[pTime->Hour / 10], Font, Color_Background, Color_Foreground);
+    Paint_DrawChar(Xstart + Dx                      , Ystart, value[pTime->Hour % 10], Font, Color_Background, Color_Foreground);
+    Paint_DrawChar(Xstart + Dx  + Dx / 4 + Dx / 2   , Ystart, ':'                    , Font, Color_Background, Color_Foreground);
+    Paint_DrawChar(Xstart + Dx * 2 + Dx / 2         , Ystart, value[pTime->Min / 10] , Font, Color_Background, Color_Foreground);
+    Paint_DrawChar(Xstart + Dx * 3 + Dx / 2         , Ystart, value[pTime->Min % 10] , Font, Color_Background, Color_Foreground);
+    Paint_DrawChar(Xstart + Dx * 4 + Dx / 2 - Dx / 4, Ystart, ':'                    , Font, Color_Background, Color_Foreground);
+    Paint_DrawChar(Xstart + Dx * 5                  , Ystart, value[pTime->Sec / 10] , Font, Color_Background, Color_Foreground);
+    Paint_DrawChar(Xstart + Dx * 6                  , Ystart, value[pTime->Sec % 10] , Font, Color_Background, Color_Foreground);
+}
+
+/******************************************************************************
+function: Display monochrome bitmap
+parameter:
+    image_buffer :A picture data converted to a bitmap
+info:
+    Use a computer to convert the image into a corresponding array,
+    and then embed the array directly into Imagedata.cpp as a .c file.
+******************************************************************************/
+void Paint_DrawBitMap(const unsigned char* image_buffer)
+{
+    UWORD x, y;
+    UDOUBLE Addr = 0;
+
+    for (y = 0; y < Paint.HeightByte; y++) {
+        for (x = 0; x < Paint.WidthByte; x++) {//8 pixel =  1 byte
+            Addr = x + y * Paint.WidthByte;
+            Paint.Image[Addr] = (unsigned char)image_buffer[Addr];
+        }
+    }
+}
+
+///******************************************************************************
+//function: SDisplay half of monochrome bitmap
+//parameter:
+//  Region : 1 Upper half
+//           2 Lower half
+//info:
+//******************************************************************************/
+//void Paint_DrawBitMap_Half(const unsigned char* image_buffer, UBYTE Region)
+//{
+//    UWORD x, y;
+//    UDOUBLE Addr = 0;
+//    
+//    if(Region == 1){
+//      for (y = 0; y < Paint.HeightByte; y++) {
+//          for (x = 0; x < Paint.WidthByte; x++) {//8 pixel =  1 byte
+//              Addr = x + y * Paint.WidthByte;
+//              Paint.Image[Addr] = (unsigned char)image_buffer[Addr];
+//          }
+//      }
+//    }else{
+//      for (y = 0; y < Paint.HeightByte; y++) {
+//          for (x = 0; x < Paint.WidthByte; x++) {//8 pixel =  1 byte
+//              Addr = x + y * Paint.WidthByte ;
+//              Paint.Image[Addr] = \
+//              (unsigned char)image_buffer[Addr+ (Paint.HeightByte)*Paint.WidthByte];
+//          }
+//      }
+//    }
+//}
+
+///******************************************************************************
+//function: SDisplay half of monochrome bitmap
+//parameter:
+//  Region : 1 Upper half
+//           2 Lower half
+//info:
+//******************************************************************************/
+//void Paint_DrawBitMap_OneQuarter(const unsigned char* image_buffer, UBYTE Region)
+//{
+//    UWORD x, y;
+//    UDOUBLE Addr = 0;
+//    
+//    if(Region == 1){
+//      for (y = 0; y < Paint.HeightByte; y++) {
+//          for (x = 0; x < Paint.WidthByte; x++) {//8 pixel =  1 byte
+//              Addr = x + y * Paint.WidthByte;
+//              Paint.Image[Addr] = (unsigned char)image_buffer[Addr];
+//          }
+//      }
+//    }else if(Region == 2){
+//      for (y = 0; y < Paint.HeightByte; y++) {
+//          for (x = 0; x < Paint.WidthByte; x++) {//8 pixel =  1 byte
+//              Addr = x + y * Paint.WidthByte ;
+//              Paint.Image[Addr] = \
+//              (unsigned char)image_buffer[Addr+ (Paint.HeightByte)*Paint.WidthByte];
+//          }
+//      }
+//    }else if(Region == 3){
+//      for (y = 0; y < Paint.HeightByte; y++) {
+//          for (x = 0; x < Paint.WidthByte; x++) {//8 pixel =  1 byte
+//              Addr = x + y * Paint.WidthByte ;
+//              Paint.Image[Addr] = \
+//              (unsigned char)image_buffer[Addr+ (Paint.HeightByte)*Paint.WidthByte*2];
+//          }
+//      }
+//    }else if(Region == 4){
+//      for (y = 0; y < Paint.HeightByte; y++) {
+//          for (x = 0; x < Paint.WidthByte; x++) {//8 pixel =  1 byte
+//              Addr = x + y * Paint.WidthByte ;
+//              Paint.Image[Addr] = \
+//              (unsigned char)image_buffer[Addr+ (Paint.HeightByte)*Paint.WidthByte*3];
+//          }
+//      }
+//    }
+//}
+
+void Paint_DrawBitMap_Block(const unsigned char* image_buffer, UBYTE Region)
+{
+    UWORD x, y;
+    UDOUBLE Addr = 0;
+    for (y = 0; y < Paint.HeightByte; y++) {
+        for (x = 0; x < Paint.WidthByte; x++) {//8 pixel =  1 byte
+            Addr = x + y * Paint.WidthByte ;
+            Paint.Image[Addr] = \
+            (unsigned char)image_buffer[Addr+ (Paint.HeightByte)*Paint.WidthByte*(Region - 1)];
+        }
+    }
+}

+ 242 - 0
desk/libs/thirdparty/oled/gui/GUI_Paint.h

@@ -0,0 +1,242 @@
+/******************************************************************************
+* | File      	:   GUI_Paint.h
+* | Author      :   Waveshare electronics
+* | Function    :	Achieve drawing: draw points, lines, boxes, circles and
+*                   their size, solid dotted line, solid rectangle hollow
+*                   rectangle, solid circle hollow circle.
+* | Info        :
+*   Achieve display characters: Display a single character, string, number
+*   Achieve time display: adaptive size display time minutes and seconds
+*----------------
+* |	This version:   V3.2
+* | Date        :   2020-08-18
+* | Info        :
+* -----------------------------------------------------------------------------
+* V3.2(2020-08-18):
+* 1.Change: Paint_SetScale(UBYTE scale)
+*        Add scale 65K
+* 2.Change: Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
+*        Add the branch for scale 65K
+* 3.Change: Paint_Clear(UWORD Color)
+*        Add the branch for scale 65K
+* -----------------------------------------------------------------------------
+* V3.1(2020-08-14):
+* 1.Change: Paint_SetScale(UBYTE scale)
+*        Add scale 16
+* 2.Change: Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
+*        Add the branch for scale 16
+* 3.Change: Paint_Clear(UWORD Color)
+*        Add the branch for scale 16
+* -----------------------------------------------------------------------------
+* V3.0(2019-04-18):
+* 1.Change: 
+*    Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
+* => Paint_DrawPoint(..., DOT_STYLE Dot_Style)
+*    Paint_DrawLine(..., LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel)
+* => Paint_DrawLine(..., DOT_PIXEL Line_width, LINE_STYLE Line_Style)
+*    Paint_DrawRectangle(..., DRAW_FILL Filled, DOT_PIXEL Dot_Pixel)
+* => Paint_DrawRectangle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
+*    Paint_DrawCircle(..., DRAW_FILL Draw_Fill, DOT_PIXEL Dot_Pixel)
+* => Paint_DrawCircle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Filll)
+*
+* -----------------------------------------------------------------------------
+* V2.0(2018-11-15):
+* 1.add: Paint_NewImage()
+*    Create an image's properties
+* 2.add: Paint_SelectImage()
+*    Select the picture to be drawn
+* 3.add: Paint_SetRotate()
+*    Set the direction of the cache    
+* 4.add: Paint_RotateImage() 
+*    Can flip the picture, Support 0-360 degrees, 
+*    but only 90.180.270 rotation is better
+* 4.add: Paint_SetMirroring() 
+*    Can Mirroring the picture, horizontal, vertical, origin
+* 5.add: Paint_DrawString_CN() 
+*    Can display Chinese(GB1312)   
+*
+* ----------------------------------------------------------------------------- 
+* V1.0(2018-07-17):
+*   Create library
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documnetation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to  whom the Software is
+* furished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*
+******************************************************************************/
+#ifndef __GUI_PAINT_H
+#define __GUI_PAINT_H
+
+#include "DEV_Config.h"
+#include "../fonts.h"
+
+/**
+ * Image attributes
+**/
+typedef struct {
+    UBYTE *Image;
+    UWORD Width;
+    UWORD Height;
+    UWORD WidthMemory;
+    UWORD HeightMemory;
+    UWORD Color;
+    UWORD Rotate;
+    UWORD Mirror;
+    UWORD WidthByte;
+    UWORD HeightByte;
+    UWORD Scale;
+} PAINT;
+extern PAINT Paint;
+
+/**
+ * Display rotate
+**/
+#define ROTATE_0            0
+#define ROTATE_90           90
+#define ROTATE_180          180
+#define ROTATE_270          270
+
+/**
+ * Display Flip
+**/
+typedef enum {
+    MIRROR_NONE  = 0x00,
+    MIRROR_HORIZONTAL = 0x01,
+    MIRROR_VERTICAL = 0x02,
+    MIRROR_ORIGIN = 0x03,
+} MIRROR_IMAGE;
+#define MIRROR_IMAGE_DFT MIRROR_NONE
+
+/**
+ * image color
+**/
+/**
+ * image color
+**/
+#define WHITE          0xFFFF
+#define BLACK          0x0000
+#define BLUE           0x001F
+#define BRED           0XF81F
+#define GRED           0XFFE0
+#define GBLUE          0X07FF
+#define RED            0xF800
+#define MAGENTA        0xF81F
+#define GREEN          0x07E0
+#define CYAN           0x7FFF
+#define YELLOW         0xFFE0
+#define BROWN          0XBC40
+#define BRRED          0XFC07
+#define GRAY           0X8430
+
+#define IMAGE_BACKGROUND    WHITE
+#define FONT_FOREGROUND     BLACK
+#define FONT_BACKGROUND     WHITE
+
+//4 Gray level
+#define  GRAY1 0x03 //Blackest
+#define  GRAY2 0x02
+#define  GRAY3 0x01 //gray
+#define  GRAY4 0x00 //white
+/**
+ * The size of the point
+**/
+typedef enum {
+    DOT_PIXEL_1X1  = 1,	// 1 x 1
+    DOT_PIXEL_2X2  , 		// 2 X 2
+    DOT_PIXEL_3X3  ,		// 3 X 3
+    DOT_PIXEL_4X4  ,		// 4 X 4
+    DOT_PIXEL_5X5  , 		// 5 X 5
+    DOT_PIXEL_6X6  , 		// 6 X 6
+    DOT_PIXEL_7X7  , 		// 7 X 7
+    DOT_PIXEL_8X8  , 		// 8 X 8
+} DOT_PIXEL;
+#define DOT_PIXEL_DFT  DOT_PIXEL_1X1  //Default dot pilex
+
+/**
+ * Point size fill style
+**/
+typedef enum {
+    DOT_FILL_AROUND  = 1,		// dot pixel 1 x 1
+    DOT_FILL_RIGHTUP  , 		// dot pixel 2 X 2
+} DOT_STYLE;
+#define DOT_STYLE_DFT  DOT_FILL_AROUND  //Default dot pilex
+
+/**
+ * Line style, solid or dashed
+**/
+typedef enum {
+    LINE_STYLE_SOLID = 0,
+    LINE_STYLE_DOTTED,
+} LINE_STYLE;
+
+/**
+ * Whether the graphic is filled
+**/
+typedef enum {
+    DRAW_FILL_EMPTY = 0,
+    DRAW_FILL_FULL,
+} DRAW_FILL;
+
+/**
+ * Custom structure of a time attribute
+**/
+typedef struct {
+    UWORD	Year;  //0000
+    UBYTE Month; //1 - 12
+    UBYTE Day;   //1 - 30
+    UBYTE Hour;  //0 - 23
+    UBYTE Min;   //0 - 59
+    UBYTE Sec;   //0 - 59
+} PAINT_TIME;
+extern PAINT_TIME sPaint_time;
+
+//init and Clear
+void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color);
+void Paint_SelectImage(UBYTE *image);
+void Paint_SetRotate(UWORD Rotate);
+void Paint_SetMirroring(UBYTE mirror);
+void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color);
+void Paint_SetScale(UBYTE scale);
+
+void Paint_Clear(UWORD Color);
+void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color);
+
+//Drawing
+void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_FillWay);
+void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style);
+void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill);
+void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill);
+
+//Display string
+void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Acsii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
+void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
+void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background);
+void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, double Nummber, sFONT* Font, UWORD Digit,UWORD Color_Foreground, UWORD Color_Background);
+void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
+
+//pic
+void Paint_DrawBitMap(const unsigned char* image_buffer);
+//void Paint_DrawBitMap_Half(const unsigned char* image_buffer, UBYTE Region);
+//void Paint_DrawBitMap_OneQuarter(const unsigned char* image_buffer, UBYTE Region);
+//void Paint_DrawBitMap_OneEighth(const unsigned char* image_buffer, UBYTE Region);
+void Paint_DrawBitMap_Block(const unsigned char* image_buffer, UBYTE Region);
+#endif
+
+
+
+
+

+ 162 - 0
desk/libs/thirdparty/oled_ssd1327/fonts/font_8x13_rus.h

@@ -0,0 +1,162 @@
+/*
+  Fontname: rus8x13  (Cyrillic 8x13 LCD Font)
+  Copyright: (C) 2015	  Made by Maxim Z.	E-mail: <a href="mailto:Maxim_EV@bk.ru">Maxim_EV@bk.ru</a>
+  Capital A Height: 9, '1' Height: 9
+  Calculated Max Values w= 7 h=11 x= 7 y= 8 dx= 8 dy= 0 ascent=10 len=11
+  Font Bounding box     w= 8 h=13 x= 0 y=-2
+  Calculated Min Values           x= 0 y=-2 dx= 0 dy= 0
+  Pure Font   ascent = 9 descent=-2
+  X Font      ascent = 9 descent=-2
+  Max Font    ascent =10 descent=-2
+*/
+
+#ifndef FONT_8X13_RUS_H_
+#define FONT_8X13_RUS_H_
+
+//const uint8_t rus8x13[2267] = {
+const uint8_t font_8x13[] = {
+  8, 13,
+  0,8,13,0,254,9,1,196,3,144,32,255,254,10,254,9,
+  254,0,0,0,8,7,255,1,9,9,8,3,0,128,128,128,
+  128,128,128,128,0,128,4,3,3,8,2,6,144,144,144,6,
+  7,7,8,1,1,72,72,252,72,252,72,72,5,9,9,8,
+  1,0,32,120,160,160,112,40,40,240,32,6,9,9,8,1,
+  0,68,164,72,16,16,32,72,84,136,6,7,7,8,1,0,
+  96,144,144,96,148,136,116,1,3,3,8,3,6,128,128,128,
+  3,9,9,8,3,0,32,64,64,128,128,128,64,64,32,3,
+  9,9,8,2,0,128,64,64,32,32,32,64,64,128,6,5,
+  5,8,1,4,72,48,252,48,72,5,5,5,8,1,2,32,
+  32,248,32,32,4,3,3,8,1,255,112,96,128,4,1,1,
+  8,2,4,240,3,3,3,8,2,255,64,224,64,7,9,9,
+  8,0,0,2,2,4,8,16,32,64,128,128,6,9,9,8,
+  1,0,48,72,132,132,132,132,132,72,48,5,9,9,8,1,
+  0,32,96,160,32,32,32,32,32,248,6,9,9,8,1,0,
+  120,132,132,4,8,48,64,128,252,6,9,9,8,1,0,252,
+  4,8,16,56,4,4,132,120,6,9,9,8,1,0,8,24,
+  40,72,136,136,252,8,8,6,9,9,8,1,0,252,128,128,
+  184,196,4,4,132,120,6,9,9,8,1,0,56,64,128,128,
+  184,196,132,132,120,6,9,9,8,1,0,252,4,8,16,16,
+  32,32,64,64,6,9,9,8,1,0,120,132,132,132,120,132,
+  132,132,120,6,9,9,8,1,0,120,132,132,140,116,4,4,
+  8,112,3,8,8,8,2,255,64,224,64,0,0,64,224,64,
+  4,8,8,8,1,255,32,112,32,0,0,112,96,128,5,9,
+  9,8,2,0,8,16,32,64,128,64,32,16,8,6,4,4,
+  8,1,2,252,0,0,252,5,9,9,8,1,0,128,64,32,
+  16,8,16,32,64,128,6,9,9,8,1,0,120,132,132,4,
+  8,16,16,0,16,6,9,9,8,1,0,120,132,132,156,164,
+  172,148,128,120,6,9,9,8,1,0,48,72,132,132,132,252,
+  132,132,132,6,9,9,8,1,0,240,136,132,136,240,136,132,
+  136,240,6,9,9,8,1,0,120,132,128,128,128,128,128,132,
+  120,6,9,9,8,1,0,240,136,132,132,132,132,132,136,240,
+  6,9,9,8,1,0,252,128,128,128,240,128,128,128,252,6,
+  9,9,8,1,0,252,128,128,128,240,128,128,128,128,6,9,
+  9,8,1,0,120,132,128,128,128,156,132,140,116,6,9,9,
+  8,1,0,132,132,132,132,252,132,132,132,132,5,9,9,8,
+  1,0,248,32,32,32,32,32,32,32,248,7,9,9,8,1,
+  0,62,8,8,8,8,8,8,136,112,6,9,9,8,1,0,
+  132,136,144,160,192,160,144,136,132,6,9,9,8,1,0,128,
+  128,128,128,128,128,128,128,252,7,9,9,8,0,0,130,130,
+  198,170,146,146,130,130,130,6,9,9,8,1,0,132,132,196,
+  164,148,140,132,132,132,6,9,9,8,1,0,120,132,132,132,
+  132,132,132,132,120,6,9,9,8,1,0,248,132,132,132,248,
+  128,128,128,128,6,10,10,8,1,255,120,132,132,132,132,132,
+  164,148,120,4,6,9,9,8,1,0,248,132,132,132,248,160,
+  144,136,132,6,9,9,8,1,0,120,132,128,128,120,4,4,
+  132,120,7,9,9,8,0,0,254,16,16,16,16,16,16,16,
+  16,6,9,9,8,1,0,132,132,132,132,132,132,132,132,120,
+  7,9,9,8,0,0,130,130,68,68,68,40,40,40,16,7,
+  9,9,8,0,0,130,130,130,130,146,146,146,170,68,7,9,
+  9,8,0,0,130,130,68,40,16,40,68,130,130,7,9,9,
+  8,0,0,130,130,68,40,16,16,16,16,16,6,9,9,8,
+  1,0,252,4,8,16,32,64,128,128,252,4,9,9,8,2,
+  0,240,128,128,128,128,128,128,128,240,7,9,9,8,0,0,
+  128,128,64,32,16,8,4,2,2,4,9,9,8,1,0,240,
+  16,16,16,16,16,16,16,240,5,3,3,8,1,6,32,80,
+  136,7,1,1,8,0,255,254,2,2,2,8,3,8,128,64,
+  6,6,6,8,1,0,120,4,124,132,140,116,6,9,9,8,
+  1,0,128,128,128,184,196,132,132,196,184,6,6,6,8,1,
+  0,120,132,128,128,132,120,6,9,9,8,1,0,4,4,4,
+  116,140,132,132,140,116,6,6,6,8,1,0,120,132,252,128,
+  132,120,6,9,9,8,1,0,56,68,64,64,248,64,64,64,
+  64,6,8,8,8,1,254,116,136,136,112,128,120,132,120,6,
+  9,9,8,1,0,128,128,128,184,196,132,132,132,132,5,8,
+  8,8,1,0,32,0,96,32,32,32,32,248,5,10,10,8,
+  1,254,8,0,24,8,8,8,8,136,136,112,6,9,9,8,
+  1,0,128,128,128,136,144,224,144,136,132,5,9,9,8,1,
+  0,96,32,32,32,32,32,32,32,248,7,6,6,8,0,0,
+  236,146,146,146,146,130,6,6,6,8,1,0,184,196,132,132,
+  132,132,6,6,6,8,1,0,120,132,132,132,132,120,6,8,
+  8,8,1,254,184,196,132,196,184,128,128,128,6,8,8,8,
+  1,254,116,140,132,140,116,4,4,4,6,6,6,8,1,0,
+  184,68,64,64,64,64,6,6,6,8,1,0,120,132,96,24,
+  132,120,6,8,8,8,1,0,64,64,248,64,64,64,68,56,
+  6,6,6,8,1,0,136,136,136,136,136,116,5,6,6,8,
+  1,0,136,136,136,80,80,32,7,6,6,8,0,0,130,130,
+  146,146,170,68,6,6,6,8,1,0,132,72,48,48,72,132,
+  6,8,8,8,1,254,132,132,132,140,116,4,132,120,6,6,
+  6,8,1,0,252,8,16,32,64,252,5,9,9,8,2,0,
+  56,64,64,32,192,32,64,64,56,1,9,9,8,3,0,128,
+  128,128,128,128,128,128,128,128,5,9,9,8,1,0,224,16,
+  16,32,24,32,16,16,224,5,3,3,8,1,6,72,168,144,
+  255,6,8,8,8,1,254,184,196,132,132,196,184,128,128,6,
+  6,6,8,1,0,120,132,128,128,132,120,5,6,6,8,1,
+  0,248,32,32,32,32,32,6,8,8,8,1,254,132,132,132,
+  140,116,4,132,120,7,11,11,8,0,254,16,16,16,124,146,
+  146,146,146,124,16,16,6,6,6,8,1,0,132,72,48,48,
+  72,132,6,8,8,8,1,254,136,136,136,136,136,252,4,4,
+  6,6,6,8,1,0,132,132,140,116,4,4,7,6,6,8,
+  0,0,146,146,146,146,146,254,7,8,8,8,0,254,146,146,
+  146,146,146,254,2,2,7,6,6,8,0,0,224,32,60,34,
+  34,60,6,6,6,8,1,0,132,132,228,148,148,228,5,6,
+  6,8,2,0,128,128,240,136,136,240,5,6,6,8,2,0,
+  240,8,56,8,8,240,7,6,6,8,0,0,140,146,146,242,
+  146,140,6,6,6,8,1,0,124,132,132,124,68,132,6,9,
+  9,8,1,0,48,72,132,132,132,252,132,132,132,6,9,9,
+  8,1,0,248,128,128,128,248,132,132,132,248,6,9,9,8,
+  1,0,248,132,132,132,248,132,132,132,248,6,9,9,8,1,
+  0,252,132,128,128,128,128,128,128,128,7,10,10,8,0,255,
+  60,36,36,36,68,68,68,68,254,130,6,9,9,8,1,0,
+  252,128,128,128,248,128,128,128,252,7,9,9,8,0,0,146,
+  146,84,56,84,146,146,146,146,6,9,9,8,1,0,120,132,
+  4,4,24,4,4,132,120,6,9,9,8,1,0,132,140,140,
+  148,148,164,164,196,132,6,10,10,8,1,0,132,120,132,140,
+  140,148,164,196,196,132,6,9,9,8,1,0,132,136,144,160,
+  192,160,144,136,132,6,9,9,8,1,0,60,68,68,68,68,
+  68,68,132,132,7,9,9,8,0,0,130,130,198,170,146,146,
+  130,130,130,6,9,9,8,1,0,132,132,132,132,252,132,132,
+  132,132,6,9,9,8,1,0,120,132,132,132,132,132,132,132,
+  120,6,9,9,8,1,0,252,132,132,132,132,132,132,132,132,
+  6,9,9,8,1,0,248,132,132,132,132,248,128,128,128,6,
+  9,9,8,1,0,120,132,128,128,128,128,128,132,120,7,9,
+  9,8,0,0,254,16,16,16,16,16,16,16,16,6,9,9,
+  8,1,0,132,132,132,132,72,48,32,64,128,7,9,9,8,
+  0,0,16,124,146,146,146,146,124,16,16,5,9,9,8,1,
+  0,136,136,80,80,32,80,80,136,136,7,11,11,8,0,254,
+  132,132,132,132,132,132,132,132,254,2,2,6,9,9,8,1,
+  0,132,132,132,132,124,4,4,4,4,7,9,9,8,0,0,
+  146,146,146,146,146,146,146,146,254,7,11,11,8,0,254,146,
+  146,146,146,146,146,146,146,254,2,2,7,9,9,8,0,0,
+  224,32,32,32,60,34,34,34,60,6,9,9,8,1,0,132,
+  132,132,228,148,148,148,148,228,6,9,9,8,1,0,128,128,
+  128,128,248,132,132,132,248,6,9,9,8,1,0,240,8,4,
+  4,124,4,4,8,240,7,9,9,8,0,0,140,146,146,146,
+  242,146,146,146,140,5,9,9,8,1,0,120,136,136,136,120,
+  40,72,136,136,6,6,6,8,1,0,120,4,124,132,132,124,
+  6,9,9,8,1,0,4,120,128,248,132,132,132,132,120,6,
+  6,6,8,1,0,248,132,248,132,132,248,6,6,6,8,1,
+  0,252,132,128,128,128,128,6,7,7,8,1,255,56,72,72,
+  72,72,252,132,6,6,6,8,1,0,120,132,252,128,132,120,
+  7,6,6,8,0,0,146,146,124,84,146,146,6,6,6,8,
+  1,0,120,132,56,4,132,120,6,6,6,8,1,0,132,140,
+  148,164,196,132,6,9,9,8,1,0,132,120,0,132,140,148,
+  164,196,132,5,6,6,8,1,0,136,144,224,144,136,136,6,
+  6,6,8,1,0,60,68,68,68,68,132,5,6,6,8,1,
+  0,136,216,168,168,136,136,6,6,6,8,1,0,132,132,252,
+  132,132,132,6,6,6,8,1,0,120,132,132,132,132,120,6,
+  6,6,8,1,0,252,132,132,132,132,132,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255}; 
+
+#endif

+ 957 - 0
desk/libs/thirdparty/oled_ssd1327/fonts/font_8x5.h

@@ -112,4 +112,961 @@ const uint8_t font_8x5[] =
 			0x02, 0x01, 0x02, 0x04, 0x02,
 };
 
+const uint8_t Font8_Table[] = 
+{
+    8, 5, //height, width
+
+	// @0 ' ' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+
+	// @8 '!' (5 pixels wide)
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x00, //      
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @16 '"' (5 pixels wide)
+	0x50, //  # # 
+	0x50, //  # # 
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+
+	// @24 '#' (5 pixels wide)
+	0x28, //   # #
+	0x50, //  # # 
+	0xF8, // #####
+	0x50, //  # # 
+	0xF8, // #####
+	0x50, //  # # 
+	0xA0, // # #  
+	0x00, //      
+
+	// @32 '$' (5 pixels wide)
+	0x20, //   #  
+	0x30, //   ## 
+	0x60, //  ##  
+	0x30, //   ## 
+	0x10, //    # 
+	0x60, //  ##  
+	0x20, //   #  
+	0x00, //      
+
+	// @40 '%' (5 pixels wide)
+	0x20, //   #  
+	0x20, //   #  
+	0x18, //    ##
+	0x60, //  ##  
+	0x10, //    # 
+	0x10, //    # 
+	0x00, //      
+	0x00, //      
+
+	// @48 '&' (5 pixels wide)
+	0x00, //      
+	0x38, //   ###
+	0x20, //   #  
+	0x60, //  ##  
+	0x50, //  # # 
+	0x78, //  ####
+	0x00, //      
+	0x00, //      
+
+	// @56 ''' (5 pixels wide)
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+
+	// @64 '(' (5 pixels wide)
+	0x10, //    # 
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x10, //    # 
+	0x00, //      
+
+	// @72 ')' (5 pixels wide)
+	0x40, //  #   
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x40, //  #   
+	0x00, //      
+
+	// @80 '*' (5 pixels wide)
+	0x20, //   #  
+	0x70, //  ### 
+	0x20, //   #  
+	0x50, //  # # 
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+
+	// @88 '+' (5 pixels wide)
+	0x00, //      
+	0x20, //   #  
+	0x20, //   #  
+	0xF8, // #####
+	0x20, //   #  
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @96 ',' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x10, //    # 
+	0x20, //   #  
+	0x20, //   #  
+	0x00, //      
+
+	// @104 '-' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+
+	// @112 '.' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @120 '/' (5 pixels wide)
+	0x10, //    # 
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x40, //  #   
+	0x40, //  #   
+	0x80, // #    
+	0x00, //      
+
+	// @128 '0' (5 pixels wide)
+	0x20, //   #  
+	0x50, //  # # 
+	0x50, //  # # 
+	0x50, //  # # 
+	0x50, //  # # 
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @136 '1' (5 pixels wide)
+	0x60, //  ##  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0xF8, // #####
+	0x00, //      
+	0x00, //      
+
+	// @144 '2' (5 pixels wide)
+	0x20, //   #  
+	0x50, //  # # 
+	0x20, //   #  
+	0x20, //   #  
+	0x40, //  #   
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @152 '3' (5 pixels wide)
+	0x20, //   #  
+	0x50, //  # # 
+	0x10, //    # 
+	0x20, //   #  
+	0x10, //    # 
+	0x60, //  ##  
+	0x00, //      
+	0x00, //      
+
+	// @160 '4' (5 pixels wide)
+	0x10, //    # 
+	0x30, //   ## 
+	0x50, //  # # 
+	0x78, //  ####
+	0x10, //    # 
+	0x38, //   ###
+	0x00, //      
+	0x00, //      
+
+	// @168 '5' (5 pixels wide)
+	0x70, //  ### 
+	0x40, //  #   
+	0x60, //  ##  
+	0x10, //    # 
+	0x50, //  # # 
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @176 '6' (5 pixels wide)
+	0x30, //   ## 
+	0x40, //  #   
+	0x60, //  ##  
+	0x50, //  # # 
+	0x50, //  # # 
+	0x60, //  ##  
+	0x00, //      
+	0x00, //      
+
+	// @184 '7' (5 pixels wide)
+	0x70, //  ### 
+	0x50, //  # # 
+	0x10, //    # 
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @192 '8' (5 pixels wide)
+	0x20, //   #  
+	0x50, //  # # 
+	0x20, //   #  
+	0x50, //  # # 
+	0x50, //  # # 
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @200 '9' (5 pixels wide)
+	0x30, //   ## 
+	0x50, //  # # 
+	0x50, //  # # 
+	0x30, //   ## 
+	0x10, //    # 
+	0x60, //  ##  
+	0x00, //      
+	0x00, //      
+
+	// @208 ':' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @216 ';' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x10, //    # 
+	0x00, //      
+	0x10, //    # 
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @224 '<' (5 pixels wide)
+	0x00, //      
+	0x10, //    # 
+	0x20, //   #  
+	0xC0, // ##   
+	0x20, //   #  
+	0x10, //    # 
+	0x00, //      
+	0x00, //      
+
+	// @232 '=' (5 pixels wide)
+	0x00, //      
+	0x70, //  ### 
+	0x00, //      
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+
+	// @240 '>' (5 pixels wide)
+	0x00, //      
+	0x40, //  #   
+	0x20, //   #  
+	0x18, //    ##
+	0x20, //   #  
+	0x40, //  #   
+	0x00, //      
+	0x00, //      
+
+	// @248 '?' (5 pixels wide)
+	0x20, //   #  
+	0x50, //  # # 
+	0x10, //    # 
+	0x20, //   #  
+	0x00, //      
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @256 '@' (5 pixels wide)
+	0x30, //   ## 
+	0x48, //  #  #
+	0x48, //  #  #
+	0x58, //  # ##
+	0x48, //  #  #
+	0x40, //  #   
+	0x38, //   ###
+	0x00, //      
+
+	// @264 'A' (5 pixels wide)
+	0x60, //  ##  
+	0x20, //   #  
+	0x50, //  # # 
+	0x70, //  ### 
+	0x88, // #   #
+	0xD8, // ## ##
+	0x00, //      
+	0x00, //      
+
+	// @272 'B' (5 pixels wide)
+	0xF0, // #### 
+	0x48, //  #  #
+	0x70, //  ### 
+	0x48, //  #  #
+	0x48, //  #  #
+	0xF0, // #### 
+	0x00, //      
+	0x00, //      
+
+	// @280 'C' (5 pixels wide)
+	0x70, //  ### 
+	0x50, //  # # 
+	0x40, //  #   
+	0x40, //  #   
+	0x40, //  #   
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @288 'D' (5 pixels wide)
+	0xF0, // #### 
+	0x48, //  #  #
+	0x48, //  #  #
+	0x48, //  #  #
+	0x48, //  #  #
+	0xF0, // #### 
+	0x00, //      
+	0x00, //      
+
+	// @296 'E' (5 pixels wide)
+	0xF8, // #####
+	0x48, //  #  #
+	0x60, //  ##  
+	0x40, //  #   
+	0x48, //  #  #
+	0xF8, // #####
+	0x00, //      
+	0x00, //      
+
+	// @304 'F' (5 pixels wide)
+	0xF8, // #####
+	0x48, //  #  #
+	0x60, //  ##  
+	0x40, //  #   
+	0x40, //  #   
+	0xE0, // ###  
+	0x00, //      
+	0x00, //      
+
+	// @312 'G' (5 pixels wide)
+	0x70, //  ### 
+	0x40, //  #   
+	0x40, //  #   
+	0x58, //  # ##
+	0x50, //  # # 
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @320 'H' (5 pixels wide)
+	0xE8, // ### #
+	0x48, //  #  #
+	0x78, //  ####
+	0x48, //  #  #
+	0x48, //  #  #
+	0xE8, // ### #
+	0x00, //      
+	0x00, //      
+
+	// @328 'I' (5 pixels wide)
+	0x70, //  ### 
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @336 'J' (5 pixels wide)
+	0x38, //   ###
+	0x10, //    # 
+	0x10, //    # 
+	0x50, //  # # 
+	0x50, //  # # 
+	0x20, //   #  
+	0x00, //      
+	0x00, //      
+
+	// @344 'K' (5 pixels wide)
+	0xD8, // ## ##
+	0x50, //  # # 
+	0x60, //  ##  
+	0x70, //  ### 
+	0x50, //  # # 
+	0xD8, // ## ##
+	0x00, //      
+	0x00, //      
+
+	// @352 'L' (5 pixels wide)
+	0xE0, // ###  
+	0x40, //  #   
+	0x40, //  #   
+	0x40, //  #   
+	0x48, //  #  #
+	0xF8, // #####
+	0x00, //      
+	0x00, //      
+
+	// @360 'M' (5 pixels wide)
+	0xD8, // ## ##
+	0xD8, // ## ##
+	0xD8, // ## ##
+	0xA8, // # # #
+	0x88, // #   #
+	0xD8, // ## ##
+	0x00, //      
+	0x00, //      
+
+	// @368 'N' (5 pixels wide)
+	0xD8, // ## ##
+	0x68, //  ## #
+	0x68, //  ## #
+	0x58, //  # ##
+	0x58, //  # ##
+	0xE8, // ### #
+	0x00, //      
+	0x00, //      
+
+	// @376 'O' (5 pixels wide)
+	0x30, //   ## 
+	0x48, //  #  #
+	0x48, //  #  #
+	0x48, //  #  #
+	0x48, //  #  #
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @384 'P' (5 pixels wide)
+	0xF0, // #### 
+	0x48, //  #  #
+	0x48, //  #  #
+	0x70, //  ### 
+	0x40, //  #   
+	0xE0, // ###  
+	0x00, //      
+	0x00, //      
+
+	// @392 'Q' (5 pixels wide)
+	0x30, //   ## 
+	0x48, //  #  #
+	0x48, //  #  #
+	0x48, //  #  #
+	0x48, //  #  #
+	0x30, //   ## 
+	0x18, //    ##
+	0x00, //      
+
+	// @400 'R' (5 pixels wide)
+	0xF0, // #### 
+	0x48, //  #  #
+	0x48, //  #  #
+	0x70, //  ### 
+	0x48, //  #  #
+	0xE8, // ### #
+	0x00, //      
+	0x00, //      
+
+	// @408 'S' (5 pixels wide)
+	0x70, //  ### 
+	0x50, //  # # 
+	0x20, //   #  
+	0x10, //    # 
+	0x50, //  # # 
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @416 'T' (5 pixels wide)
+	0xF8, // #####
+	0xA8, // # # #
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @424 'U' (5 pixels wide)
+	0xD8, // ## ##
+	0x48, //  #  #
+	0x48, //  #  #
+	0x48, //  #  #
+	0x48, //  #  #
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @432 'V' (5 pixels wide)
+	0xD8, // ## ##
+	0x88, // #   #
+	0x48, //  #  #
+	0x50, //  # # 
+	0x50, //  # # 
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @440 'W' (5 pixels wide)
+	0xD8, // ## ##
+	0x88, // #   #
+	0xA8, // # # #
+	0xA8, // # # #
+	0xA8, // # # #
+	0x50, //  # # 
+	0x00, //      
+	0x00, //      
+
+	// @448 'X' (5 pixels wide)
+	0xD8, // ## ##
+	0x50, //  # # 
+	0x20, //   #  
+	0x20, //   #  
+	0x50, //  # # 
+	0xD8, // ## ##
+	0x00, //      
+	0x00, //      
+
+	// @456 'Y' (5 pixels wide)
+	0xD8, // ## ##
+	0x88, // #   #
+	0x50, //  # # 
+	0x20, //   #  
+	0x20, //   #  
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @464 'Z' (5 pixels wide)
+	0x78, //  ####
+	0x48, //  #  #
+	0x10, //    # 
+	0x20, //   #  
+	0x48, //  #  #
+	0x78, //  ####
+	0x00, //      
+	0x00, //      
+
+	// @472 '[' (5 pixels wide)
+	0x30, //   ## 
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x30, //   ## 
+	0x00, //      
+
+	// @480 '\' (5 pixels wide)
+	0x80, // #    
+	0x40, //  #   
+	0x40, //  #   
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x10, //    # 
+	0x00, //      
+
+	// @488 ']' (5 pixels wide)
+	0x60, //  ##  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x60, //  ##  
+	0x00, //      
+
+	// @496 '^' (5 pixels wide)
+	0x20, //   #  
+	0x20, //   #  
+	0x50, //  # # 
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+
+	// @504 '_' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0xF8, // #####
+
+	// @512 '`' (5 pixels wide)
+	0x20, //   #  
+	0x10, //    # 
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x00, //      
+
+	// @520 'a' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x30, //   ## 
+	0x10, //    # 
+	0x70, //  ### 
+	0x78, //  ####
+	0x00, //      
+	0x00, //      
+
+	// @528 'b' (5 pixels wide)
+	0xC0, // ##   
+	0x40, //  #   
+	0x70, //  ### 
+	0x48, //  #  #
+	0x48, //  #  #
+	0xF0, // #### 
+	0x00, //      
+	0x00, //      
+
+	// @536 'c' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x70, //  ### 
+	0x40, //  #   
+	0x40, //  #   
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @544 'd' (5 pixels wide)
+	0x18, //    ##
+	0x08, //     #
+	0x38, //   ###
+	0x48, //  #  #
+	0x48, //  #  #
+	0x38, //   ###
+	0x00, //      
+	0x00, //      
+
+	// @552 'e' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x70, //  ### 
+	0x70, //  ### 
+	0x40, //  #   
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @560 'f' (5 pixels wide)
+	0x10, //    # 
+	0x20, //   #  
+	0x70, //  ### 
+	0x20, //   #  
+	0x20, //   #  
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @568 'g' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x38, //   ###
+	0x48, //  #  #
+	0x48, //  #  #
+	0x38, //   ###
+	0x08, //     #
+	0x30, //   ## 
+
+	// @576 'h' (5 pixels wide)
+	0xC0, // ##   
+	0x40, //  #   
+	0x70, //  ### 
+	0x48, //  #  #
+	0x48, //  #  #
+	0xE8, // ### #
+	0x00, //      
+	0x00, //      
+
+	// @584 'i' (5 pixels wide)
+	0x20, //   #  
+	0x00, //      
+	0x60, //  ##  
+	0x20, //   #  
+	0x20, //   #  
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @592 'j' (5 pixels wide)
+	0x20, //   #  
+	0x00, //      
+	0x70, //  ### 
+	0x10, //    # 
+	0x10, //    # 
+	0x10, //    # 
+	0x10, //    # 
+	0x70, //  ### 
+
+	// @600 'k' (5 pixels wide)
+	0xC0, // ##   
+	0x40, //  #   
+	0x58, //  # ##
+	0x70, //  ### 
+	0x50, //  # # 
+	0xD8, // ## ##
+	0x00, //      
+	0x00, //      
+
+	// @608 'l' (5 pixels wide)
+	0x60, //  ##  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @616 'm' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0xD0, // ## # 
+	0xA8, // # # #
+	0xA8, // # # #
+	0xA8, // # # #
+	0x00, //      
+	0x00, //      
+
+	// @624 'n' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0xF0, // #### 
+	0x48, //  #  #
+	0x48, //  #  #
+	0xC8, // ##  #
+	0x00, //      
+	0x00, //      
+
+	// @632 'o' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x30, //   ## 
+	0x48, //  #  #
+	0x48, //  #  #
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @640 'p' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0xF0, // #### 
+	0x48, //  #  #
+	0x48, //  #  #
+	0x70, //  ### 
+	0x40, //  #   
+	0xE0, // ###  
+
+	// @648 'q' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x38, //   ###
+	0x48, //  #  #
+	0x48, //  #  #
+	0x38, //   ###
+	0x08, //     #
+	0x18, //    ##
+
+	// @656 'r' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x78, //  ####
+	0x20, //   #  
+	0x20, //   #  
+	0x70, //  ### 
+	0x00, //      
+	0x00, //      
+
+	// @664 's' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x30, //   ## 
+	0x20, //   #  
+	0x10, //    # 
+	0x60, //  ##  
+	0x00, //      
+	0x00, //      
+
+	// @672 't' (5 pixels wide)
+	0x00, //      
+	0x40, //  #   
+	0xF0, // #### 
+	0x40, //  #   
+	0x48, //  #  #
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @680 'u' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0xD8, // ## ##
+	0x48, //  #  #
+	0x48, //  #  #
+	0x38, //   ###
+	0x00, //      
+	0x00, //      
+
+	// @688 'v' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0xC8, // ##  #
+	0x48, //  #  #
+	0x30, //   ## 
+	0x30, //   ## 
+	0x00, //      
+	0x00, //      
+
+	// @696 'w' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0xD8, // ## ##
+	0xA8, // # # #
+	0xA8, // # # #
+	0x50, //  # # 
+	0x00, //      
+	0x00, //      
+
+	// @704 'x' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x48, //  #  #
+	0x30, //   ## 
+	0x30, //   ## 
+	0x48, //  #  #
+	0x00, //      
+	0x00, //      
+
+	// @712 'y' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0xD8, // ## ##
+	0x50, //  # # 
+	0x50, //  # # 
+	0x20, //   #  
+	0x20, //   #  
+	0x60, //  ##  
+
+	// @720 'z' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x78, //  ####
+	0x50, //  # # 
+	0x28, //   # #
+	0x78, //  ####
+	0x00, //      
+	0x00, //      
+
+	// @728 '{' (5 pixels wide)
+	0x10, //    # 
+	0x20, //   #  
+	0x20, //   #  
+	0x60, //  ##  
+	0x20, //   #  
+	0x20, //   #  
+	0x10, //    # 
+	0x00, //      
+
+	// @736 '|' (5 pixels wide)
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x20, //   #  
+	0x00, //      
+
+	// @744 '}' (5 pixels wide)
+	0x40, //  #   
+	0x20, //   #  
+	0x20, //   #  
+	0x30, //   ## 
+	0x20, //   #  
+	0x20, //   #  
+	0x40, //  #   
+	0x00, //      
+
+	// @752 '~' (5 pixels wide)
+	0x00, //      
+	0x00, //      
+	0x00, //      
+	0x28, //   # #
+	0x50, //  # # 
+	0x00, //      
+	0x00, //      
+	0x00, //      
+};
+
+
+
 #endif /* FONT_8X5_H_ */

+ 3 - 0
desk/libs/thirdparty/oled_ssd1327/fonts/fonts.h

@@ -21,6 +21,9 @@
 //
 #if(FONT_8x5 ==1)
 #include "font_8x5.h"
+#include "font_8x13_rus.h"
 #endif
 
+
+
 #endif /* FONTS_FONTS_H_ */

+ 11 - 2
desk/modules/menu/menu_items.cpp

@@ -14,8 +14,12 @@
 extern "C" {
 #include "GFX_SSD1327.h"
 #include "fonts.h"
+#include "message.h"
 }
 
+
+
+
 #define DBG if(1)
 
 extern bool update_flag;
@@ -174,9 +178,13 @@ static void screen_draw_main(uint8_t sel)
     // Основнаая рамка
     GFX_DrawRectangle(1, 1, 126, 125, 15);
     
+    // Дефолтный шрифт
     GFX_SetFont(font_8x5);
-    GFX_SetFontSize(2);
+    GFX_SetFontSize(4);
     
+    GFX_DrawString(8, 64, (char*)"12345", 15, 0);
+    
+#if 0    
     memset(screen_str_buf, 0, SCREEN_BUF_LEN);
     sprintf(screen_str_buf, "F: %u", raw_forw_turns);
     GFX_DrawString(8, 20, (char*)screen_str_buf, 15, 0);
@@ -196,8 +204,9 @@ static void screen_draw_main(uint8_t sel)
         sprintf(screen_str_buf, "M: back");
     else 
         sprintf(screen_str_buf, "M: stop");
+    
     GFX_DrawString(8, 80, (char*)screen_str_buf, 15, 0);
-        
+#endif        
     oled_display();
 }
 

+ 7 - 0
desk/modules/menu/message.h

@@ -0,0 +1,7 @@
+#ifndef __MESSAGE_H
+#define __MESSAGE_H
+
+char *test_rus = "Ïðèâåò!";
+
+
+#endif

+ 92 - 27
desk/modules/ssd_1327/oled_common.cpp

@@ -12,6 +12,7 @@
 
 extern "C" {
 #include "GFX_SSD1327.h"
+#include "GUI_Paint.h"  
 }
   
 #if defined(I2C_BRIDGE)
@@ -44,33 +45,9 @@ void init_oled(void)
     
     oled_clear(BLACK);
     
+    //test_oled();
     
-#if 0    
-    ssd1327.clearBuffer();
-    ssd1327.drawString(16, 16, (char*)"Hello", 0xF, 32);
-	ssd1327.drawString(16, 48, (char*)"World!", 0xF, 32);
-    ssd1327.writeFullBuffer();
-#endif
-    
-#if 0    
-    oled_draw_pixel(20, 20, 15);
-    oled_draw_pixel(21, 20, 15);
-    oled_draw_pixel(22, 20, 15);
-    
-    oled_draw_pixel(20, 21, 15);
-    oled_draw_pixel(21, 21, 15);
-    oled_draw_pixel(22, 21, 15);
-    
-    oled_draw_pixel(20, 22, 15);
-    oled_draw_pixel(21, 22, 15);
-    oled_draw_pixel(22, 22, 15);
-    
-    oled_draw_pixel(20, 23, 15);
-    oled_draw_pixel(21, 23, 15);
-    oled_draw_pixel(22, 23, 15);
-#endif    
-    
-    //GFX_Image(15, 0, (uint8_t*)logo_grayscale, 96, 96);
+    //while(1) {}
             
     oled_display();
 }
@@ -307,6 +284,62 @@ void oled_init(void)
   
     oled_display_on(1);
     
+#if 0  
+// Рабочий вариант
+    oled_command(0xae);//--turn off oled panel
+
+    oled_command(0x15);    //   set column address
+    oled_command(0x00);    //  start column   0
+    oled_command(0x7f);    //  end column   127
+
+    oled_command(0x75);    //   set row address
+    oled_command(0x00);    //  start row   0
+    oled_command(0x7f);    //  end row   127
+
+    oled_command(0x81);  // set contrast control
+    oled_command(0x80);
+
+    oled_command(0xa0);    // gment remap
+    oled_command(0x51);   //51
+
+    oled_command(0xa1);  // start line
+    oled_command(0x00);
+
+    oled_command(0xa2);  // display offset
+    oled_command(0x00);
+
+    oled_command(0xa4);    // rmal display
+    oled_command(0xa8);    // set multiplex ratio
+    oled_command(0x7f);
+
+    oled_command(0xb1);  // set phase leghth
+    oled_command(0xf1);
+
+    oled_command(0xb3);  // set dclk
+    oled_command(0x00);  //80Hz:0xc1 90Hz:0xe1   100Hz:0x00   110Hz:0x30 120Hz:0x50   130Hz:0x70     01
+
+    oled_command(0xab);  //
+    oled_command(0x01);  //
+
+    oled_command(0xb6);  // set phase leghth
+    oled_command(0x0f);
+
+    oled_command(0xbe);
+    oled_command(0x0f);
+
+    oled_command(0xbc);
+    oled_command(0x08);
+
+    oled_command(0xd5);
+    oled_command(0x62);
+
+    oled_command(0xfd);
+    oled_command(0x12);
+  
+    oled_display_on(1);
+#endif    
+    
+    
 #if 0  
     oled_command(SSD1327_DISPLAYOFF);  // Display Off
     
@@ -444,7 +477,7 @@ void oled_draw_string_frame(uint8_t str_num)
 }
 
 //
-void test_oled(void)
+void test_oled_old(void)
 {
 #if 0  
     for (int i = 0; i < 16; i++) {
@@ -479,5 +512,37 @@ void test_oled(void)
     GFX_SetFontSize(3);
     GFX_DrawString(4, 60, (char*)"BbAa12345", 15, 0);
 
+    oled_display();
+}
+
+//
+void test_oled(void)
+{
+    //void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_FillWay);
+#if 0    
+    Paint_NewImage(oled_buf, OLED_WIDTH, OLED_HEIGHT, 0, BLACK);
+    Paint_SetScale(2);
+    // 1.Select Image
+    Paint_SelectImage(oled_buf);
+    Paint_Clear(BLACK);
+  
+    Paint_DrawPoint(40, 40, WHITE, DOT_PIXEL_1X1, DOT_FILL_AROUND);
+    
+    //void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
+    //                UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style)
+
+      
+    Paint_DrawLine(10, 10, 10, 20, WHITE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
+#endif
+
+    GFX_SetFont(Font8_Table);
+    GFX_SetFontSize(1);
+    
+    //GFX_SetFont(font_8x13);
+    ///GFX_SetFontSize(1);
+    
+    GFX_DrawString(8, 20, (char*)"Hellow world", 15, 0);
+    
+    
     oled_display();
 }

+ 5 - 0
desk/modules/ssd_1327/oled_common.h

@@ -67,9 +67,14 @@ void oled_draw_string_frame(uint8_t str_num);
 //
 void oled_draw_rec(int x_start, int y_start, int x_end, int y_end, uint8_t color);
 
+//
+void test_oled_old(void);
+
 //
 void test_oled(void);
 
+extern uint8_t oled_buf[];
+
 #ifdef __cplusplus
 }
 #endif

BIN
output/desk.bin


+ 26 - 0
project/ewarm/desk/desk.ewp

@@ -376,6 +376,8 @@
                     <state>$PROJ_DIR$/../../../desk/libs/thirdparty/oled_ssd1327</state>
                     <state>$PROJ_DIR$/../../../desk/libs/thirdparty/oled_ssd1327/fonts</state>
                     <state>$PROJ_DIR$/../../../desk/libs/thirdparty/oled_ssd1327_new</state>
+                    <state>$PROJ_DIR$/../../../desk/libs/thirdparty/oled</state>
+                    <state>$PROJ_DIR$/../../../desk/libs/thirdparty/oled/gui</state>
                     <state>$PROJ_DIR$/../../../thirdparty_libs/share</state>
                     <state>$PROJ_DIR$/../../../thirdparty_libs/microrl</state>
                 </option>
@@ -2468,10 +2470,31 @@
                     <name>$PROJ_DIR$\..\..\..\thirdparty_libs\microrl\microrl.c</name>
                 </file>
             </group>
+            <group>
+                <name>oled</name>
+                <group>
+                    <name>gui</name>
+                    <file>
+                        <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled\gui\GUI_Paint.c</name>
+                    </file>
+                </group>
+                <file>
+                    <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled\Debug.h</name>
+                </file>
+                <file>
+                    <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled\DEV_Config.c</name>
+                </file>
+                <file>
+                    <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled\fonts.h</name>
+                </file>
+            </group>
             <group>
                 <name>oled_ssd1327</name>
                 <group>
                     <name>fonts</name>
+                    <file>
+                        <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\fonts\font_8x13_rus.h</name>
+                    </file>
                     <file>
                         <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\fonts\font_8x5.h</name>
                     </file>
@@ -2513,6 +2536,9 @@
             <file>
                 <name>$PROJ_DIR$\..\..\..\desk\modules\menu\menu_tree.h</name>
             </file>
+            <file>
+                <name>$PROJ_DIR$\..\..\..\desk\modules\menu\message.h</name>
+            </file>
         </group>
         <group>
             <name>settings</name>

+ 24 - 0
project/ewarm/desk/desk.ewt

@@ -3167,10 +3167,31 @@
                     <name>$PROJ_DIR$\..\..\..\thirdparty_libs\microrl\microrl.c</name>
                 </file>
             </group>
+            <group>
+                <name>oled</name>
+                <group>
+                    <name>gui</name>
+                    <file>
+                        <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled\gui\GUI_Paint.c</name>
+                    </file>
+                </group>
+                <file>
+                    <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled\Debug.h</name>
+                </file>
+                <file>
+                    <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled\DEV_Config.c</name>
+                </file>
+                <file>
+                    <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled\fonts.h</name>
+                </file>
+            </group>
             <group>
                 <name>oled_ssd1327</name>
                 <group>
                     <name>fonts</name>
+                    <file>
+                        <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\fonts\font_8x13_rus.h</name>
+                    </file>
                     <file>
                         <name>$PROJ_DIR$\..\..\..\desk\libs\thirdparty\oled_ssd1327\fonts\font_8x5.h</name>
                     </file>
@@ -3212,6 +3233,9 @@
             <file>
                 <name>$PROJ_DIR$\..\..\..\desk\modules\menu\menu_tree.h</name>
             </file>
+            <file>
+                <name>$PROJ_DIR$\..\..\..\desk\modules\menu\message.h</name>
+            </file>
         </group>
         <group>
             <name>settings</name>

File diff suppressed because it is too large
+ 4 - 2
project/ewarm/settings/tuber.wsdt


Some files were not shown because too many files changed in this diff