www.pudn.com > headset.rar > microphone.c
#include "demohs.h" #include "hal.h" #include#include /* 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); }