avatar

松果工作室

欢迎光临

  • 首页
  • ESP
  • LVGL
  • freeRTOS
  • 快速笔记
  • 考察日志
  • 个人收藏
  • 我的服务
Home (WCH)代码结构
文章

(WCH)代码结构

Posted 2024-06-2 Updated 2024-06- 2
By YCP
4~5 min read

概览

#include "config.h"
#include "HAL.h"
#include "gattprofile.h"
#include "peripheral.h"

__attribute__((aligned(4))) uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4]; //数组对齐

__attribute__((section(".highcode")))   //Main_Circulation 函数将被放置在 .highcode 内存段中
__attribute__((noinline))               //Main_Circulation 函数在主函数中将不被替换为函数体本身(内联)
void Main_Circulation() {
    while (1) {
        TMOS_SystemProcess();
    }
}

int main(void) {
    PWR_DCDCCfg(ENABLE);
    SetSysClock(CLK_SOURCE_PLL_60MHz);
    GPIOA_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
    GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);

    CH57X_BLEInit();//初始化 BLE 内存,时钟,发射功率等物理层
    HAL_Init();//初始化按键 LED,创建任务,初始化系统时钟,睡眠唤醒等
    GAPRole_PeripheralInit();//Peripheral的基础配置初始化
    Peripheral_Init();//Peripheral的额外配置初始化,广播间隙、配对码、配对模式等.GATT回调,广播回调
    Main_Circulation();//调度器
}

WCH
License:  CC BY 4.0
Share

Further Reading

OLDER

(LIB)结构体创建的 3 种方式

NEWER

(WCH)蓝牙

Recently Updated

  • (ESP-IDF)LVGL 模拟器
  • (ESP-IDF)LVGL 自定义对象加入编码器组
  • (ESP-IDF)vscode配置文件
  • (Elec)来复再生式晶体管单管收音机
  • (ESP-IDF)ESPNOW

Trending Tags

LVGL WCH Linux Elec ThatProject freeRTOS STM ESP Flutter Others

Contents

©2026 松果工作室. Some rights reserved.

Using the Halo theme Chirpy