PU2CLR BK108X Arduino Library  1.0.1
This is an Arduino Library to control the BK108X device
Union, Structure and Defined Data Types


More...

Classes

union  bk_reg00
 Device ID. More...
 
struct  bk_reg00.refined
 
union  bk_reg01
 Chip ID. More...
 
struct  bk_reg01.refined
 
union  bk_reg02
 Power Configuratio. More...
 
struct  bk_reg02.refined
 
union  bk_reg03
 Channe. More...
 
struct  bk_reg03.refined
 
union  bk_reg04
 Register 04h. System Configuration1 (0x1180) More...
 
struct  bk_reg04.refined
 
union  bk_reg05
 Register 05h. System Configuration2 (0x3ddf) More...
 
struct  bk_reg05.refined
 
union  bk_reg06
 Register 06h. System Configuration3 (0x01ef) More...
 
struct  bk_reg06.refined
 
union  bk_reg07
 Register 07h. Test1 (0x0900) More...
 
struct  bk_reg07.refined
 
union  bk_reg08
 Test 2. More...
 
struct  bk_reg08.refined
 
union  bk_reg09
 Register 09h. Status1 (0x0000) More...
 
struct  bk_reg09.refined
 
union  bk_reg0a
 Register 0Ah. Status2 (0x0000) More...
 
struct  bk_reg0a.refined
 
union  bk_reg0b
 Register 0Bh. Read Channel (0x0000) More...
 
struct  bk_reg0b.refined
 
union  bk_reg0c
 Register 0Ch. RDS1 (0x0000) More...
 
struct  bk_reg0c.refined
 
union  bk_reg0d
 Register 0Dh. RDS2 (0x0000) More...
 
struct  bk_reg0d.refined
 
union  bk_reg0e
 Register 0Eh. RDS2 (0x0000) More...
 
struct  bk_reg0e.refined
 
union  bk_reg0f
 Register 0Fh. RDS4 (0x0000) More...
 
struct  bk_reg0f.refined
 
union  bk_reg10
 Register 10h. Boot Configuration1 (0x7b11) More...
 
struct  bk_reg10.refined
 
union  bk_reg11
 Register 11h. Boot Configuration2 (0x0080) More...
 
struct  bk_reg11.refined
 
union  bk_reg12
 Register 12h. Boot Configuration3 (0x4000) More...
 
struct  bk_reg12.refined
 
union  bk_reg13
 Register 13h. Boot Configuration4 (0x3e00) More...
 
struct  bk_reg13.refined
 
union  bk_reg14
 Register 14h. Boot Configuration5 (0x0000) More...
 
struct  bk_reg14.refined
 
union  bk_reg15
 15h. Boot Configuration6 (0x0000) More...
 
struct  bk_reg15.refined
 
union  bk_reg16
 Register 16h. Boot Configuration7 (0x0400) More...
 
struct  bk_reg16.refined
 
union  bk_reg17
 Register 17h. Boot Configuration8 (0x0001) More...
 
struct  bk_reg17.refined
 
union  bk_reg18
 Register 18h. Boot Configuration9 (0x143c) More...
 
struct  bk_reg18.refined
 
union  bk_reg19
 Register 19h. Boot Configuration10 (0x4351) More...
 
struct  bk_reg19.refined
 
union  bk_reg1A
 Register 1Ah. Boot Configuration11 (0x0000) More...
 
struct  bk_reg1A.refined
 
union  bk_reg1B
 Register 1Bh. Analog Configuration1 (0x0000) More...
 
struct  bk_reg1B.refined
 
union  bk_reg1C
 Register 1Ch. Analog Configuration2 (0x0000) More...
 
struct  bk_reg1C.refined
 
union  bk_reg1D
 Register 1Dh. Analog Configuration2 (0x0000) More...
 
struct  bk_reg1D.refined
 
union  bk_rds_blockb
 RDS Block B data type. More...
 
struct  bk_rds_blockb.group0
 
struct  bk_rds_blockb.group2
 
struct  bk_rds_blockb.refined
 
union  bk_rds_date_time
 
struct  bk_rds_date_time.refined
 
union  word16_to_bytes
 Converts 16 bits word to two bytes. More...
 
struct  word16_to_bytes.refined
 
class  BK108X
 KT0915 Class. More...
 

Detailed Description


BK108X Defined Data Types

Defined Data Types is a way to represent the BK108X registers information

Some information appears to be inaccurate due to translation problems from Chinese to English.

The information shown here was extracted from Datasheet:

BK108X stereo FM digital tuning radio documentation.

Other information seems incomplete even in the original Chinese Datasheet.

For example: Reg 10 (0x0A). There is no information about it. The Reg11 and 12 seem wrong


Class Documentation

◆ bk_reg00

union bk_reg00

Device ID.

Definition at line 102 of file BK108X.h.

Class Members
struct bk_reg00 refined
uint16_t deviceId

◆ bk_reg00.refined

struct bk_reg00.refined

Definition at line 104 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg01

union bk_reg01

Chip ID.

Definition at line 117 of file BK108X.h.

Class Members
struct bk_reg01 refined
uint16_t chipId

◆ bk_reg01.refined

struct bk_reg01.refined

Definition at line 119 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg02

union bk_reg02

Power Configuratio.

See also
BEKEN - BK1086/88 - BROADCAST AM/FM/SW/LW RADIO RECEIVER; pages 13 and 14

Definition at line 132 of file BK108X.h.

Class Members
struct bk_reg02 refined
uint16_t raw

◆ bk_reg02.refined

struct bk_reg02.refined

Definition at line 134 of file BK108X.h.

Class Members
uint8_t ENABLE: 1 Powerup Enable;.
uint8_t SNR_REF: 5 Output SNR adjustment. Read SNR = SNR (calculated)
uint8_t DISABLE: 1 Powerup Disable;.
uint8_t SKAFCRL: 1 Seek with AFC Rail; 0 = During seeking, the channel is valid no matter whether AFCRL is high or low; 1 = During seeking, the channel is invalid if AFCRL is high.
uint8_t SEEK: 1 0 = Disable (default); 1 = Enable;
uint8_t SEEKUP: 1 Seek Direction; 0 = Seek down (default); 1 = Seek up.
uint8_t SKMODE: 1 Seek Mode; 0 = Wrap at the upper or lower band limit and continue seeking (default); 1 = Stop seeking at the upper or lower band limit.
uint8_t STEREO: 1 Stereo; 0 = Normal operation; 1 = Force stereo; MONO and STEREO cannot be set to 1 simultaneously.
uint8_t MONO: 1 Mono; 0 = Normal operation; 1 = Force mono.
uint8_t MUTER: 1 Mute R channel; 0 = R channel normal operation; 1 = R channel mute.
uint8_t MUTEL: 1 Mute L channel; 0 = L channel normal operation; 1 = L channel mute.
uint8_t DSMUTE: 1 Softmute Disable; 0 = Softmute enable (default); 1 = Softmute disable.

◆ bk_reg03

union bk_reg03

Channe.

The tuned Frequency = Band + CHAN * SPACE

See also
BEKEN - BK1086/88 - BROADCAST AM/FM/SW/LW RADIO RECEIVER; page 14

Definition at line 158 of file BK108X.h.

Class Members
struct bk_reg03 refined
uint16_t raw

◆ bk_reg03.refined

struct bk_reg03.refined

Definition at line 160 of file BK108X.h.

Class Members
uint16_t CHAN: 15 Channel Select; The tuned Frequency = Band + CHAN * SPACE.
uint16_t TUNE: 1 Tune. 0 = Disable (default); 1 = Enable.

◆ bk_reg04

union bk_reg04

Register 04h. System Configuration1 (0x1180)

When register GPIO2[1:0]=2’b01 and seek or tune finish, a 5ms low pulse will appear at GPIO2 .Both RDSIEN and STCIEN can be high;

When register GPIO2[1:0]=2’b01 and new RDS come, a 5ms low pulse will appear at GPIO2.

Definition at line 175 of file BK108X.h.

Class Members
struct bk_reg04 refined
uint16_t raw

◆ bk_reg04.refined

struct bk_reg04.refined

Definition at line 177 of file BK108X.h.

Class Members
uint8_t DUMMY: 2 Not used / RESERVED General Purpose I/O 1; 00 = High impedance (default); 01 = CLK38MHz; 10 = Low; 11 = High.
uint8_t GPIO2: 2 General Purpose I/O 2. 00 = High impedance (default); 01 = STC/RDS interrupt; 10 = Low; 11 = High.
uint8_t GPIO3: 2 General Purpose I/O 2. 00 = High impedance (default); 01 = Mono/Stereo indicator (ST); 10 = Low; 11 = High.
uint8_t PILOTS: 3 Stereo/Mono Blend Level Adjustment. Sets the RSSI range for stereo/mono blend. See table above.
uint8_t TCPILOT: 2 The Time Used to Cal The Strength of Pilot.
uint8_t DE: 1 De-emphasis; 0 = 75 μs. Used in USA (default); 1 = 50 μs. Used in Europe, Australia, Japan.
uint8_t RDSEN: 1 RDS Enable; 0 = Disable (default); 1 = Enable.
uint8_t AFCINV: 1 AFC Invert; 0 = Normal AFC into mixer; 1 = Reverse AFC into mixer.
uint8_t STCIEN: 1 Seek/Tune Complete Interrupt Enable; 0 = Disable Interrupt (default); 1 = Enable Interrupt. See details above.
uint8_t RDSIEN: 1 RDS Interrupt Enable; 0 = Disable Interrupt (default); 1 = Enable Interrupt. See details above.

◆ bk_reg05

union bk_reg05

Register 05h. System Configuration2 (0x3ddf)

LW and SW Band are only defined at BK1088

AM and Fm Band table ()

BAND value AM band KHz FM band MHz
0 00: LW 153~279 FULL 64~108
1 10: MW 520~1710 East Europe 64~76
2 10: SW 2.3~21.85 Japan 76~91
3 11: MW 522~1710 Europe 87~108

AM and FM Channel Space

BAND value AM Space KHz FM Space KHz
0 1 10
1 5 50
2 9 100
3 10 200
See also
bk_reg07

Definition at line 217 of file BK108X.h.

Class Members
struct bk_reg05 refined
uint16_t raw

◆ bk_reg05.refined

struct bk_reg05.refined

Definition at line 219 of file BK108X.h.

Class Members
uint8_t VOLUME: 5 0x00 is the lowest and 0x1F is highest (0dBFS). 2dB each
uint8_t SPACE: 2 Channel Spacing; See AM and FM Channel Space table above.
uint8_t BAND: 2 Band Select. See AM and Fm Band table above.
uint8_t SEEKTH: 7 RSSI Seek Threshold. 0x00 = min RSSI (default); 0x7F = max RSSI.

◆ bk_reg06

union bk_reg06

Register 06h. System Configuration3 (0x01ef)

SKCNT - Seek Impulse Detection Threshold Allowable number of impulse for a valid seek channel while setting all zeros means not use Impulse number to judge the channel’s validity.

SMUTEA table

Softmute Attenuation Description
0 16 dB (default)
1 14 dB
2 12 dB
3 10 dB

SMUTER table

Softmute Attack/Recover Rate Description
0 fastest (default)
1 fast
2 slow
3 slowest

Definition at line 254 of file BK108X.h.

Class Members
struct bk_reg06 refined
uint16_t raw

◆ bk_reg06.refined

struct bk_reg06.refined

Definition at line 256 of file BK108X.h.

Class Members
uint8_t SKCNT: 4 See details above.
uint8_t SKSNR: 7 Seek SNR Threshold. Required channel SNR for a valid seek channel.
uint8_t CLKSEL: 1 Clock Select. 0 = External clock input; 1= Internal oscillator input.
uint8_t SMUTEA: 2 Softmute Attenuation; See table above.
uint8_t SMUTER: 2 Softmute Attack/Recover Rate; See table above.

◆ bk_reg07

union bk_reg07

Register 07h. Test1 (0x0900)

Definition at line 271 of file BK108X.h.

Class Members
struct bk_reg07 refined
uint16_t raw

◆ bk_reg07.refined

struct bk_reg07.refined

Definition at line 273 of file BK108X.h.

Class Members
uint8_t FMGAIN: 3 The gain of Frequency demodulated; 000 = 0dB ... 011= +18dB; 100= 0dB ... 111= -18dB.
uint8_t RESERVED:3
uint8_t STHYS_SEL: 1 ST/MONO Transition Hysterisis Select. 0 = 6dB; 1=2dB.
uint8_t DACCK_SEL: 1 DAC Clock Select.
uint8_t IMPTH: 2 Threshold of Impulse Detect. 00 = toughest; 11 = loosest.
uint8_t BPDE: 1 De-emphasis Bypass; 0 = Normal operation; 1 = Bypass de-emphasis.
uint8_t IMPEN: 1 Impulse Remove Enable; 0 = Disable; 1 = Enable.
uint8_t SIQ: 1 IF I/Q Signal switch; 0 = Normal operation; 1 = Reversed I/Q signal.
uint8_t MODE: 1 0 = FM receiver; 1 = AM receiver
uint8_t LINEIN_EN: 1 Audio Line in Enable; 0 = Disable (Receiver Mode)
uint8_t LINEIN_SEL: 1 Audio Line in Channel Select; 0 = Channel 1; 1=Channel 2 ((QFN24 only support one line in channel))

◆ bk_reg08

union bk_reg08

Test 2.

RSSI Threshold for Instant AFC updating; AFC Average Range; Variation Threshold for average AFC calculation;

AFC Average; AFCRL Threshold; AFC/RSSI/SNR Calculate Rate; AFC Enable

Definition at line 297 of file BK108X.h.

Class Members
struct bk_reg08 refined
uint16_t raw

◆ bk_reg08.refined

struct bk_reg08.refined

Definition at line 299 of file BK108X.h.

Class Members
uint8_t AFCRSSIT: 7 RSSI Threshold for Instant AFC updating.
uint8_t RANGE: 2 AFC Average Range; 00 = the toughest; 11 = the loosest.
uint8_t VAR: 2 Variation Threshold for average AFC calculation; 00 = Disable; 01 = the toughest; 11 = the loosest.
uint8_t AVE: 1 AFC Average.
uint8_t SEL25K: 1 AFCRL Threshold; 0 = Channel space/2; 1 = 25kHz.
uint8_t TCSEL: 2 AFC/RSSI/SNR Calculate Rate; 00 = fastest; 11 = slowest. 4X times each.
uint8_t AFCEN: 1 AFC Enable; 0 = Disable; 1 = Enable.

◆ bk_reg09

union bk_reg09

Register 09h. Status1 (0x0000)

Definition at line 316 of file BK108X.h.

Class Members
struct bk_reg09 refined
uint16_t raw

◆ bk_reg09.refined

struct bk_reg09.refined

Definition at line 318 of file BK108X.h.

Class Members
uint16_t SNR:7 The AFC value.
uint16_t AFC:9 unit AM 0.15k Hz, FM 0.6k Hz

◆ bk_reg0a

union bk_reg0a

Register 0Ah. Status2 (0x0000)

Definition at line 330 of file BK108X.h.

Class Members
struct bk_reg0a refined
uint16_t raw

◆ bk_reg0a.refined

struct bk_reg0a.refined

Definition at line 332 of file BK108X.h.

Class Members
uint8_t RSSI: 7 RSSI (Received Signal Strength Indicator).
uint8_t ST: 1 Stereo Indicator; 0 = Mono; 1 = Stereo.
uint8_t STEN: 1 Impulse Number.
uint8_t DUMMY: 3
uint8_t AFCRL: 1 AFC Rail; 0 = AFC not railed; 1 = AFC railed.
uint8_t SF_BL: 1 Seek Fail/Band Limit; 0 = Seek successful; 1 = Seek failure/Band limit reached.
uint8_t STC: 1 Seek/Tune Complete; 0 = Not complete (default); 1 = Complete.
uint8_t RDSR: 1 RDS Ready; 0 = No RDS group ready (default); 1 = New RDS group ready. Keep high for 40ms after new RDS is received.

◆ bk_reg0b

union bk_reg0b

Register 0Bh. Read Channel (0x0000)

Definition at line 350 of file BK108X.h.

Class Members
struct bk_reg0b refined
uint16_t raw

◆ bk_reg0b.refined

struct bk_reg0b.refined

Definition at line 352 of file BK108X.h.

Class Members
uint16_t READCHAN: 14 Read Channel. Provides the current working channel.
uint16_t RESERVED: 2

◆ bk_reg0c

union bk_reg0c

Register 0Ch. RDS1 (0x0000)

RDS Block A - The First Register of RDS Received

Definition at line 365 of file BK108X.h.

Class Members
struct bk_reg0c refined
uint16_t raw

◆ bk_reg0c.refined

struct bk_reg0c.refined

Definition at line 367 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg0d

union bk_reg0d

Register 0Dh. RDS2 (0x0000)

RDS Block B - The second register of RDS received

Definition at line 380 of file BK108X.h.

Class Members
struct bk_reg0d refined
uint16_t raw

◆ bk_reg0d.refined

struct bk_reg0d.refined

Definition at line 382 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg0e

union bk_reg0e

Register 0Eh. RDS2 (0x0000)

RDS Block C - The third register of RDS received

Definition at line 395 of file BK108X.h.

Class Members
struct bk_reg0e refined
uint16_t raw

◆ bk_reg0e.refined

struct bk_reg0e.refined

Definition at line 397 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg0f

union bk_reg0f

Register 0Fh. RDS4 (0x0000)

RDS Block D - The fourth register of RDS received when read

Definition at line 410 of file BK108X.h.

Class Members
struct bk_reg0f refined
uint16_t raw

◆ bk_reg0f.refined

struct bk_reg0f.refined

Definition at line 412 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg10

union bk_reg10

Register 10h. Boot Configuration1 (0x7b11)

Definition at line 424 of file BK108X.h.

Class Members
struct bk_reg10 refined
uint16_t raw

◆ bk_reg10.refined

struct bk_reg10.refined

Definition at line 426 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg11

union bk_reg11

Register 11h. Boot Configuration2 (0x0080)

Definition at line 438 of file BK108X.h.

Class Members
struct bk_reg11 refined
uint16_t raw

◆ bk_reg11.refined

struct bk_reg11.refined

Definition at line 440 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg12

union bk_reg12

Register 12h. Boot Configuration3 (0x4000)

Definition at line 452 of file BK108X.h.

Class Members
struct bk_reg12 refined
uint16_t raw

◆ bk_reg12.refined

struct bk_reg12.refined

Definition at line 454 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg13

union bk_reg13

Register 13h. Boot Configuration4 (0x3e00)

Definition at line 466 of file BK108X.h.

Class Members
struct bk_reg13 refined
uint16_t raw

◆ bk_reg13.refined

struct bk_reg13.refined

Definition at line 468 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg14

union bk_reg14

Register 14h. Boot Configuration5 (0x0000)

Definition at line 480 of file BK108X.h.

Class Members
struct bk_reg14 refined
uint16_t raw

◆ bk_reg14.refined

struct bk_reg14.refined

Definition at line 482 of file BK108X.h.

Class Members
uint8_t RSSIMTH: 7 The Mute Threshold Based on RSSI.
uint8_t SNRMTH: 7 The Mute Threshold Based on SNR.
uint8_t AFCMUTE: 1 0: disable soft mute when AFCRL is high; 1: enable soft mute when AFCRL is high
uint8_t SKMUTE: 1 0: disable soft mute when seeking; 1: enable soft mute when seeking

◆ bk_reg15

union bk_reg15

15h. Boot Configuration6 (0x0000)

Definition at line 496 of file BK108X.h.

Class Members
struct bk_reg15 refined
uint16_t raw

◆ bk_reg15.refined

struct bk_reg15.refined

Definition at line 498 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg16

union bk_reg16

Register 16h. Boot Configuration7 (0x0400)

Definition at line 510 of file BK108X.h.

Class Members
struct bk_reg16 refined
uint16_t raw

◆ bk_reg16.refined

struct bk_reg16.refined

Definition at line 512 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg17

union bk_reg17

Register 17h. Boot Configuration8 (0x0001)

Definition at line 524 of file BK108X.h.

Class Members
struct bk_reg17 refined
uint16_t raw

◆ bk_reg17.refined

struct bk_reg17.refined

Definition at line 526 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg18

union bk_reg18

Register 18h. Boot Configuration9 (0x143c)

Definition at line 538 of file BK108X.h.

Class Members
struct bk_reg18 refined
uint16_t raw

◆ bk_reg18.refined

struct bk_reg18.refined

Definition at line 540 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg19

union bk_reg19

Register 19h. Boot Configuration10 (0x4351)

Definition at line 552 of file BK108X.h.

Class Members
struct bk_reg19 refined
uint16_t raw

◆ bk_reg19.refined

struct bk_reg19.refined

Definition at line 554 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ bk_reg1A

union bk_reg1A

Register 1Ah. Boot Configuration11 (0x0000)

Definition at line 566 of file BK108X.h.

Class Members
struct bk_reg1A refined
uint16_t raw

◆ bk_reg1A.refined

struct bk_reg1A.refined

Definition at line 568 of file BK108X.h.

Class Members
uint16_t RESERVED1: 3
uint16_t ANT_SEL: 5 Antenna varactor tune.
uint16_t RESERVED2: 4

◆ bk_reg1B

union bk_reg1B

Register 1Bh. Analog Configuration1 (0x0000)

Definition at line 581 of file BK108X.h.

Class Members
struct bk_reg1B refined
uint16_t raw

◆ bk_reg1B.refined

struct bk_reg1B.refined

Definition at line 583 of file BK108X.h.

Class Members
uint16_t RESERVED

◆ bk_reg1C

union bk_reg1C

Register 1Ch. Analog Configuration2 (0x0000)

Definition at line 593 of file BK108X.h.

Class Members
struct bk_reg1C refined
uint16_t raw

◆ bk_reg1C.refined

struct bk_reg1C.refined

Definition at line 595 of file BK108X.h.

Class Members
uint16_t RESERVED: 15
uint16_t FREQ_SEL: 1 Reference clock divider control ,Refer to Reg1D Default 0 for 32.768kHz reference input.

◆ bk_reg1D

union bk_reg1D

Register 1Dh. Analog Configuration2 (0x0000)

Definition at line 607 of file BK108X.h.

Class Members
struct bk_reg1D refined
uint16_t raw //!< Reference clock divider control , FREQ_SEL[17:0] = HEX | Ref Frequency/512+0.5 | Default 16 for 32.768kHz reference.

◆ bk_reg1D.refined

struct bk_reg1D.refined

Definition at line 609 of file BK108X.h.

Class Members
uint16_t FREQ_SEL

◆ bk_rds_blockb

union bk_rds_blockb

RDS Block B data type.

For GCC on System-V ABI on 386-compatible (32-bit processors), the following stands:

1) Bit-fields are allocated from right to left (least to most significant). 2) A bit-field must entirely reside in a storage unit appropriate for its declared type. Thus a bit-field never crosses its unit boundary. 3) Bit-fields may share a storage unit with other struct/union members, including members that are not bit-fields. Of course, struct members occupy different parts of the storage unit. 4) Unnamed bit-fields' types do not affect the alignment of a structure or union, although individual bit-fields' member offsets obey the alignment constraints.

See also
also https://en.wikipedia.org/wiki/Radio_Data_System

Definition at line 641 of file BK108X.h.

Class Members
struct bk_rds_blockb group0
struct bk_rds_blockb group2
struct bk_rds_blockb refined
bk_reg0d blockB

◆ bk_rds_blockb.group0

struct bk_rds_blockb.group0

Definition at line 643 of file BK108X.h.

Class Members
uint8_t address: 2
uint8_t DI: 1
uint8_t MS: 1
uint8_t TA: 1
uint8_t programType: 5
uint8_t trafficProgramCode: 1
uint8_t versionCode: 1
uint8_t groupType: 4

◆ bk_rds_blockb.group2

struct bk_rds_blockb.group2

Definition at line 654 of file BK108X.h.

Class Members
uint8_t address: 4
uint8_t textABFlag: 1
uint8_t programType: 5
uint8_t trafficProgramCode: 1
uint8_t versionCode: 1
uint8_t groupType: 4

◆ bk_rds_blockb.refined

struct bk_rds_blockb.refined

Definition at line 663 of file BK108X.h.

Class Members
uint8_t content: 4
uint8_t textABFlag: 1
uint8_t programType: 5
uint8_t trafficProgramCode: 1
uint8_t versionCode: 1
uint8_t groupType: 4

◆ bk_rds_date_time

union bk_rds_date_time

Group RDS type 4A ( RDS Date and Time) When group type 4A is used by the station, it shall be transmitted every minute according to EN 50067. This Structure uses blocks 2,3 and 5 (B,C,D)

ATTENTION: To make it compatible with 8, 16 and 32 bits platforms and avoid Crosses boundary, it was necessary to split minute and hour representation.

Definition at line 685 of file BK108X.h.

Class Members
struct bk_rds_date_time refined
uint8_t raw[6]

◆ bk_rds_date_time.refined

struct bk_rds_date_time.refined

Definition at line 687 of file BK108X.h.

Class Members
uint8_t offset: 5
uint8_t offset_sense: 1
uint8_t minute1: 2
uint8_t minute2: 4
uint8_t hour1: 4
uint8_t hour2: 1
uint32_t mjd: 17

◆ word16_to_bytes

union word16_to_bytes

Converts 16 bits word to two bytes.

Definition at line 704 of file BK108X.h.

Class Members
struct word16_to_bytes refined
uint16_t raw

◆ word16_to_bytes.refined

struct word16_to_bytes.refined

Definition at line 706 of file BK108X.h.

Class Members
uint8_t lowByte
uint8_t highByte

◆ BK108X

class BK108X

KT0915 Class.


This class implements all functions that will help you to control the KT0915 devices.

Author
PU2CLR - Ricardo Lima Caratti

Definition at line 723 of file BK108X.h.

Public Member Functions

void setI2C (uint8_t i2c_addr=I2C_DEVICE_ADDR)
 Sets I2C bus address. More...
 
void i2cInit (int pin_sdio, int pin_sclk)
 Sets the MCU pins connected to the I2C bus. More...
 
void i2cBeginTransaction ()
 Starts the I2C bus transaction
More...
 
void i2cEndTransaction ()
 Finish the I2C bus transaction. More...
 
void i2cAck ()
 Sends Acknowledge (ACK) More...
 
void i2cNack ()
 Sends Not Acknowledge (ACK) More...
 
uint8_t i2cReceiveAck ()
 Gets Acknowledge (ACK) More...
 
void i2cWriteByte (uint8_t data)
 Sends a Byte to the slave device. More...
 
uint8_t i2cReadByte ()
 Gets a Byte from the slave device. More...
 
void writeRegister (uint8_t reg, uint16_t vakue)
 Sends an array of values to a BK108X given register. More...
 
uint16_t readRegister (uint8_t reg)
 Gets an array of values from a BK108X given register. More...
 
void reset ()
 Resets the device. More...
 
void powerUp ()
 Powers the receiver on. More...
 
void powerDown ()
 Powers the receiver off. More...
 
void waitAndFinishTune ()
 Wait STC (Seek/Tune Complete) status becomes 0. More...
 
void setI2CAddress (int bus_addr)
 Sets the I2C bus address. More...
 
void setDelayAfterCrystalOn (uint8_t ms_value)
 Set the Delay After Crystal On (default 500ms) More...
 
uint16_t getRegister (uint8_t reg)
 Gets a givens current register content of the device. More...
 
void setRegister (uint8_t reg, uint16_t value)
 Sets a given value to the device registers. More...
 
bk_reg0a getStatus ()
 Gets the current status (register 0x0A) content. More...
 
uint16_t getShadownRegister (uint8_t register_number)
 Get the Shadown Register object. More...
 
void setShadownRegister (uint8_t register_number, uint16_t value)
 Sets a given value to the Shadown Register. More...
 
uint16_t getDeviceId ()
 Returns the Device Indentifiction. More...
 
uint16_t getChipId ()
 Returns the Chip Indentifiction. More...
 
void setup (int sda_pin, int sclk_pin, int rdsInterruptPin=-1, int seekInterruptPin=-1, uint8_t oscillator_type=OSCILLATOR_TYPE_CRYSTAL)
 Starts the device. More...
 
void setFM (uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step)
 Sets the receiver to FM mode. More...
 
void setAM (uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step, uint16_t am_space=0)
 Sets the receiver to AM mode. More...
 
uint8_t getCurrentMode ()
 Get the Current Mode (AM or FM) More...
 
void setStereoThresholdPilotStrength (uint8_t value)
 Sets the Stereo Threshold of Pilotto Strength. More...
 
void setFmDeemphasis (uint8_t de)
 Sets De-emphasis. More...
 
void setTimeCallStrengthPilot (uint8_t value)
 Sets the time used to call the strength of pilot. More...
 
void setGpio2 (uint8_t value)
 Sets the Gpio2. More...
 
void setGpio3 (uint8_t value)
 Sets the Gpio3. More...
 
void setAfc (bool value)
 Enables or Disables AFC. More...
 
void setAfcRssiSnrCalculateRate (uint8_t value)
 Sets AFC/RSSI/SNR Calculate Rate. More...
 
void setAfcThreshold (uint8_t value)
 Sets AFCRL Threshold. More...
 
void setAfcAve (uint8_t value)
 Sets AFC Average. More...
 
void setAfcVar (uint8_t value)
 Sets Variation Threshold for average AFC calculation. More...
 
void setAfcRange (uint8_t value)
 Sets AFC range. More...
 
void setAfcRssiThreshold (uint8_t value)
 Sets RSSI Threshold for Instant AFC updating. More...
 
void setFrequency (uint16_t frequency)
 Sets the FM frequency. More...
 
void setFrequencyUp ()
 Increments the current frequency. More...
 
void setFrequencyDown ()
 Decrements the current frequency. More...
 
uint16_t getFrequency ()
 Gets the current frequency. More...
 
uint16_t getChannel ()
 Gets the current channel. More...
 
uint16_t getRealFrequency ()
 Gets the frequency based on READCHAN register (0x0B) More...
 
uint16_t getRealChannel ()
 Gets the current channel stored in register 0x0B. More...
 
void setChannel (uint16_t channel)
 Sets the channel. More...
 
void seekHardware (uint8_t seek_mode, uint8_t direction)
 Seeks a station via hardware functionality. More...
 
void seekSoftware (uint8_t seek_mode, uint8_t direction, void(*showFunc)()=NULL)
 Seeks a station via Software. More...
 
void setSeekThreshold (uint8_t rssiValue, uint8_t snrValue)
 Sets RSSI and SNR Seek Threshold. More...
 
void setBand (uint8_t band=1)
 Sets the current band for AM or FM
More...
 
void setSpace (uint8_t space=0)
 Sets the Space channel for AM or FM. More...
 
int getRssi ()
 Gets the current Rssi. More...
 
int getSnr ()
 Gets the current SNR. More...
 
void setSoftmute (bool value)
 Sets the Softmute true or false. More...
 
void setSoftmuteAttack (uint8_t value)
 Sets Softmute Attack/Recover Rate. More...
 
void setSoftmuteAttenuation (uint8_t value)
 Sets Softmute Attenuation. More...
 
void setMuteThreshold (uint8_t rssi, uint8_t snr)
 Set the Mute Threshold based on RSSI and SNR. More...
 
void setSeekMute (bool value)
 Disable or Enable soft mute when seeking. More...
 
void setAfcMute (bool value)
 Disable or Enable soft mute when AFCRL is high. More...
 
void setAgc (bool value)
 Sets the AGC enable or disable. More...
 
void setMono (bool value)
 Sets the Mono true or false (stereo) More...
 
bool isStereo ()
 Checks stereo / mono status. More...
 
void setAudioMute (bool left, bool right)
 Sets the Mute true or false. More...
 
void setAudioMute (bool value)
 Sets the Mute true or false. More...
 
void setVolume (uint8_t value)
 Sets the audio volume level. More...
 
uint8_t getVolume ()
 Gets the current audio volume level. More...
 
void setVolumeUp ()
 Increments the audio volume. More...
 
void setVolumeDown ()
 Decrements the audio volume. More...
 
void getRdsStatus ()
 Gets the RDS registers information. More...
 
void setRdsMode (uint8_t rds_mode=0)
 Sets the Rds Mode Standard or Verbose. More...
 
void setRds (bool value)
 Sets the RDS operation. More...
 
void setRDS (bool value)
 
bool getRdsReady ()
 Returns true if RDS Ready. More...
 
uint8_t getRdsFlagAB (void)
 Returns the current Text Flag A/B
More...
 
uint8_t getRdsVersionCode (void)
 Gets the version code (extracted from the Block B) More...
 
uint16_t getRdsGroupType ()
 Return the group type. More...
 
uint8_t getRdsProgramType (void)
 Returns the Program Type (extracted from the Block B) More...
 
void getNext2Block (char *c)
 Process data received from group 2B. More...
 
void getNext4Block (char *c)
 Process data received from group 2A. More...
 
char * getRdsText (void)
 Gets the RDS Text when the message is of the Group Type 2 version A. More...
 
char * getRdsText0A (void)
 Gets the station name and other messages. More...
 
char * getRdsText2A (void)
 Gets the Text processed for the 2A group. More...
 
char * getRdsText2B (void)
 Gets the Text processed for the 2B group. More...
 
char * getRdsTime ()
 Gets the RDS time and date when the Group type is 4. More...
 
bool getRdsSync ()
 Get the Rds Sync. More...
 

Protected Attributes

char rds_buffer2A [65]
 RDS Radio Text buffer - Program Information. More...
 
char rds_buffer2B [33]
 RDS Radio Text buffer - Station Informaation. More...
 
char rds_buffer0A [9]
 RDS Basic tuning and switching information (Type 0 groups) More...
 
char rds_time [20]
 RDS date time received information. More...
 
int deviceAddress = I2C_DEVICE_ADDR
 
uint32_t currentFrequency
 
uint32_t minimumFrequency
 
uint32_t maximumFrequency
 
uint16_t currentChannel = 0
 
uint16_t currentStep = 1
 
uint8_t currentFMBand = 0
 
uint8_t currentAMBand = 1
 
uint8_t currentFMSpace = 0
 
uint8_t currentAMSpace = 0
 
uint8_t currentMode = MODE_FM
 
uint8_t currentVolume = 0
 
int rdsInterruptPin = -1
 
int seekInterruptPin = -1
 
int oscillatorType = OSCILLATOR_TYPE_CRYSTAL
 
uint16_t maxDelayAftarCrystalOn = MAX_DELAY_AFTER_OSCILLATOR
 

Member Function Documentation

◆ getDeviceId()

uint16_t BK108X::getDeviceId ( )

Returns the Device Indentifiction.

Returns
device id

Definition at line 302 of file BK108X.cpp.

◆ getChipId()

uint16_t BK108X::getChipId ( )

Returns the Chip Indentifiction.

Returns
IC id

Definition at line 312 of file BK108X.cpp.

◆ setGpio2()

void BK108X::setGpio2 ( uint8_t  value)
inline

Sets the Gpio2.

the General Purpose I/O 2. You can use this pin according to the table below.

value description
0 Low
1 STC/RDS interrupt
2 Low
3 High
Parameters
valueSee table above

Definition at line 934 of file BK108X.h.

◆ setGpio3()

void BK108X::setGpio3 ( uint8_t  value)
inline

Sets the Gpio3.

the General Purpose I/O 3. You can use this pin according to the table below.

value description
0 Low
1 Mono/Stereo Indicator
2 Low
3 High
Parameters
valueSee table above

Definition at line 952 of file BK108X.h.

◆ setAfc()

void BK108X::setAfc ( bool  value)
inline

Enables or Disables AFC.

Parameters
valueif True, it enables AFC

Definition at line 963 of file BK108X.h.

◆ setAfcRssiSnrCalculateRate()

void BK108X::setAfcRssiSnrCalculateRate ( uint8_t  value)
inline

Sets AFC/RSSI/SNR Calculate Rate.

00 = fastest; 11 = slowest. 4X times each

Parameters
value0˜3

Definition at line 974 of file BK108X.h.

◆ setAfcThreshold()

void BK108X::setAfcThreshold ( uint8_t  value)
inline

Sets AFCRL Threshold.

0 = Channel space/2; 1 = 25kHz

Parameters
value0=Channel space/2; 1 = 25kHz

Definition at line 985 of file BK108X.h.

◆ setAfcAve()

void BK108X::setAfcAve ( uint8_t  value)
inline

Sets AFC Average.

0 = Use the instant AFC value; 1 = Use the average AFC value

Parameters
value0 or 1

Definition at line 996 of file BK108X.h.

◆ setAfcVar()

void BK108X::setAfcVar ( uint8_t  value)
inline

Sets Variation Threshold for average AFC calculation.

0 = Disable; 1 = the most strict; 2= ?; 3 = the loosest

Parameters
value0, 1, 2 or 3

Definition at line 1007 of file BK108X.h.

◆ setAfcRange()

void BK108X::setAfcRange ( uint8_t  value)
inline

Sets AFC range.

0 = he most strict; 3 = the loosest

Parameters
value0,1,2 or 3

Definition at line 1018 of file BK108X.h.

◆ setAfcRssiThreshold()

void BK108X::setAfcRssiThreshold ( uint8_t  value)
inline

Sets RSSI Threshold for Instant AFC updating.

default value is 16 (0x10)

Parameters
value

Definition at line 1029 of file BK108X.h.

◆ setRDS()

void BK108X::setRDS ( bool  value)
inline

Definition at line 1076 of file BK108X.h.

References setRds().

Member Data Documentation

◆ rds_buffer2A

char BK108X::rds_buffer2A[65]
protected

RDS Radio Text buffer - Program Information.

Definition at line 777 of file BK108X.h.

◆ rds_buffer2B

char BK108X::rds_buffer2B[33]
protected

RDS Radio Text buffer - Station Informaation.

Definition at line 778 of file BK108X.h.

◆ rds_buffer0A

char BK108X::rds_buffer0A[9]
protected

RDS Basic tuning and switching information (Type 0 groups)

Definition at line 779 of file BK108X.h.

◆ rds_time

char BK108X::rds_time[20]
protected

RDS date time received information.

Definition at line 780 of file BK108X.h.

◆ deviceAddress

int BK108X::deviceAddress = I2C_DEVICE_ADDR
protected

Definition at line 782 of file BK108X.h.

Referenced by setI2CAddress().

◆ currentFrequency

uint32_t BK108X::currentFrequency
protected

Definition at line 784 of file BK108X.h.

◆ minimumFrequency

uint32_t BK108X::minimumFrequency
protected

Definition at line 785 of file BK108X.h.

◆ maximumFrequency

uint32_t BK108X::maximumFrequency
protected

Definition at line 786 of file BK108X.h.

◆ currentChannel

uint16_t BK108X::currentChannel = 0
protected

Definition at line 788 of file BK108X.h.

◆ currentStep

uint16_t BK108X::currentStep = 1
protected

Definition at line 789 of file BK108X.h.

◆ currentFMBand

uint8_t BK108X::currentFMBand = 0
protected

Definition at line 790 of file BK108X.h.

◆ currentAMBand

uint8_t BK108X::currentAMBand = 1
protected

Definition at line 791 of file BK108X.h.

◆ currentFMSpace

uint8_t BK108X::currentFMSpace = 0
protected

Definition at line 792 of file BK108X.h.

◆ currentAMSpace

uint8_t BK108X::currentAMSpace = 0
protected

Definition at line 793 of file BK108X.h.

◆ currentMode

uint8_t BK108X::currentMode = MODE_FM
protected

Definition at line 794 of file BK108X.h.

◆ currentVolume

uint8_t BK108X::currentVolume = 0
protected

Definition at line 796 of file BK108X.h.

◆ rdsInterruptPin

int BK108X::rdsInterruptPin = -1
protected

Definition at line 797 of file BK108X.h.

Referenced by setup().

◆ seekInterruptPin

int BK108X::seekInterruptPin = -1
protected

Definition at line 798 of file BK108X.h.

Referenced by setup().

◆ oscillatorType

int BK108X::oscillatorType = OSCILLATOR_TYPE_CRYSTAL
protected

Definition at line 799 of file BK108X.h.

◆ maxDelayAftarCrystalOn

uint16_t BK108X::maxDelayAftarCrystalOn = MAX_DELAY_AFTER_OSCILLATOR
protected

Definition at line 800 of file BK108X.h.