1 4683 code Base Schema
Qin Ji Chen Jieming technology
import pxp
_reporter
routines
The directory structure of the SDK must be noted , the following is my SDK directory structure, can refer to
Automatically generated when you create a work space. Metadata to be in the same directory as the SDK and the SDK path is best not to include spaces
Open Studio, click the File button in the upper-left corner and select Import from the drop-down menu
Click Next and select the SDK file to download and unzip from the website at browser
Click OK, and then all the routines in the SDK will pop up, all selected by default. And we just need to import two of them.
The first is a routine. The second is script, which can be understood as compiling a dependent library, must be imported, or the compilation will error.
Select a good project and click Finish to complete the import of routines and script.
Broadcast Parameter Modification
Double-click Pxp_reporter to see the code structure of this routine.
Device Name
By seeing the default pairing name, the user can modify it to suit their needs.
M
AC
address
For the broadcast interval and Bluetooth MAC address settings and acquisition, you can find the relevant interface in GAP.C.
ble_error_t Ble_gap_adv_intv_set (uint16_t adv_intv_min, uint16_t Adv_intv_max)
ble_error_t ble_gap_address_set (const own_address_t *address, uint16_t Renew_dur)
More interfaces and instructions can be studied gap.c this file.
Service Registration
In the Pxp_reporter_task function, you can find some interface calls that are initialized by the Bluetooth parameters
Above is the registration of the default service
broadcast interval and parameters
The calling interface allows you to modify the broadcast interval and broadcast parameters.
System Clock Modification
In Main.c's System_int function, the first one is to set the master clock, the second and third is the peripheral clock set divider.
The system clock can be set to a maximum of 96M, the higher the clock frequency, the greater the power consumption, please select the appropriate clock frequency for your project.
Add serial printing
The serial printing routines are good, but some routines do not open the relevant macro definitions, and pins are not configured. So we just need to open the relevant macro definition and then configure the pin again.
Add a macro definition in custom_config_qspi.h: #define Config_retarget and then we open MAIN.C to find the following function:
You can see that the default print port for the routine has been configured, using the two ports of P1_3 and P2_3 as the print port. If you are using a different routine, you may not necessarily have a pin configuration for serial printing by default for each routine, and you can check it yourself.
When a user needs to print data or a string in a program, only the printf function needs to be called, and the usage is the same as the standard C language, so be careful to include "stdio.h".
Note: Some routines are configured with UART1, and some routines are configured with UART2 to find the following file locations to view
The serial port print baud rate and other parameters are also set here.
The above settings are OK. After we open the PXP_REPORTER_TASK.C, we add the printed code to the following location
This time we download the code to the board, reset, mobile app search "Dialog PX Reporter", connect the serial print Assistant will appear we added printing:
14683 Development: Code Architecture