avatar

松果工作室

欢迎光临

  • 首页
  • freeRTOS
  • LVGL
  • ESP
  • 开发手册
  • 快速笔记
  • 个人收藏
  • 时事记录
  • 考察日志
  • 工具
Home CH573(三) 代码结构
文章

CH573(三) 代码结构

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

CH573(二) 蓝牙

NEWER

结构体创建的 3 种方式

Recently Updated

  • ESP32(十) BLE OTA
  • ESP32(九) BLE GATTS
  • LVGL(四) 动画
  • LVGL(三) 对象中创建对象
  • LVGL(二) 定时回调

Trending Tags

LVGL WCH Linux Elec freeRTOS STM ESP Flutter Others SwiftUI

Contents

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

Using the Halo theme Chirpy