1.Introduction (简介)
This document describes the CSRmesh v2.1 on-chip application’s new design with the integration of the Connection Manager built using the µEnergy SDKs. It mainly captures the process for porting the CSRmesh v2.0 on-chip applications to the new design. The CSRmesh applications prior to the CSRmesh v2.1 release did not contain the common code for handling connection, core mesh stack, and model handlers resulting in duplication of a lot of code between applications nor had a structure which can have the capability to handle multiple connections to devices. The current changes move the CSRmesh connection, core mesh stack and model handling code to be reused across various applications and would make the integration much easier than the earlier versions. The integration of the Connection Manager paves the way for connection with multiple devices in future implementations. The document also describes the modifications in the application structure as well as required changes on various modules.
本文档介绍CSRmesh v2.1片上应用程序的新设计,其中集成了使用μEnergySDK构建的连接管理器。它主要捕获将CSRmesh v2.0片上应用程序移植到新设计的过程。 CSRmesh v2.1发行版之前的CSRmesh应用程序不包含用于处理连接,核心网格堆栈和模型处理程序的通用代码,导致应用程序之间复制大量代码,也没有可以处理多个代码的结构连接到设备。当前的变化使CSRmesh连接,核心网格堆栈和模型处理代码在各种应用程序中重复使用,并使集成比早期版本更容易。 Connection Manager的集成为未来实现中与多个设备的连接铺平了道路。该文件还描述了应用程序结构中的修改以及各种模块所需的更改。
2.New application design 新应用设计
2.1 Initialization
The application initialization has been split into the hardware initialization, mesh model initialization, services initialization and the mesh core stack initialization. The application starts the initialization sequence from the AppInit() function as mentioned below.
1. Initialization for the Timers required for the application.
2. Initialization of debug UART if debug is enabled.
3. Initialize the hardware peripherals (PIO, PWM, I2C etc.)
4. Read the user keys.
5. Initialize the NVM.
6. Initialize the Connection Manager.
应用程序的初始化已经被分解为硬件初始化,网格模型初始化,服务初始化和网状核心堆栈初始化。 应用程序从AppInit()函数开始初始化序列,如下所述。
1.初始化应用程序所需的定时器。
2.如果启用了调试,则初始化调试UART。
3.初始化硬件外设(PIO,PWM,I2C等)
4.阅读用户密钥。
5.初始化NVM。
6.初始化连接管理器。
The code snippet in Table 2-1shows Appinit() initialization.
Table 2-1 AppInit() initialization sequence of CSRmesh v2.1 Light application
表2-1中的代码片段显示了Appinit()初始化。
表2-1 CSRmesh v2.1 Light应用程序的AppInit()初始化顺序
After the completion of reading the user keys, the NVM is initialized. After the NVM initialization
the Connection Manager initialization is done.
When the Connection Manager is initialized it, sends a CM_INIT_CFM message to the application
which is handled in the connection_handler.c file.
When the application receives the confirmation that the Connection Manger is initialized, it:
1. Enables the raw advertisement reports to be sent from Connection Manager.
2. Initializes the GATT server services supported in the application.
3. Initializes the application data structure.
4. Initializes the application mesh handler.
See Table 2-2
连接管理器初始化完成。
Connection Manager初始化后,向应用程序发送CM_INIT_CFM消息
这是在connection_handler.c文件中处理的。
当应用程序收到连接管理器初始化的确认时,它:
1.启用从Connection Manager发送的原始广告报告。
2.初始化应用程序支持的GATT服务器服务。
3.初始化应用程序数据结构。
4.初始化应用程序网格处理程序。
见表2-2