lights.c
来自「蓝牙SPP软件源代码」· C语言 代码 · 共 50 行
C
50 行
/*
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 + =
减小字号Ctrl + -
显示快捷键?