⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lights.c

📁 蓝牙SPP软件源代码
💻 C
字号:
/* 
   LED logic shared between spp_master and spp_slave
*/

#include "lights.h"
#include "config.h"

#include <timer.h>
#include <pio.h>

/* Delay for flashing the connect LED */

static Delay period = D_NEVER;

static Delay flash_connect(TimerHandle h)
{
    h=h;
    PioSet(LED_CONNECT, ~PioGet()); /* Toggle connect LED */
    return period;
}

static void setup_flash(Delay d)
{
    period = d;
    TimerCancelCallback(flash_connect);
    (void) TimerAdd(D_IMMEDIATE, flash_connect);
}

void lights_pairing(void)
{ setup_flash(D_mSEC(100)); }

void lights_discoverable(void)
{ setup_flash(D_mSEC(300)); }

void lights_inquiring()
{ setup_flash(D_mSEC(900)); }

void lights_connecting()
{ setup_flash(D_mSEC(1200)); }

void lights_connected(void)
{
    TimerCancelCallback(flash_connect);
#ifdef CSR_APPLICATION_HARDWARE
    PioSet(LED_CONNECT, 0);
#else
    PioSet(LED_CONNECT, ~0);
#endif
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -