RP2040-LCD-0.99-B

From Waveshare Wiki
Jump to: navigation, search
RP2040-LCD-0.99-B
RP2040-LCD-0.99-B.jpg

USB Type-C, RP2040
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

RP2040-LCD-0.99-B is a low-cost, high-performance MCU board designed by Waveshare. Tiny size with onboard 0.99inch LCD round display (with flat bottom), 6-axis sensor (3-axis accelerometer and 3-axis gyroscope), and so on, adapting 4 × GPIO pins through SH1.0 6PIN connector, which makes it easy for you to develop and integrate it into products quickly.

Features

  • RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom.
  • Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz.
  • 264KB of SRAM, and 2MB of onboard Flash memory.
  • Type-C connector, keeps it up to date, easier to use.
  • Onboard 0.99inch 128×115 pixels 65K colorful IPS LCD (with flat bottom) for clear color pictures.
  • 4 × GPIO pins are adapted through the SH1.0 6PIN connector.
  • Adopts CNC metal case with Acrylic dull-polish bottom plate.
  • USB 1.1 with device and host support.
  • Low-power sleep and dormant modes.
  • Drag-and-drop programming using mass storage over USB.
  • 2 × I2C, 4 × 12-bit ADC.
  • Accurate clock and timer on-chip.
  • Temperature sensor.
  • Accelerated floating-point libraries on-chip.
  • 8 × Programmable I/O (PIO) state machines for custom peripheral support.

Parameters

LCD Parameters
Controller GC9107 Resolution 128(H) RGB x 115(V)
Communication Interface SPI Display Dimensions Φ33mm
Display Panel IPS Pixel Size 0.19(H)x 0.19(V)mm


IMU Parameter
Sensor QMI8658
Accelerometer Resolution: 16 bits
Measurement Range (Optional): ±2, ±4, ±8, ±16g
Gyroscope Resolution: 16 bits
Measuremnet Range (Optional): ±16, ±32, ±64, ±128, ±256, ±512, ±1024, ±2048°/sec

Dimensions

RP2040-LCD-0.99-B-Dim.jpg

Pico Getting Started

Firmware Download

  • MicroPython Firmware Download

MicroPython Firmware Download.gif

  • C_Blink Firmware Download

C Blink Download.gif

Introduction

Raspberry Pi Pico Basics

MicroPython Series

Install Thonny IDE

In order to facilitate the development of Pico/Pico2 boards using MicroPython on a computer, it is recommended to download the Thonny IDE

  • Download Thonny IDE and follow the steps to install, the installation packages are all Windows versions, please refer to Thonny's official website for other versions
  • After installation, the language and motherboard environment need to be configured for the first use. Since we are using Pico/Pico2, pay attention to selecting the Raspberry Pi option for the motherboard environment

Pico-R3-Tonny1.png

  • Configure MicroPython environment and choose Pico/Pico2 port
    • Connect Pico/Pico2 to your computer first, and in the lower right corner of Thonny left-click on the configuration environment option --> select Configture interpreter
    • In the pop-up window, select MicroPython (Raspberry Pi Pico), and choose the corresponding port

700px-Raspberry-Pi-Pico-Basic-Kit-M-2.png
700px-Raspberry-Pi-Pico-Basic-Kit-M-3.png

Flash Firmware

  • Click OK to return to the Thonny main interface, download the corresponding firmware library and burn it to the device, and then click the Stop button to display the current environment in the Shell window
  • Note: Flashing the Pico2 firmware provided by Micropython may cause the device to be unrecognized, please use the firmware below or in the package
  • How to download the firmware library for Pico/Pico2 in windows: After holding down the BOOT button and connecting to the computer, release the BOOT button, a removable disk will appear on the computer, copy the firmware library into it
  • How to download the firmware library for RP2040/RP2350 in windows: After connecting to the computer, press the BOOT key and the RESET key at the same time, release the RESET key first and then release the BOOT key, a removable disk will appear on the computer, copy the firmware library into it (you can also use the Pico/Pico2 method)

Raspberry-Pi-Pico2-Python.png

MicroPython Series

【MicroPython】 machine.Pin class function details
【MicroPython】machine.PWM class function details
【MicroPython】machine.ADC class function details
【MicroPython】machine.UART class function details
【MicroPython】machine.I2C class function details
【MicroPython】machine.SPI class function details
【MicroPython】rp2.StateMachine class function details

C/C++ Series

For C/C++, it is recommended to use Pico VS Code for development. This is a Microsoft Visual Studio Code extension designed to make it easier for you to create, develop, and debug projects for the Raspberry Pi Pico series development boards. No matter if you are a beginner or an experienced professional, this tool can assist you in developing Pico with confidence and ease. Here's how to install and use the extension.

  • Official website tutorial: https://www.raspberrypi.com/news/pico-vscode-extension/
  • This tutorial is suitable for Raspberry Pi Pico, Pico2 and the RP2040 and RP2350 series development boards developed by Waveshare
  • The development environment defaults to Windows11. For other environments, please refer to the official tutorial for installation

Install VSCode

  1. First, click to download pico-vscode package, unzip and open the package, double-click to install VSCode
    Pico-vscode-1.JPG
    Note: If vscode is installed, check if the version is v1.87.0 or later
    Pico-vscode-2.JPG
    Pico-vscode-3.JPG

Install Extension

  1. Click Extensions and select Install from VSIX
    Pico-vscode-4.JPG
  2. Select the package with the vsix suffix and click Install
    Pico-vscode-5.JPG
  3. Then vscode will automatically install raspberry-pi-pico and its dependency extensions, you can click Refresh to check the installation progress
    Pico-vscode-6.JPG
  4. The text in the right lower corner shows that the installation is complete. Close VSCode
    Pico-vscode-7.JPG

Configure Extension

  1. Open directory C:\Users\username and copy the entire .pico-sdk to that directory
    Pico-vscode-8.JPG
  2. The Copy is completed
    Pico-vscode-9.JPG
  3. Open vscode and configure the paths for the Raspberry Pi Pico extensions
    Pico-vscode-10.JPG
    The configuration is as follows:
    Cmake Path:
    ${HOME}/.pico-sdk/cmake/v3.28.6/bin/cmake.exe
    
    Git Path:
    ${HOME}/.pico-sdk/git/cmd/git.exe    
    
    Ninja Path:
    ${HOME}/.pico-sdk/ninja/v1.12.1/ninja.exe
    
    Python3 Path:
    ${HOME}/.pico-sdk/python/3.12.1/python.exe             
    

New Project

  1. The configuration is complete, create a new project, enter the project name, select the path, and click Create to create the project
    To test the official example, you can click on the Example next to the project name to select
    Pico-vscode-11.JPG
  2. The project is created successfully
    Pico-vscode-12.JPG
  3. Select the SDK version
    Pico-vscode-13.JPG
  4. Select Yes for advanced configuration
    Pico-vscode-14.JPG
  5. Choose the cross-compilation chain, 13.2.Rel1 is applicable for ARM cores, RISCV.13.3 is applicable for RISCV cores. You can select either based on your requirements
    Pico-vscode-15.JPG
  6. Select default for CMake version (the path configured earlier)
    Pico-vscode-16.JPG
  7. Select default for Ninjaversion
    Pico-vscode-17.JPG
  8. Select the development board
    Pico-vscode-18.JPG
  9. Click Complie to compile
    Pico-vscode-19.JPG
  10. The uf2 format file is successfully compiled
    Pico-vscode-20.JPG

Import Project

  1. The Cmake file of the imported project cannot have Chinese (including comments), otherwise the import may fail
  2. To import your own project, you need to add a line of code to the Cmake file to switch between pico and pico2 normally, otherwise even if pico2 is selected, the compiled firmware will still be suitable for pico
    Pico-vscode-21.JPG set(PICO_BOARD pico CACHE STRING "Board type")

Update Extension

  1. The extension version in the offline package is 0.15.2, and you can also choose to update to the latest version after the installation is complete
    Pico-vscode-22.JPG

Arduino IDE Series

Install Arduino IDE

  1. First, go to Arduino official website to download the installation package of the Arduino IDE.
    600px-Arduino下载2.0版本.jpg
  2. Here, you can select Just Download.
    仅下载不捐赠.png
  3. Once the download is complete, click Install.
    IDE安装水印-1.gif
    Notice: During the installation process, it will prompt you to install the driver, just click Install
    600px

Arduino IDE Interface

  1. After the first installation, when you open the Arduino IDE, it will be in English. You can switch to other languages in File --> Preferences, or continue using the English interface.
    首选项-简体中文.jpg
  2. In the Language field, select the language you want to switch to, and click OK.
    600px-首选项-简体中文ok.jpg

Install Arduino-Pico Core in the Arduino IDE

  1. Open the Arduino IDE, click on the file in the top left corner, and select Preferences
    RoArm-M1 Tutorial04.jpg
  2. Add the following link to the attached board manager URL, and then click OK
    https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json

    RoArm-M1 Tutorial II05.jpg
    Note: If you already have an ESP32 board URL, you can use a comma to separate the URLs as follows:

    https://dl.espressif.com/dl/package_esp32_index.json,https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json
  3. Click Tools > Development Board > Board Manager > Search pico, as my computer has already been installed, it shows that it is installed
    Pico Get Start 05.png
    Pico Get Start 06.png

Upload Demo at the First Time

  1. Press and hold the BOOTSET button on the Pico board, connect the pico to the USB port of the computer via the Micro USB cable, and release the button after the computer recognizes a removable hard disk (RPI-RP2).
    Pico Get Start.gif
  2. Download the program and open D1-LED.ino under the arduino\PWM\D1-LED path
  3. Click Tools --> Port, remember the existing COM, do not click this COM (the COM displayed is different on different computers, remember the COM on your own computer)
    UGV1 doenload02EN.png
  4. Connect the driver board to the computer using a USB cable. Then, go to Tools > Port. For the first connection, select uf2 Board. After uploading, when you connect again, an additional COM port will appear
    UGV1 doenload03EN.png
  5. Click Tools > Development Board > Raspberry Pi Pico > Raspberry Pi Pico or Raspberry Pi Pico 2
    Pico Get Start02.png
  6. After setting it up, click the right arrow to upload the program
    Pico Get Start03.png
  • If issues arise during this period, and if you need to reinstall or update the Arduino IDE version, it is necessary to uninstall the Arduino IDE completely. After uninstalling the software, you need to manually delete all contents within the C:\Users\[name]\AppData\Local\Arduino15 folder (you need to show hidden files to see this folder). Then, proceed with a fresh installation.

Open Source Demos

MircoPython video demo (github)
MicroPython firmware/Blink demos (C)
Raspberry Pi official C/C++ demo (github)
Raspberry Pi official micropython demo (github)
Arduino official C/C++ demo (github)


API

If you have used our SPI screens before you should be familiar with this demo.

C

Bottom-layer Hardware Interfaces

We have encapsulated the bottom layer, and due to different hardware platforms, the internal implementations vary. If you need to understand the internal implementation, you can refer to the corresponding directory for details.
You can see many definitions in DEV_Config.c(.h) in the directory: c\lib\Config.

  • Data type:
#define UBYTE   uint8_t
#define UWORD   uint16_t
#define UDOUBLE uint32_t
  • Module initialization and exit:
void DEV_Module_Init(void);
void DEV_Module_Exit(void);
Note:
1. Here is the handling of some GPIOs before and after using the LCD.
  • GPIO read/write:
void 	DEV_Digital_Write(UWORD Pin, UBYTE Value);
UBYTE 	DEV_Digital_Read(UWORD Pin);
  • SPI writes data:
void DEV_SPI_WriteByte(UBYTE Value);

Upper Layer Application

For the screen, tasks such as drawing, displaying Chinese and English characters and showing images are typically handled by upper-layer applications. Many users have asked about graphics processing, so we provide some basic functions for this purpose.
You can find the GUI module in the following directory: c\lib\GUI\GUI_Paint.c(.h)
LCD PICO GUI 1.png
In the following directory are the character fonts that the GUI depends on, in the directory: c\lib\Fonts
LCD rpi Font.png

  • Create Image Properties: Create a new set of image properties, including the name of the image buffer, width, height, rotation angle, and color.
void Paint_NewImage(UWORD *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
Parameters:
 	image: The name of the image buffer is a pointer pointing to the starting address of the image buffer;
 	Width: The width of the image buffer;
 	Height: The height of the image buffer;
 	Rotate: The flipping angle of the image buffer;
 	Color: The initial color of the image;
  • Select Image Buffer: The purpose of selecting an image buffer is to enable the creation of multiple image properties. Multiple image buffers can exist, and you can choose each image you have created.
void Paint_SelectImage(UBYTE *image)
Parameters:
 	image: The name of the image buffer is a pointer to the starting address of the image buffer;
  • Image Rotation: Set the rotation angle of the selected image. It is recommended to use this function after Paint_SelectImage(). You can choose rotation angles of 0, 90, 180, or 270 degrees.
void Paint_SetRotate(UWORD Rotate)
Parameters:
 	Rotate: The image rotation angle can be selected as ROTATE_0, ROTATE_90, ROTATE_180, and ROTATE_270, corresponding to 0, 90, 180, and 270 degrees respectively.
【Note】 Under different rotation angles, the corresponding starting pixel points for coordinates are different. Here, taking 1.14 as an example, the four images are in the sequence of 0°, 90°, 180°, and 270°. This is for reference only.
Pico LCD Rotate.jpg
  • Image Mirror Flip: Set the mirror flip of the selected image, you can choose No Mirror, Horizontal Mirror, Vertical Mirror or Image Center Mirror.
void Paint_SetMirroring(UBYTE mirror)
Parameters:
 	mirror: Image mirroring method, you can choose MIRROR_NONE, MIRROR_HORIZONTAL, MIRROR_VERTICAL, MIRROR_ORIGIN corresponds to no mirroring, about horizontal mirroring, about vertical mirroring, about image center mirroring, respectively.
  • Set the display position and color of a point in the buffer: This is the core function of the GUI, handling the display position and color of a point in the buffer.
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
Parameters:
 	Xpoint: X position of the point in the image buffer
 	Ypoint: Y position of the point in the image buffer
 	Color: Color of the dot display
  • Image Buffer Fill Color: Fill the image buffer with a certain color, generally used as a screen white-out function.
void Paint_Clear(UWORD Color)
Parameters:
 	Color: fill color
  • Fill a portion of the image buffer with a specified color: This function fills a specified portion of the image buffer with a particular color. It is commonly used for functions such as clearing a window, and often used in displaying time, for example, clearing the display of the previous second.
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
Parameters:
 	Xstart: X starting point coordinates of the window
 	Ystart: Y starting point coordinates of the window
 	Xend: X endpoint coordinates of the window
 	Yend: Y endpoint coordinates of the window
 	Color: fill color
  • Draw points: Draw points on (Xpoint, Ypoint) in the image buffer, you can choose the color, point size, and point style.
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
Parameters:
 	Xpoint: X coordinate of the point
 	Ypoint: Y coordinate of the point
 	Color:  Fill color
 	Dot_Pixel: Dot size, provides default 8 sizes of dots
 	 	 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;
 	Dot_Style: dot style and size expansion method determine whether the expansion is centered around the point or extends from the bottom left corner of the point towards the top right 
 	 	typedef enum {
 	 	   DOT_FILL_AROUND  = 1,		
 	 	   DOT_FILL_RIGHTUP,
 	 	} DOT_STYLE;
  • Draw Line: Draw a line in the image buffer from (Xstart, Ystart) to (Xend, Yend). You can choose the color, line width and line style.
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style , LINE_STYLE Line_Style)
Parameters:
 	Xstart: X starting point coordinates of the line
 	Ystart: Y starting point coordinates of the line
 	Xend: X endpoint coordinates of the line
 	Yend: Y endpoint coordinates of the line
 	Color: Fill color
 	Line_width: Line width, provides default 8 widths
 	 	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;
 	 Line_Style: Line style, choose whether the lines are to be connected in a straight line or a dotted line.
 	 	typedef enum {
 	 	 	 LINE_STYLE_SOLID = 0,
 	 	 	 LINE_STYLE_DOTTED,
 	 	} LINE_STYLE;
  • Draw Rectangle: Draw a rectangle from (Xstart, Ystart) to (Xend, Yend) in the image buffer, you can choose the color, the width of the line and whether to fill the inside of the rectangle or not.
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
Parameters:
 	Xstart: X starting point coordinates of the rectangle
 	Ystart: Y starting point coordinates of the rectangle
 	Xend: X endpoint coordinates of the rectangle
 	Yend: Y endpoint coordinates of the rectangle
 	Color: Fill color
 	Line_width: The width of the four sides of the rectangle, providing the default 8 widths
 	 	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;
 	Draw_Fill: Fill, in whether to fill the interior of the rectangle
 	 	typedef enum {
 	 	 	 DRAW_FILL_EMPTY = 0,
 	 	 	 DRAW_FILL_FULL,
 	 	} DRAW_FILL;
  • Draw Circle: Draw a circle in the image buffer with (X_Center, Y_Center) as the center and a radius of Radius. You can choose the color, line width and whether to fill the interior of the circle.
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
Parameters:
 	X_Center: X coordinate of the center of the circle
 	Y_Center: Y coordinate of the center of the circle
 	Radius: radius of a circle
 	Color: fill color
 	Line_width: The width of the arc, provides the default 8 widths
 	 	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;
 	Draw_Fill: Fill, whether to fill the inside of the circle
 	 	typedef enum {
 	 	 	 DRAW_FILL_EMPTY = 0,
 	 	 	 DRAW_FILL_FULL,
 	 	} DRAW_FILL;
  • Write Ascii Character: Write an Ascii character in the image buffer with (Xstart, Ystart) as the top-left corner. You can choose the Ascii code visual character font library, foreground color, and background color of the font.
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
Parameters:
 	Xstart: X coordinate of the left vertex of the character
 	Ystart: Y coordinate of the left vertex of the character
 	Ascii_Char:Ascii characters
 	Font: Ascii code visual character font, the following fonts are provided in the Fonts folder:
 	 	font8: 5*8 font
 	 	font12: 7*12 font
 	 	font16: 11*16 font
 	 	font20: 14*20 font
 	 	font24: 17*24 font
 	Color_Foreground: font color
 	Color_Background: background color
  • Write English String: Write a string of English characters in the image buffer with (Xstart, Ystart) as the top-left corner. You can choose the Ascii code visual character font library, foreground color and background color of the font.
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
Parameters:
 	Xstart: X coordinate of the left vertex of the character
 	Ystart: Y coordinate of the left vertex of the character
 	pString: String, string is a pointer
 	Font: Ascii code visual character font, the following fonts are provided in the Fonts folder:
 	 	font8: 5*8 font
 	 	font12: 7*12 font
 	 	font16: 11*16 font
 	 	font20: 14*20 font
 	 	font24: 17*24 font
 	Color_Foreground: font color
 	Color_Background: background color
  • Write Chinese String: Write a string of Chinese characters in the image buffer with (Xstart, Ystart) as the top-left corner. You can choose the GB2312 encoding character font library, foreground color and background color of the font.
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background)
Parameters:
        Xstart: X coordinate of the left vertex of the character
 	Ystart: Y coordinate of the left vertex of the character
 	pString: String, string is a pointer
 	Font: GB2312 encoded character font, the following fonts are provided in the Fonts folder:
 	 	font12CN: ascii character font 11*21, Chinese font 16*21
 	 	font24CN: ascii character font 24*41, Chinese font 32*41
 	Color_Foreground: font color
 	Color_Background: Background color
  • Write Numbers: Write a string of numbers in the image buffer with (Xstart, Ystart) as the top-left corner. You can choose the Ascii code visual character font library, foreground color, and background color of the font.
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, double Nummber, sFONT* Font, UWORD Digit,UWORD Color_Foreground, UWORD Color_Background);
Parameters:
 	Xstart: X coordinate of the left vertex of the character
 	Ystart: Y coordinate of the left vertex of the character
 	Nummber: The displayed numbers are stored as 32-bit integers, capable of displaying up to 2147483647.
 	Font: Ascii character visual character font library, the following fonts are provided in the Fonts folder:
 	 	font8: 5*8 font
 	 	font12: 7*12 font
 	 	font16: 11*16 font
 	 	font20: 14*20 font
 	 	font24: 17*24 font
        Digit: Display decimal places
 	Color_Foreground: font color 
 	Color_Background: Background color
  • Display time: In the image buffer, display a period with (Xstart, Ystart) as the top-left corner. You can choose the Ascii code visual character font library, foreground color and background color of the font.
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground)
Parameters:
 	Xstart: X coordinate of the left vertex of the character
 	Ystart: Y coordinate of the left vertex of the character
 	pTime:  The displayed time is defined using a time structure. You only need to pass the individual digits of hours, minutes and seconds as parameters.
 	Font: Ascii code visual character font, the following fonts are provided in the Fonts folder:
 	 	font8: 5*8 font
 	 	font12: 7*12 font
 	 	font16: 11*16 font
 	 	font20: 14*20 font
 	 	font24: 17*24 font
 	Color_Foreground: Font color
 	Color_Background: Background color

QMI8658

  • Module initialization:
unsigned char QMI8658_init(void);
  • Read data:
void QMI8658_read_xyz(float acc[3], float gyro[3], unsigned int *tim_count);
Parameter:
	 float acc[3]:  An array to store acceleration values, represented as floating-point numbers, containing three elements for the X, Y, and Z axes respectively
	 float gyro[3]: An array to store gyroscope values, represented as floating-point numbers, containing three elements for the angular velocity on the X, Y and Z axes respectively.

Python

Low-level Hardware Interface

  • Module initialization:
def __init__(self)
  • Send commands:
def write_cmd(self, cmd)
  • Send data:
def write_data(self, buf)
  • Backlight adjustment:
def set_bl_pwm(self,duty)

Drawing GUI

  • Input the library:
import framebuf
  • Create the object:

Customize the class LCD_0inch99 which inherits from the framebuf. FrameBuffer class in MicroPython. This class provides various methods for drawing images. Let's first create an object of the LCD_0inch99 class.

LCD = LCD_0inch99()
  • Draw a line:
LCD.line(x1, y1, x2, y2, color)
Parameter:
	x1, y1: x and y coordinates of the starting point
	x2, y2: x and y coordinates of the ending point
	color:  Line color
  • Draw a rectangle:
LCD.fill_rect(x1, y1, w, h, color)
Parameters:
	x1, y1: The x and y coordinates of the top-left corner of the rectangle
        w, h: Width and height of the rectangle
        color: the filling color of the rectangle
  • Write the text:
LCD.text(str, x, y, color)
Parameters:
         str: display the text
	 x, y:  The x and y coordinates of the upper left corner of the text
         color: text color
  • Change the text size:
LCD.write_text(str, x, y, size, color)
Parameters:
	 size: The difference between this function and LCD.text is that it supports custom font sizes. This parameter is used to specify the font size.
  • Display:
LCD.show()

QMI8658

  • Create an object:
qmi8658=QMI8658()
  • Read and parse XYZ data from sensors:
xyz=qmi8658.Read_XYZ()
Return Value:
          xyz[0]~xyz[2]: The function returns an array, where the first three elements represent the acceleration values on the X, Y and Z axes respectively.
	  xyz[3]~xyz[5]: These three elements represent the angular velocities in the X, Y and Z axes.

Resource

Waveshare Resource

Demo

Schematic

Datasheet

Official Resource

Official Raspberry Pi Documents

Raspberry Pi Demo

Development Software

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)