?? hal.c
字號:
#include "handsfree_private.h"
#include "handsfree.h"
#include <codec.h>
#include <message.h>
/* Scale the supplied gain to be within the specified range */
static uint16 scaleGainToRange(uint8 gain, uint16 max_range, uint16 max_gain)
{
return (((((gain * 10) * max_range)/max_gain) + 5)/10);
}
/*
hfHalSetSpeakerGain
Set the speaker volume.
*/
void hfHalSetSpeakerGain(uint8 vol)
{
uint16 scaled_val = 0;
/* Get the range supported by the codec */
uint16 range = CodecOutputGainRange() - 1;
/* If the range is zero don't bother setting anything */
if (!range)
return;
/* If the range is not zero scale the gain to be in that range */
scaled_val = scaleGainToRange(vol, range, 15);
/* Set the codec gain */
CodecSetOutputGain(scaled_val);
}
/*
hfHalSetMicrophoneGain
Set the microphone gain.
*/
void hfHalSetMicrophoneGain(uint8 gain)
{
uint16 scaled_val = 0;
/* Get the range supported by the codec */
uint16 range = CodecInputGainRange() - 1;
/* If the range is zero don't bother setting anything */
if (!range)
return;
/* If the range is not zero scale the gain to be in that range */
scaled_val = scaleGainToRange(gain, range, 15);
/* Set the codec gain */
CodecSetInputGain(scaled_val);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -