diff --git a/package/PikaPiZero/.vscode/settings.json b/package/PikaPiZero/.vscode/settings.json deleted file mode 100644 index df3d4fc56..000000000 --- a/package/PikaPiZero/.vscode/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "RTT_Studio.Build.Parallel_Jobs": "12", - "RTT_Studio.Env_Location": "D:/RT-ThreadStudio/platform/env_released/env", - "RTT_Studio.Toolchain_Location": "D:/RT-ThreadStudio/repo/Extract/ToolChain_Support_Packages/ARM/GNU_Tools_for_ARM_Embedded_Processors/5.4.1/bin", - "RTT_Studio.Debuger.Bin_File": "D:/RT-ThreadStudio/repo/Extract/ToolChain_Support_Packages/ARM/GNU_Tools_for_ARM_Embedded_Processors/5.4.1/bin/arm-none-eabi-gdb.exe", - "RTT_Studio.Debuger.J-Link.Location": "D:/RT-ThreadStudio/repo/Extract/Debugger_Support_Packages/SEGGER/J-Link/6.80d2", - "RTT_Studio.Debuger.ST-Link.Location": "D:/RT-ThreadStudio/repo/Extract/Debugger_Support_Packages/STMicroelectronics/ST-LINK_Debugger/1.6.0", - "RTT_Studio.Debuger.QEMU.Location": "D:/RT-ThreadStudio/repo/Extract/Debugger_Support_Packages/RealThread/QEMU/4.2.0.4" -} \ No newline at end of file diff --git a/package/PikaPiZero/LCD_Driver.c b/package/PikaPiZero/LCD_Driver.c index ac677bd0b..d9c0b9a08 100644 --- a/package/PikaPiZero/LCD_Driver.c +++ b/package/PikaPiZero/LCD_Driver.c @@ -3,9 +3,9 @@ #include "stm32g030_pika_msp.h" #include "main.h" /* config SPI mode, chocie one from three */ - #define SPI_SOFT +// #define SPI_SOFT // #define SPI_HARD -// #define SPI_DMA +#define SPI_DMA SPI_HandleTypeDef hspi1; DMA_HandleTypeDef hdma_spi1_tx; @@ -343,6 +343,7 @@ void LCD_DrawRegin(u16 x_start, u16 y_start, u16 x_end, u16 y_end, u16* pData) { LCD_CS_SET; } + #define BUFF_SIZE (X_MAX_PIXEL) void LCD_Clear(u16 Color) { unsigned int i, m; @@ -356,6 +357,18 @@ void LCD_Clear(u16 Color) { } } +void LCD_Fill(u16 x0,u16 y0,u16 hight,u16 wight,u16 color){ + unsigned int i, y; + u16 data[BUFF_SIZE]; + for (i = 0; i < BUFF_SIZE; i++) { + data[i] = color; + } + int y_end = y0 + hight; + for (y = y0; y < y_end; y++) { + LCD_DrawRegin(x0, y, x0 + wight, y + 1, data); + } +} + int32_t __Arm2D_platform_drawRegin(uint32_t x, uint32_t y, uint32_t width, diff --git a/package/PikaPiZero/LCD_Driver.h b/package/PikaPiZero/LCD_Driver.h index 76034285a..c9b85519e 100644 --- a/package/PikaPiZero/LCD_Driver.h +++ b/package/PikaPiZero/LCD_Driver.h @@ -90,5 +90,6 @@ void LCD_DrawPoint(u16 x, u16 y, u16 Data); void LCD_SetRegion(u16 x_start, u16 y_start, u16 x_end, u16 y_end); void LCD_Write_u16(u16 Data); void LCD_DrawRegin(u16 x_start, u16 y_start, u16 x_end, u16 y_end, u16* pData); +void LCD_Fill(u16 x0,u16 y0,u16 hight,u16 wight,u16 color); #endif \ No newline at end of file diff --git a/package/PikaPiZero/PikaPiZero.py b/package/PikaPiZero/PikaPiZero.py index a6542efc1..34f833ad7 100644 --- a/package/PikaPiZero/PikaPiZero.py +++ b/package/PikaPiZero/PikaPiZero.py @@ -33,5 +33,16 @@ class KEY(TinyObj): pass +class LCD(TinyObj): + def init(): + pass + + def clear(color: str): + pass + + def fill(x0: int, y0: int, hight: int, wight: int, color: str): + pass + + class Point(TinyObj): pass diff --git a/package/PikaPiZero/PikaPiZero_LCD.c b/package/PikaPiZero/PikaPiZero_LCD.c new file mode 100644 index 000000000..34f57a71d --- /dev/null +++ b/package/PikaPiZero/PikaPiZero_LCD.c @@ -0,0 +1,43 @@ +#include "PikaPiZero_LCD.h" +#include "LCD_Driver.h" +u16 LCD_getColorCode(char * color); + +void PikaPiZero_LCD_clear(PikaObj *self, char * color){ + u16 color_code = WHITE; + color_code = LCD_getColorCode(color); + LCD_Clear(color_code); +} +void PikaPiZero_LCD_fill(PikaObj *self, char * color, int hight, int wight, int x0, int y0){ + u16 color_code = WHITE; + color_code = LCD_getColorCode(color); + LCD_Fill(x0, y0, hight, wight, color_code); +} +void PikaPiZero_LCD_init(PikaObj *self){ + LCD_Init(); +} +u16 LCD_getColorCode(char * color){ + if(strEqu(color, "white")){ + return WHITE; + } + + if(strEqu(color, "blue")){ + return BLUE; + } + + if(strEqu(color, "red")){ + return RED; + } + + if(strEqu(color, "yellow")){ + return YELLOW; + } + + if(strEqu(color, "black")){ + return BLACK; + } + + if(strEqu(color, "green")){ + return GREEN; + } + return WHITE; +} \ No newline at end of file diff --git a/package/STM32G030Booter/main.c b/package/STM32G030Booter/main.c index 1105ca2e0..e5a064f82 100644 --- a/package/STM32G030Booter/main.c +++ b/package/STM32G030Booter/main.c @@ -87,7 +87,7 @@ int main(void) { /* init mem pool */ #if use_mem_pool - pikaPool = pool_init(0x1400, 4); + pikaPool = pool_init(0x1800, 4); printf("[info]: pika memory poool init ok \r\n"); #endif diff --git a/package/STM32G030Booter/startup_stm32g030xx.s b/package/STM32G030Booter/startup_stm32g030xx.s index b5bf17468..27012ef38 100644 --- a/package/STM32G030Booter/startup_stm32g030xx.s +++ b/package/STM32G030Booter/startup_stm32g030xx.s @@ -40,7 +40,7 @@ __initial_sp ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; -Heap_Size EQU 0x1500 +Heap_Size EQU 0x1A00 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base diff --git a/package/STM32G030Booter/stm32g030_pika_msp.h b/package/STM32G030Booter/stm32g030_pika_msp.h index 7688d808b..0de6f5d9f 100644 --- a/package/STM32G030Booter/stm32g030_pika_msp.h +++ b/package/STM32G030Booter/stm32g030_pika_msp.h @@ -1,7 +1,7 @@ #ifndef __STM32G030_PIKA_PORT__H #define __STM32G030_PIKA_PORT__H -#define use_mem_pool 1 +#define use_mem_pool 0 #include #include "pikaObj.h" @@ -49,7 +49,7 @@ void HARDWARE_PRINTF_Init(void); #define FLASH_PIKA_ASM_START_ADDR FLASH_SCRIPT_START_ADDR #define FLASH_PIKA_ASM_END_ADDR FLASH_SCRIPT_END_ADDR -#define RX_BUFF_LENGTH 32 +#define RX_BUFF_LENGTH 64 /* support download python script by uart1 */ uint8_t STM32_Code_reciveHandler(char* data, uint32_t rxSize);