Skip to content

Commit

Permalink
Added remaining known BK1080 features.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dual Tachyon authored and Dual Tachyon committed Aug 27, 2023
1 parent e8a0cd3 commit f5af8df
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions driver/bk1080.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "driver/gpio.h"
#include "driver/i2c.h"
#include "driver/system.h"
#include "misc.h"

#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))

Expand Down Expand Up @@ -102,3 +103,10 @@ void BK1080_SetFrequency(uint16_t Frequency)
BK1080_WriteRegister(BK1080_REG_03_CHANNEL, (Frequency - 760) | 0x8000);
}

void BK1080_GetFrequencyDeviation(uint16_t Frequency)
{
g_20000362 = Frequency;
// Doubts whether this register is signed or not
gFM_FrequencyDeviation = (int16_t)BK1080_ReadRegister(BK1080_REG_07) / 16;
}

1 change: 1 addition & 0 deletions driver/bk1080.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ uint16_t BK1080_ReadRegister(BK1080_Register_t Register);
void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value);
void BK1080_Mute(bool Mute);
void BK1080_SetFrequency(uint16_t Frequency);
void BK1080_GetFrequencyDeviation(uint16_t Frequency);

#endif

4 changes: 2 additions & 2 deletions misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ volatile bool gSystickFlag11;

volatile uint16_t ScanPauseDelayIn10msec;

// This probably should be signed! But Ghidra disgrees
uint16_t gFM_FrequencyDeviation;
// Doubts about whether this should be signed or not.
int16_t gFM_FrequencyDeviation;

uint16_t gCurrentRSSI;

Expand Down
2 changes: 1 addition & 1 deletion misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ extern volatile bool gSystickFlag11;

extern volatile uint16_t ScanPauseDelayIn10msec;

extern uint16_t gFM_FrequencyDeviation;
extern int16_t gFM_FrequencyDeviation;

extern uint16_t gCurrentRSSI;

Expand Down

0 comments on commit f5af8df

Please sign in to comment.