csr8670--button按键的实现

本文详细介绍了CSR8670蓝牙设备中RSSI查询的应用,包括两种扫描模式,并深入讲解了speaker中button的处理流程,从app_handler开始,经过一系列函数调用,如handleHFPMessage、InitEarlyUserFeatures,直至按键初始化。同时,文章还预告了将要分析的configManager相关函数,强调理解按键功能需结合sink configuration的使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.RSSI 查询

1.1基于RSSI的应用sink应用程序支持RSSI查询扫描模式有两种
  • 应用程序能够查询临近的可发现蓝牙设备,当查询完毕(查到最大个数或者查询时间到),会将查询到的设备按照信号强度进行排列
  • 接近配对:只尝试1次或者全部尝试连接
  • 接近自动连接:This feature is designed to improve reconnection times when there are a lot of entries in the Audio Sink application’s PDL.

2.speaker中的button流程

app_handler –> handleHFPMessage –> HFP_INIT_CFM –> InitEarlyUserFeatures –> buttonManagerInit –> ButtonsInit –> ButtonsMessageHandler –> MESSAGE_PIO_CHANGED –> ButtonsCheckDetection
由前面分析HFP的过程可以知道,当HFP_INIT_CFM 这个初始化确认消息过来之后,会进行InitEarlyUserFeatures 这个函数,这里便对按键进行了初始化我们往下看

  • 1.InitEarlyUserFeatures函数
void InitEarlyUserFeatures ( void ) 
{   
    ChargerConfigure(CHARGER_SUPPRESS_LED0, TRUE);


    /* Initialise the Button Manager */
    buttonManagerInit() ;  /*这里对按键初始化1.*/

    /* Once system Managers are initialised, load up the configuration */
    configManagerInit(TRUE);  /*这里对按键的配置进行读取4.*/ 

    /* Init wired before USB or wired audio gets routed before init */
    wiredAudioInit(); 

    /* USB init can be done once power lib initialised */
    usbInit();

    /* initialise the display */
    displayInit();

    /* initialise DUT */
    dutInit();

    /*configure the audio Pre amp if enabled */
    initPreAmp( AUDIO_CHANNEL_A) ;
    initPreAmp( AUDIO_CHANNEL_B) ;


    /* Enter the limbo state as we may be ON due to a charger being plugged in */
    stateManagerEnterLimboState();    
}   
  • 2.buttonManagerInit按键初始化函数
void buttonManagerInit ( void ) 
{       
            /*put the buttons task and the button patterens in a single memory block*/
    int lSize = sizeof(ButtonsTaskData) ; 

    /*allocate the memory*/
    theSink.theButtonsTask = mallocPanic( lSize );/*开辟了按键任务的空间*/
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值