mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
add LCD module for pikapi zero
This commit is contained in:
parent
ba96b16917
commit
245be71a1b
9
package/PikaPiZero/.vscode/settings.json
vendored
9
package/PikaPiZero/.vscode/settings.json
vendored
@ -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"
|
||||
}
|
@ -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,
|
||||
|
@ -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
|
@ -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
|
||||
|
43
package/PikaPiZero/PikaPiZero_LCD.c
Normal file
43
package/PikaPiZero/PikaPiZero_LCD.c
Normal file
@ -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;
|
||||
}
|
@ -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
|
||||
|
||||
|
@ -40,7 +40,7 @@ __initial_sp
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x1500
|
||||
Heap_Size EQU 0x1A00
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
|
@ -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 <stdint.h>
|
||||
#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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user