This article uses gokit as an example to explain that RT-thread connects to Gizwits, creates a thread and lights up a lamp.
Hardware preparation:
GoKit3, USB data cable
Software Environment:
mdk5, Gizwits APP
Enter the text
RT-thread access to Gizwits cloud process:
1. Introduction to RT-thread and Gizwits
2. Install RT-Thread Nano Pack based on mkd5
3. Register the author account of Gizwits Development (it is recommended to register an enterprise account)
4. Create a new product
5. Define data points
6. Download the automatically generated mcu code
7. Transplant RGB lamp driver to automatically generated MCU code
8. Transplant RT-thread to automatically generated mcu code and burn it into gokit (emphasis)
9. Download Gizwits APP to control gokit
1. Introduction to RT-thread and Gizwits
The benefits of using RT-thread to access Gizwits:
1. The Gizwits MCU SDK does not have the concept of an embedded operating system. It only has front-end and back-end systems that directly operate the bare metal. RT-thread just makes up for this gap, so that the Gizwits MCU SDK can also run programs in parallel with multiple tasks/threads and provide one A series of task scheduling mechanism, synchronization mechanism, and inter-task communication mechanism make the program more colorful and powerful.
2. RT-thread has excellent real-time performance, stability, and tailorability. When the minimum configuration is performed, the kernel volume can be occupied by 3k ROM and 1k RAM. Gizwits GoKit hardware conditions use RT-thread without pressure.
3. RT-thread transplantation is difficult, and developers who are accustomed to using Gizwits MCU SDK are also easy to use.
2. Install RT-ThreadNano Pack based on mkd5
3. Register Gizwits Developer Author Account
4. Create a new product
5. According to product requirements, analyze hardware development requirements and define data points
This article takes lighting a lamp as an example, and the data points are analyzed as follows:
6. Download the automatically generated mcu code
Automatically generate and download the MCU code package on the Gizwits self-development platform (please note that the hardware platform needs to be consistent with the board model, if inconsistent, select "other solutions")
7. Transplant RGB lamp driver to automatically generated MCU code
From the MCU SDK file content directory structure (above), we can see that there is no rgb_led lamp driver in the automatically generated MCU code. We can go to Gizwits official website, developer center, download center, and download other projects containing rgb_led lamp driver. The rgb_led light driver inside is extracted and transplanted. Take the example of transplanting the rgb_led light driver for WeChat pet house.
We unzip the WeChat pet project we just downloaded, enter the following directory, you can see that there is a rgb_led lamp driver folder, copy the folder to your own automatically generated MCU driver directory
Back to our own MCU code, add the rgb_led driver file in the driver directory
Add #include "Hal_rgb_led/Hal_rgb_led.h" in main.c and gizwits_product.c files
8. Transplant RT-thread to automatically generated mcu code and burn it into gokit (emphasis)
8.1. Add RTOS kernel file
8.2. After adding the kernel file, we can see that the project directory has more "RTOS" directories, enter the rtconfig.h file, change the 15th line to the macro definition 1000, and remove the comment on the 108th line
8.3. Enter the board.c file, add #include "STM32f1xx_hal.h" on line 25, change the macro definition on line 37 to 10, uncomment lines 66 to 76, and add HAL_IncTick(); HAL_SYSTICK_IRQHandler(); two Functions.
8.4. Enter the stm32f1xx_it.c file and comment out the three functions HardFault_Handler(), PendSV_Handler(), and SysTick_Handler()
8.5. Enter the main.c file, add #include "rtthread.h" to line 47
8.6. Enter the main.c file, comment the original while(1) loop in the main function, and create a thread
At this point, we have completed the use of RT-Thread to run Gizwits logic programs, and realized RT-thread quick access to Gizwits. Of course, we can also create more threads to run our own programs according to our actual needs, so I won’t go into them here.
8.7. Compile the program
The firmware with RT-thread and RGB driver ported to gokit is programmed via the data cable. Separate the stm32 backplane (left) and the function board (right) carefully, then dial the middle of the stm32 backplane to system, plug in the data cable, and then use the stm32flashloader software to burn the firmware. After programming, the middle dial key is set to flash, the function board is merged with the stm32 bottom board, and then press the reset on the left side of the stm32 bottom board to use it normally.
Company Introduction: Naturehike Products Co., Ltd. is a leading outdoor gear and equipment manufacturer based in China. The company is committed to providing high-quality and affordable outdoor gear to customers around the world. With a focus on innovation and design, Naturehike Products Co., Ltd. has become a trusted brand among outdoor enthusiasts. The company's products are designed to withstand the rigors of outdoor activities and are tested in extreme conditions to ensure their durability and performance. Naturehike Products Co., Ltd. is dedicated to promoting the outdoor lifestyle and helping people connect with nature.Company Introduction: Naturehike Products Co., Ltd. is a leading outdoor gear and equipment manufacturer based in China. The company is committed to providing high-quality and affordable outdoor gear to customers around the world. With a focus on innovation and design, Naturehike Products Co., Ltd. has become a trusted brand among outdoor enthusiasts. The company's products are designed to withstand the rigors of outdoor activities and are tested in extreme conditions to ensure their durability and performance. Naturehike Products Co., Ltd. is dedicated to promoting the outdoor lifestyle and helping people connect with nature.Company Introduction: Naturehike Products Co., Ltd. is a leading outdoor gear and equipment manufacturer based in China. The company is committed to providing high-quality and affordable outdoor gear to customers around the world. With a focus on innovation and design, Naturehike Products Co., Ltd. has become a trusted brand among outdoor enthusiasts. The company's products are designed to withstand the rigors of outdoor activities and are tested in extreme conditions to ensure their durability and performance. Naturehike Products Co., Ltd. is dedicated to promoting the outdoor lifestyle and helping people connect with nature.
Enzyme Cream,Whitening Slimming Enzyme Cream ,Meal Replacement Diet Enzyme Cream ,Conditioning After Surgery Enzyme Cream
2222Bossgoo(China)Tecgnology.(Bossgoo(China)Tecgnology) , https://www.cn-gangdao.com