Added BK1080_SetFrequency.

This commit is contained in:
Dual Tachyon 2023-08-12 21:20:55 +01:00
parent ea3d795697
commit 511a2351dc
2 changed files with 11 additions and 3 deletions

View File

@ -36,7 +36,7 @@ static const uint16_t BK1080_RegisterTable[] = {
static bool gIsInitBK1080;
void BK1080_Init(uint16_t Channel, bool bDoScan)
void BK1080_Init(uint16_t Frequency, bool bDoScan)
{
uint8_t i;
@ -56,9 +56,9 @@ void BK1080_Init(uint16_t Channel, bool bDoScan)
BK1080_WriteRegister(BK1080_REG_02_POWER_CONFIGURATION, 0x0201);
}
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A5F);
BK1080_WriteRegister(BK1080_REG_03_CHANNEL, Channel - 760);
BK1080_WriteRegister(BK1080_REG_03_CHANNEL, Frequency - 760);
SYSTEM_DelayMs(10);
BK1080_WriteRegister(BK1080_REG_03_CHANNEL, (Channel - 760) | 0x8000);
BK1080_WriteRegister(BK1080_REG_03_CHANNEL, (Frequency - 760) | 0x8000);
} else {
BK1080_WriteRegister(BK1080_REG_02_POWER_CONFIGURATION, 0x0241);
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BK1080);
@ -83,3 +83,10 @@ void BK1080_Mute(bool Mute)
}
}
void BK1080_SetFrequency(uint16_t Frequency)
{
BK1080_WriteRegister(BK1080_REG_03_CHANNEL, Frequency - 760);
SYSTEM_DelayMs(10);
BK1080_WriteRegister(BK1080_REG_03_CHANNEL, (Frequency - 760) | 0x8000);
}

View File

@ -24,6 +24,7 @@
void BK1080_Init(uint16_t Frequency, bool bDoScan);
void BK1080_WriteRegister(BK1080_REGISTER_t Register, uint16_t Value);
void BK1080_Mute(bool Mute);
void BK1080_SetFrequency(uint16_t Frequency);
#endif