Using GDK3 to develop magic keyboard experience
-
- foreword
- 1. Development goals
- 2. Development process
-
-
- 1. Introduce the source code of the gekm project, which we develop on the basis of the gekm project.
- 2. Test the original gekm project. Only when the function and logic of the original project are correct can we develop new projects based on it.
- 3. After the test is completed, we can develop the Magic Keyboard project on the basis of the original project.
-
- 3. Summary
foreword
GDK3 (GEDU Development Kit 3) is a development board designed by Gedu Technology based on ARM Cortex-M3 SoC, and the CPU framework is ARMv7-M. With the company's other related software and hardware tools, we can use it to learn ARM and embedded products. The product is small in size, low in power consumption, and very powerful in function.
1. Development goals
GDK3 is developed as a special keyboard device that automatically sends keyboard events. At this time, from the user's point of view: the computer's keyboard can type by itself like magic, which is very fun and interesting.
Connection Diagram
work process
Normally, the keyboard should be sent from the upper computer to the lower computer, but here we modify the program running in GDK3 to directly let GDK3 send keyboard events independently, without using the upper computer, and receive and test on the lower computer
2. Development process
1. Introduce the source code of the gekm project, which we develop on the basis of the gekm project.
2. Test the original gekm project. Only when the function and logic of the original project are correct can we develop new projects based on it.
a. Open the GNU tool to compile
b. Introduce the path of compiling and debugging tools such as gcc gdb:
export PATH=/d/gedu_work/GNU/bin/:$PATH
c. Switch to the working directory where the project is located:
cd /d/gedu_work/gdk3/sdk/src/gekm/
d. Start compiling
make -s
e. Burn and run
!program D:\\gedu_work\\gdk3\\sdk\\src\\gekm\\gekm.hex
!reset
f. Check whether GDK3 can be recognized and
opened as a usb device The usbview software is used to observe the host connected to the USB port of GKD3. (usbview is a usb device viewer, which can enumerate all USB devices in the system and view the detailed information of each device).
g. At this point, the test is completed, and the original gekm project is normal.
3. After the test is completed, we can develop the Magic Keyboard project on the basis of the original project.
a. Write your own keyboard sending function, and call this sending function in the main function.
void KB_Send_Data(void)
{
// 测试发送 gedu
uint8_t KB_Data[8] = {
0, 0, KC_G, KC_E, KC_D, KC_U, 0, 0};
uint8_t KB_Empty[8] = {
0};
// 开始发送数据
Delay_Ms(700);
USBHD_Endp_DataUp(DEF_UEP1, KB_Data, sizeof(KB_Data), DEF_UEP_CPY_LOAD);
Delay_Ms(700);
USBHD_Endp_DataUp(DEF_UEP1, KB_Empty, sizeof(KB_Empty), DEF_UEP_CPY_LOAD);
Delay_Ms(700);
}
b. Recompile the program
make -s
c. Burn the program and restart
!program D:\\gedu_work\\gdk3\\sdk\\src\\gekm\\gekm.hex
!reset
d. Open the text editor to observe the results of the project
. Seeing the above results means that the development of the magic keyboard is successful. And this magic keyboard not only supports sending a single letter, but also supports sending shift Ctrl Alt, etc. We can use this feature to develop more interesting projects, such as sending a combo in a game, or sending some meaningful text.
3. Summary
Since my own professional knowledge is not solid enough, and I also lack embedded development experience, when I first started this project, I always thought about tracing the source, thinking about understanding it first, clarifying my thoughts before doing it, so that's it, silly After watching for a long time, there was no substantial progress. Teacher Zhang pointed out: If you have any ideas and ideas, try it out. Don’t dream here. Whether the idea can be realized can only be verified by doing it. If you dream here, there will be no results. . So every time I come across an idea, I test it and record it. In the process of this verification, my understanding of this project has gradually deepened, and at the same time, I also understand that hands-on practice is far more realistic than brain fantasy.
Finally, put a photo of your little friend, come on, boy.