This post was last edited by xiyue521 on 2021-7-19 01:36
1. Console and custom commands:
In the HelloWorld process , I found that I can get the commands that can be typed by typing help in the serial assistant :
Includes system commands and user commands
However, when I was doing the LED experiment, there was no response when I typed help . However, this console is indeed more convenient for debugging, and it also allows you to view the system status, so I compared the similarities and differences between the two projects.
After entering the main function, yoc is initialized first, which initializes the RX, TX pins and functions, then sets the baud rate and LOG printing level, and finally the key cli initialization, which is the initialization of the console. In the cli initialization, aos_cli_init is the system commands seen earlier , and cli_reg_cmd_ps and cli_reg_cmd_free() are user commands .
After adding these codes, compile and burn them and you can use the console commands!!
Can we define our own commands?
Following the ps and free commands, the ps command initialization function is as follows:
cli_command is a command structure with three member variables, namely the name, the specific description of the command, and the callback function.
We can customize a command and name it test : Then write the callback function: (Here argc is the number of input parameters, we print out all the input parameters for testing), and finally call the registration command function to pass in the custom command structure:
Type help in the compile and burn console and you can see that test appears in the user command:
Then enter the test command with parameters, and you can see that the result is consistent with the expected result (note that here we get a string, we can use strcmp or atoi to convert the numeric string into int form to further judge and then implement the business logic function we want):
2. About CDK:
CDK supports 4 themes and can also format code:
We can right-click the project to configure some parameters: including some output files, as well as the optimization level. The flash download settings are very similar to the KEIL settings:
We can also use the serial port assistant that comes with CDK: it’s just not very convenient when interacting.
You can also click ctrl and then click the function you want to view to jump to it, and it is very convenient to zoom in and out with the scroll wheel.
|