📄 av_headset_led.c
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004
FILE NAME
headset_led.c
DESCRIPTION
Control of board LEDs depending on the current state
NOTES
*/
/****************************************************************************
Header files
*/
#include "av_headset_private.h"
#include "av_headset_led.h"
#include <pio.h>
#include <message.h>
#define LED_PAIRING_TIME_ON 250
#define LED_STREAMING_TIME_ON 500
#define LED_IDLE_ON 100
#define LED_PAIRING_TIME_OFF 250
#define LED_STREAMING_TIME_OFF 1000
#define LED_IDLE_OFF 1000
/*
Function call periodically to update the flashing
LED and set the next callback time
*/
static uint32 ledCallback(ledState state)
{
bool on = (PioGet() & LED?TRUE:FALSE);
if (on)
{
PioSet(LED,0);
if (state & led_pairing) /*lint !e655 */
return LED_PAIRING_TIME_OFF;
if (state & led_streaming) /*lint !e655 */
return LED_STREAMING_TIME_OFF;
return LED_IDLE_OFF;
}
else
{
PioSet(LED,LED);
if (state & led_pairing) /*lint !e655 */
return LED_PAIRING_TIME_ON;
if (state & led_streaming) /*lint !e655 */
return LED_STREAMING_TIME_ON;
return LED_IDLE_ON;
}
}
/*
Start the LED flashing
*/
void startLED(ledState state)
{
PioSetDir(LED,LED);
PioSet(LED,0);
/* call timer function ASAP */
MessageSendLater(getAppTask(), LED_UPDATE_REQUIRED, 0, ledCallback(state));
}
/*
Force LED to pick up state change immediately.
*/
ledState updateLED(const avTaskData *app, ledState state)
{
ledState s = state;
if ((app->a2dp_state == avHeadsetA2dpStreaming))
s |= led_streaming; /*lint !e655 */
MessageSendLater(getAppTask(), LED_UPDATE_REQUIRED, 0, ledCallback(s));
return s;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -