microphone.c
来自「蓝牙耳机软件源代码」· C语言 代码 · 共 68 行
C
68 行
#include "demohs.h"
#include "hal.h"
#include <message.h>
#include <framework.h>
/*
sendMicGainReq
Send a message requesting the lib to send a microphone gain
AT request.
*/
static void sendMicGainReq(int8 increment, uint8 gain)
{
MAKE_MSG(HS_MIC_REQ);
msg->increment = increment;
msg->gain = gain;
putMsg(msg);
}
/*
sendInitialMicGain
Sends the initial mic gain of the headset on connection
establishment. See demohs.h for default values.
*/
void sendInitialMicGain(void)
{
sendMicGainReq(VG_ZERO_INCREMENT, VG_ZERO_GAIN);
}
/*
onMicGainUp
Request to increment the current gain value.
*/
void onMicGainUp(void)
{
sendMicGainReq(VG_VOLUME_UP, VG_ZERO_GAIN);
}
/*
onMicGainDown
Request to decrement the current mic gain value.
*/
void onMicGainDown(void)
{
sendMicGainReq(VG_VOLUME_DOWN, VG_ZERO_GAIN);
}
/*
microphoneGainInd
Called by the headsetframework whenever a VGM is received. This
may be as a result of us sending a HS_MIC_REQ from the app.
*/
void microphoneGainInd(const HS_MIC_IND_T * ind)
{
HALsetMicrophone(ind->gain);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?