# 1. Introduction
The Longquan game console is developed based on the Lichuang Liangshanpai development board. With reference to the design ideas of the Lichuang Liangshanpai game console expansion board, it adopts a high-definition rounded 1.69-inch IPS screen to make the display colorful and clear. The patch 3610 vibration motor on the back of the joystick makes the operation feel full. The 360-degree joystick and four buttons with an Xbox-like layout are simple and easy to use. The Jiali Chuang purple color scheme is exquisite and elegant.
# 2. Hardware structure
## 1. Display screen
The display screen is an essential external device for most embedded development. Compared with other digital tubes/LEDs, it can display richer content (text, pictures, lines, etc.). Common display screens are divided into monochrome and color screens in terms of color. The interface can be divided into parallel port, RGB, SPI, IIC, MIPI and other interfaces. The screen material can also be divided into OLED screen, TFT screen, ink screen. The display size can be divided into 0.96 inches, 2.4 inches, 7 inches, etc. The screen of the game console expansion board uses a 1.69-inch IPS high-definition rounded corner screen with 240*280 pixels and SPI communication. Because the unit pixel density of this screen is higher (total pixels/size), the display quality is finer, and the control IO is less, and the peripheral circuit is relatively simple.
![screen.jpg]

Because the screen has high pixels and rich colors, the amount of data displayed is very large. Simply using IO to simulate SPI display is very slow. Hardware SPI is needed for data transmission to improve communication efficiency.
![screen circuit.png]

During development, the fonts or images that need to be displayed can be displayed after being modulo array data.
## 2. Joystick
The joystick is a control stick element that can be moved left and right, up and down. In fact, it is mainly a sliding rheostat inside. According to the different rotation/displacement, the relative position of the sliding rheostat changes, and the resistance value also changes accordingly. The voltage divider value of the current position is collected by ADC to estimate the control amount of rotation/displacement.
![joystick circuit.png]

## 3.Vibration motor
Vibration motors are widely used in many electronic products and can provide a very good user experience, such as mobile phone vibration, watch bracelet vibration, game handle vibration, etc. Since this development is a game console, vibration is even more indispensable.
The game console uses the patch 3610 vibration motor, which is small in size and has a strong vibration.
![vibration motor.png]

![vibration motor circuit.png]

Use PWM to control the motor during development to achieve vibrations of different intensities.
## 4.EEPROM
The EEPROM chip is used to record data when power is off, and the stored data will not be lost when the game console is powered off and shut down. The chip used in the game console communicates and controls through I2C, and only two IO pins need to be connected.
![EEPROM circuit.png]

Hardware I2C is selected for EEPROM control, which has simple configuration and fast communication speed.
# 3. Software development
UI design and NES transplantation are the key and difficulty of game console software development. NES game is a game that runs on a red and white machine with a CPU of 6502 chip from Nintendo. If you want to use NES games in other environments, you need a corresponding NES game emulator. The open source NES emulators for microcontrollers on the Internet mainly include: info nes (Longyuan) stm32 nes (ye781205), stm32 nes (Zhengdian Atom). Zhengdian Atom's nes is optimized based on the ye781205 open source. I transplanted the nes emulator of Zhengdian Atom.
![lqgame.png]