gA0nvWI

【LiChuang Development Board】Miao game console based on Liangshan School_

 
Overview

# 1. Project Description
## 1. IntroductionI
made a small game console. The initial idea was to make it the same size as the Liangshan Sect, but it was different in that it was in a vertical version so that it could be held in one hand. I thought it would be more interesting to write my own games, but in the end I only completed a simple number guessing game and a snake game.
## 2. Function Introduction
### 2.1 System Composition
Purpose|Specific Parameters--
|--Screen
|1.69-inch ST7789
Button|Directional Keys, Function Keys, Home Key
Sound|Speaker 8Ω3w
Vibration|Vibration Motor PWM Driver
Battery|1000mAh
Charging|tp4065 typec

### 2.2 IO Allocation Planning
Function|Remarks|IO Port--
|--|--Directional
Key|Up|PD3
Directional Key|Down|PC8
Directional Key|Left|PA14
Directional Key|Right|PA10
Function Key|Home Key|PC12
Function Key|A Key|PC9
Function Key|B Key|PD0
Display Screen|DC Selection|PA6
Display Screen|CS Selection|PA4
Display Screen|SCK Clock Line|PF7 Display Screen
|MOI Data Line|PF9
eeprom|IIC_SDA|PB7
eeprom|IIC_SCL|PB6
QMA7981|IIC_SDA|PB7
QMA7981|IIC_SCL|PB6
Speaker output|IIC_SCL|PB7
Battery power|IIC_SCL|PB6

## 3 Schematic diagram description
is mainly based on the official reference schematic diagram, mainly talking about the additional additions.
### 3.1 Charging circuit
![QQ screenshot 20230521195603.png] The charging uses tp4065, CHRG is the charging indicator, and R9 is the charging current.

### 3.2 Charging switching circuit
![QQ screenshot 20230521195617.png] I think this circuit is very interesting. I tried it. In short, it uses the mos tube to
use the battery power supply when the USB is not inserted, and
the USB is powered when the USB is inserted. At the same time, the USB can also charge the battery.

### 3.3 Gyroscope circuit
![QQ screenshot 20230521195552.png] An additional gyroscope is added, a domestic chip, which has been used in the previous stm32 project.
But GD32 has not been adjusted yet. At that time, I wanted to make a gravity-sensing snake. QAQ

## 4 Actual picture
![QQ图片20230521200152.jpg] ![QQ图片20230521200147.jpg] ![QQ图片20230521200140.jpg]
## 5 PCB design description
I'll just put the picture, mainly the copper of the audio signal was processed, and nothing else seems to be done.
![QQ screenshot 20230521200307.png] ![QQ screenshot 20230521200314.png] ![QQ screenshot 20230521200345.png] ![QQ screenshot 20230521200331.png]
## 6 Key program description
Introduce some interesting problems encountered in the design process
![QQ screenshot 20230521200602.png] ### 6.1 Random number
First of all, both the greedy snake and the guessing number need to obtain a random number. Two ways of generating random numbers are found. This design uses the GD32 hardware method.
![image.png] One is to enable the hardware generator.
The other obtains the corresponding random number. A 32-bit random number can be obtained.
However, in actual use, a random integer with a specified upper and lower limit is required, and it is basically between 0-255, that is, uint8_t;
![QQ screenshot 20230521200735.png] This method was adopted, and the actual test met the requirements.

## 6.2 Key timing scan
is mainly to achieve timing scan for any key and identify the long press and short press of the key.
![QQ screenshot 20230521201030.png] ![QQ screenshot 20230521201012.png] ![QQ screenshot 20230521201019.png] The effect achieved:
![QQ screenshot 20230521201213.png]
# 7 Assembly instructions
Please be gentle when inserting. I accidentally inserted the needle crooked before. Fortunately, I bought some more Liangshan School. It can be used as a consumable, (tears)
! [QQ Picture 20230521201449.jpg]
# 8 The video description
shows the current progress. The snake has been written with the head and tail of the snake, and the food position is randomly generated, but the corresponding program for gravity sensing has not been written.
Guessing numbers is a game I played at my grandma's house when I was a child. I often played it for an afternoon. It is basically to generate a random non-repeating four-digit number, and use four numbers to guess. If the number is correct and the position is correct, then A+1, if the number is correct but the position is wrong, then B+1; guess the four-digit number in the shortest number of times.
For example:
if the number is 1234 and the guess is 1235, the corresponding output is 3A0B.
For example, if the number is 1234 and the guess is 4321, the corresponding output is 0A4B
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-27 19:49:00

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号