PU2CLR BK108X Arduino Library  1.0.1
This is an Arduino Library to control the BK108X device
BK108X.h
Go to the documentation of this file.
1 
2 /**
3  * @mainpage PU2CLR BK108X Arduino Library
4  * @brief PU2CLR BK108X Arduino Library implementation. <br>
5  * @details This is an Arduino library for the BK1086 and BK1088 DSP BROADCAST RECEIVER.<br>
6  * @details It works with I2C protocol and can provide an easier interface for controlling the BK1086/88 devices.<br>
7  * @details This library is based on BEKEN - BK1086/88 - BROADCAST AM/FM/SW/LW RADIO RECEIVER manual.
8  *
9  * @see https://github.com/pu2clr/BK108X
10  *
11  * __THIS LIBRARY IS UNDER CONSTRUCTION.....___
12  *
13  *
14  * This library can be freely distributed using the MIT Free Software model.
15  * Copyright (c) 2020 Ricardo Lima Caratti.
16  * Contact: pu2clr@gmail.com
17  */
18 
19 #include <Arduino.h>
20 
21 #define MAX_DELAY_AFTER_OSCILLATOR 500 // Max delay after the crystal oscilator becomes active
22 
23 #define I2C_DEVICE_ADDR 0x80
24 
25 
26 
27 #define OSCILLATOR_TYPE_CRYSTAL 1 // Crystal
28 #define OSCILLATOR_TYPE_REFCLK 0 // Reference clock
29 
30 #define RDS_STANDARD 0 //!< RDS Mode.
31 #define RDS_VERBOSE 1 //!< RDS Mode.
32 #define BK_SEEK_DOWN 0 //!< Seek Down Direction
33 #define BK_SEEK_UP 1 //!< Seek Up Direction
34 #define BK_SEEK_WRAP 0 //
35 #define BK_SEEK_STOP 1
36 
37 #define FM_FULL 0 //!< 64~108MHz
38 #define FM_BAND_JAPAN_WIDE 1 //!< 76–108 MHz (Japan wide band)
39 #define FM_BAND_JAPAN 2 //!< 76–90 MHz (Japan)
40 #define FM_BAND_USA_EU 3 //!< 87–108 MHz (US / Europe, Default)
41 
42 #define AM_LW 0 //!< 153~279KHz
43 #define AM_MW1 1 //!< 520~1710Khz
44 #define AM_SW 2 //!< 2.3~21.85KHz
45 #define AM_M22 3 //!< 522~1710
46 
47 #define MODE_FM 0
48 #define MODE_AM 1
49 
50 #define REG00 0x00
51 #define REG01 0x01
52 #define REG02 0x02
53 #define REG03 0x03
54 #define REG04 0x04
55 #define REG05 0x05
56 #define REG06 0x06
57 #define REG07 0x07
58 #define REG08 0x08
59 #define REG09 0x09
60 #define REG0A 0x0A
61 #define REG0B 0x0B
62 #define REG0C 0x0C
63 #define REG0D 0x0D
64 #define REG0E 0x0E
65 #define REG0F 0x0F
66 #define REG10 0x10
67 #define REG11 0x11
68 #define REG12 0x12
69 #define REG13 0x13
70 #define REG14 0x14
71 #define REG15 0x15
72 #define REG16 0x16
73 #define REG17 0x17
74 #define REG18 0x18
75 #define REG19 0x19
76 #define REG1A 0x1A
77 #define REG1B 0x1B
78 #define REG1C 0x1C
79 #define REG1D 0x1D
80 #define REG1E 0x1E
81 #define REG1F 0x1F
82 
83 /**
84  * @defgroup GA01 Union, Structure and Defined Data Types
85  * @brief BK108X Defined Data Types
86  * @details Defined Data Types is a way to represent the BK108X registers information
87  * @details Some information appears to be inaccurate due to translation problems from Chinese to English.
88  * @details The information shown here was extracted from Datasheet:
89  * @details BK108X stereo FM digital tuning radio documentation.
90  * @details Other information seems incomplete even in the original Chinese Datasheet.
91  * @details For example: Reg 10 (0x0A). There is no information about it. The Reg11 and 12 seem wrong
92  */
93 
94 /**
95  * @ingroup GA01
96  * @brief Device ID
97  *
98  */
99 typedef union
100 {
101  struct
102  {
103  uint8_t lowByte;
104  uint8_t highByte;
105  } refined;
107 } bk_reg00;
108 
109 /**
110  * @ingroup GA01
111  * @brief Chip ID
112  *
113  */
114 typedef union
115 {
116  struct
117  {
118  uint8_t lowByte;
119  uint8_t highByte;
120  } refined;
122 } bk_reg01;
123 
124 /**
125  * @ingroup GA01
126  * @brief Power Configuratio
127  * @see BEKEN - BK1086/88 - BROADCAST AM/FM/SW/LW RADIO RECEIVER; pages 13 and 14
128  */
129 typedef union
130 {
131  struct
132  {
133  uint8_t ENABLE : 1; //!< Powerup Enable;
134  uint8_t SNR_REF : 5; //!< Output SNR adjustment. Read SNR = SNR (calculated)
135  uint8_t DISABLE : 1; //!< Powerup Disable;
136  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.
137  uint8_t SEEK : 1; //!< 0 = Disable (default); 1 = Enable;
138  uint8_t SEEKUP : 1; //!< Seek Direction; 0 = Seek down (default); 1 = Seek up.
139  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.
140  uint8_t STEREO : 1; //!< Stereo; 0 = Normal operation; 1 = Force stereo; MONO and STEREO cannot be set to 1 simultaneously.
141  uint8_t MONO : 1; //!< Mono; 0 = Normal operation; 1 = Force mono.
142  uint8_t MUTER : 1; //!< Mute R channel; 0 = R channel normal operation; 1 = R channel mute.
143  uint8_t MUTEL : 1; //!< Mute L channel; 0 = L channel normal operation; 1 = L channel mute.
144  uint8_t DSMUTE : 1; //!< Softmute Disable; 0 = Softmute enable (default); 1 = Softmute disable.
145  } refined;
147 } bk_reg02;
148 
149 /**
150  * @ingroup GA01
151  * @brief Channe
152  * @details The tuned Frequency = Band + CHAN * SPACE
153  * @see BEKEN - BK1086/88 - BROADCAST AM/FM/SW/LW RADIO RECEIVER; page 14
154  */
155 typedef union
156 {
157  struct
158  {
159  uint16_t CHAN : 15; //!< Channel Select; The tuned Frequency = Band + CHAN * SPACE.
160  uint16_t TUNE : 1; //!< Tune. 0 = Disable (default); 1 = Enable.
161  } refined;
163 } bk_reg03;
164 
165 /**
166  * @ingroup GA01
167  * @brief Register 04h. System Configuration1 (0x1180)
168  * @details 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;
169  * @details When register GPIO2[1:0]=2’b01 and new RDS come, a 5ms low pulse will appear at GPIO2.
170  *
171  * | BLNDADJ value | Description |
172  * | ------------ | ----------- |
173  * | 0 | 31–49 RSSI (0 dBuV) |
174  * | 1 | 34–52 RSSI (+3 dBuV) |
175  * | 2 | 37–55 RSSI (+6 dBuV) |
176  * | 3 | 40–58 RSSI (+9 dBuV) |
177  * | 4 | 31–49 RSSI (0 dBuV) |
178  * | 5 | 28–46 RSSI (-3 dBuV) |
179  * | 6 | 25–43 RSSI (-6 dBuV) |
180  * | 7 | 22–40 RSSI (-9 dBuV) |
181  *
182  */
183 typedef union
184 {
185  struct
186  {
187  uint8_t GPIO1 : 2; //!< General Purpose I/O 1; 00 = High impedance (default); 01 = CLK38MHz; 10 = Low; 11 = High.
188  uint8_t GPIO2 : 2; //!< General Purpose I/O 2. 00 = High impedance (default); 01 = STC/RDS interrupt; 10 = Low; 11 = High.
189  uint8_t GPIO3 : 2; //!< General Purpose I/O 2. 00 = High impedance (default); 01 = Mono/Stereo indicator (ST); 10 = Low; 11 = High.
190  uint8_t BLNDADJ : 3; //!< Stereo/Mono Blend Level Adjustment. Sets the RSSI range for stereo/mono blend. See table above.
191  uint8_t TCPILOT : 2; //!< The Time Used to Cal The Strength of Pilot
192  uint8_t AGCD : 1; //!< AGC Disable; 0 = AGC enable (default); 1 = AGC disable.
193  uint8_t DE : 1; //!< De-emphasis; 0 = 75 μs. Used in USA (default); 1 = 50 μs. Used in Europe, Australia, Japan.
194  uint8_t RDSEN : 1; //!< RDS Enable; 0 = Disable (default); 1 = Enable.
195  uint8_t AFCINV : 1; //!< AFC Invert; 0 = Normal AFC into mixer; 1 = Reverse AFC into mixer.
196  uint8_t STCIEN : 1; //!< Seek/Tune Complete Interrupt Enable; 0 = Disable Interrupt (default); 1 = Enable Interrupt. See details above.
197  uint8_t RDSIEN : 1; //!< RDS Interrupt Enable; 0 = Disable Interrupt (default); 1 = Enable Interrupt. See details above.
198  } refined;
200 } bk_reg04;
201 
202 /**
203  * @ingroup GA01
204  * @brief Register 05h. System Configuration2 (0x3ddf)
205  * @details LW and SW Band are only defined at BK1088
206  *
207  * AM and Fm Band table ()
208  * | BAND value | AM band KHz | FM band MHz |
209  * | ---------- | ----------------| ----------------- |
210  * | 0 | 00: LW 153~279 | FULL 64~108 |
211  * | 1 | 10: MW 520~1710 | East Europe 64~76 |
212  * | 2 | 10: SW 2.3~21.85| Japan 76~91 |
213  * | 3 | 11: MW 522~1710 | Europe 87~108 |
214  *
215  *
216  * AM and FM Channel Space
217  * | BAND value | AM Space KHz | FM Space KHz |
218  * | ---------- | ------------- | ------------- |
219  * | 0 | 1 | 10 |
220  * | 1 | 5 | 50 |
221  * | 2 | 9 | 100 |
222  * | 3 | 10 | 200 |
223  *
224  * @see bk_reg07
225  */
226 typedef union
227 {
228  struct
229  {
230  uint8_t VOLUME : 5; //!< 0x00 is the lowest and 0x1F is highest (0dBFS). 2dB each
231  uint8_t SPACE : 2; //!< Channel Spacing; See AM and FM Channel Space table above.
232  uint8_t BAND : 2; //!< Band Select. See AM and Fm Band table above.
233  uint8_t SEEKTH : 7; //!< RSSI Seek Threshold. 0x00 = min RSSI (default); 0x7F = max RSSI.
234  } refined;
236 } bk_reg05;
237 
238 /**
239  * @ingroup GA01
240  * @brief Register 06h. System Configuration3 (0x01ef)
241  * @details 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.
242  *
243  *
244  * SMUTEA table
245  *
246  * | Softmute Attenuation | Description |
247  * | ---------------------- | --------------- |
248  * | 0 | 16 dB (default) |
249  * | 1 | 14 dB |
250  * | 2 | 12 dB |
251  * | 3 | 10 dB |
252  *
253  * SMUTER table
254  *
255  * | Softmute Attack/Recover Rate | Description |
256  * | ------------------------------ | ----------------- |
257  * | 0 | fastest (default) |
258  * | 1 | fast |
259  * | 2 | slow |
260  * | 3 | slowest |
261  *
262  */
263 typedef union
264 {
265  struct
266  {
267  uint8_t SKCNT : 4; //!< See details above.
268  uint8_t SKSNR : 7; //!< Seek SNR Threshold. Required channel SNR for a valid seek channel
269  uint8_t CLKSEL : 1; //!< Clock Select. 0 = External clock input; 1= Internal oscillator input.
270  uint8_t SMUTEA : 2; //!< Softmute Attenuation; See table above.
271  uint8_t SMUTER : 2; //!< Softmute Attack/Recover Rate; See table above
272  } refined;
274 } bk_reg06;
275 
276 /**
277  * @ingroup GA01
278  * @brief Register 07h. Test1 (0x0900)
279  */
280 typedef union
281 {
282  struct
283  {
284  uint8_t FMGAIN : 3; //!< The gain of Frequency demodulated; 000 = 0dB ... 011= +18dB; 100= 0dB ... 111= -18dB
285  uint8_t STGAIN : 5; //!< Stereo L/R Gain Adjustment, sighed value; 00000 = 0 dB ... 01111=15dB; 10000= -16dB ... 11111= -1dB; For stereo separation optimization
286  uint8_t IMPTH : 2; //!< Threshold of Impulse Detect. 00 = toughest; 11 = loosest
287  uint8_t BPDE : 1; //!< De-emphasis Bypass; 0 = Normal operation; 1 = Bypass de-emphasis.
288  uint8_t IMPEN : 1; //!< Impulse Remove Enable; 0 = Disable; 1 = Enable.
289  uint8_t SIQ : 1; //!< IF I/Q Signal switch; 0 = Normal operation; 1 = Reversed I/Q signal.
290  uint8_t MODE : 1; //!< 0 = FM receiver; 1 = AM receiver
291  uint8_t RESERVED : 2;
292  } refined;
294 } bk_reg07;
295 
296 /**
297  * @ingroup GA01
298  * @brief Test 2
299  * @details RSSI Threshold for Instant AFC updating; AFC Average Range; Variation Threshold for average AFC calculation;
300  * @details AFC Average; AFCRL Threshold; AFC/RSSI/SNR Calculate Rate; AFC Enable
301  *
302  */
303 typedef union
304 {
305  struct
306  {
307  uint8_t AFCRSSIT : 7; //!< RSSI Threshold for Instant AFC updating
308  uint8_t RANGE : 2; //!< AFC Average Range; 00 = the toughest; 11 = the loosest
309  uint8_t VAR : 2; //!< Variation Threshold for average AFC calculation; 00 = Disable; 01 = the toughest; 11 = the loosest
310  uint8_t AVE : 1; //!< AFC Average
311  uint8_t SEL25K : 1; //!< AFCRL Threshold; 0 = Channel space/2; 1 = 25kHz
312  uint8_t TCSEL : 2; //!< AFC/RSSI/SNR Calculate Rate; 00 = fastest; 11 = slowest. 4X times each
313  uint8_t AFCEN : 1; //!< AFC Enable; 0 = Disable; 1 = Enable.
314  } refined;
316 } bk_reg08;
317 
318 /**
319  * @ingroup GA01
320  * @brief Register 09h. Status1 (0x0000)
321  */
322 typedef union
323 {
324  struct
325  {
326  uint16_t SNR; //!< The AFC value.
327  uint16_t AFC; //!< unit AM 0.15k Hz, FM 0.6k Hz
328  } refined;
330 } bk_reg09;
331 
332 /**
333  * @ingroup GA01
334  * @brief Register 0Ah. Status2 (0x0000)
335  */
336 typedef union
337 {
338  struct
339  {
340  uint8_t RSSI : 7; //!< RSSI (Received Signal Strength Indicator).
341  uint8_t ST : 1; //!< Stereo Indicator; 0 = Mono; 1 = Stereo.
342  uint8_t CNTIMP : 4; //!< Impulse Number
343  uint8_t AFCRL : 1; //!< AFC Rail; 0 = AFC not railed; 1 = AFC railed.
344  uint8_t SF_BL : 1; //!< Seek Fail/Band Limit; 0 = Seek successful; 1 = Seek failure/Band limit reached.
345  uint8_t STC : 1; //!< Seek/Tune Complete; 0 = Not complete (default); 1 = Complete.
346  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
347  } refined;
349 } bk_reg0a;
350 
351 /**
352  * @ingroup GA01
353  * @brief Register 0Bh. Read Channel (0x0000)
354  */
355 typedef union
356 {
357  struct
358  {
359  uint16_t READCHAN : 14; //!< Read Channel. Provides the current working channel
360  uint16_t RESERVED : 2;
361  } refined;
363 } bk_reg0b;
364 
365 /**
366  * @ingroup GA01
367  * @brief Register 0Ch. RDS1 (0x0000)
368  * @details RDS Block A - The First Register of RDS Received
369  */
370 typedef union
371 {
372  struct
373  {
374  uint8_t lowByte;
375  uint8_t highByte;
376  } refined;
378 } bk_reg0c;
379 
380 /**
381  * @ingroup GA01
382  * @brief Register 0Dh. RDS2 (0x0000)
383  * @details RDS Block B - The second register of RDS received
384  */
385 typedef union
386 {
387  struct
388  {
389  uint8_t lowByte;
390  uint8_t highByte;
391  } refined;
393 } bk_reg0d;
394 
395 /**
396  * @ingroup GA01
397  * @brief Register 0Eh. RDS2 (0x0000)
398  * @details RDS Block C - The third register of RDS received
399  */
400 typedef union
401 {
402  struct
403  {
404  uint8_t lowByte;
405  uint8_t highByte;
406  } refined;
408 } bk_reg0e;
409 
410 /**
411  * @ingroup GA01
412  * @brief Register 0Fh. RDS4 (0x0000)
413  * @details RDS Block D - The fourth register of RDS received when read
414  */
415 typedef union
416 {
417  struct
418  {
419  uint8_t lowByte;
420  uint8_t highByte;
421  } refined;
423 } bk_reg0f;
424 
425 /**
426  * @ingroup GA01
427  * @brief Register 10h. Boot Configuration1 (0x7b11)
428  */
429 typedef union
430 {
431  struct
432  {
433  uint8_t lowByte;
434  uint8_t highByte;
435  } refined;
437 } bk_reg10;
438 
439 /**
440  * @ingroup GA01
441  * @brief Register 11h. Boot Configuration2 (0x0080)
442  */
443 typedef union
444 {
445  struct
446  {
447  uint8_t lowByte;
448  uint8_t highByte;
449  } refined;
451 } bk_reg11;
452 
453 /**
454  * @ingroup GA01
455  * @brief Register 12h. Boot Configuration3 (0x4000)
456  */
457 typedef union
458 {
459  struct
460  {
461  uint8_t lowByte;
462  uint8_t highByte;
463  } refined;
465 } bk_reg12;
466 
467 /**
468  * @ingroup GA01
469  * @brief Register 13h. Boot Configuration4 (0x3e00)
470  */
471 typedef union
472 {
473  struct
474  {
475  uint8_t lowByte;
476  uint8_t highByte;
477  } refined;
479 } bk_reg13;
480 
481 /**
482  * @ingroup GA01
483  * @brief Register 14h. Boot Configuration5 (0x0000)
484  */
485 typedef union
486 {
487  struct
488  {
489  uint8_t RSSIMTH : 7; //!< The Mute Threshold Based on RSSI
490  uint8_t SNRMTH : 7; //!< The Mute Threshold Based on SNR
491  uint8_t AFCMUTE : 1; //!< 0: disable soft mute when AFCRL is high; 1: enable soft mute when AFCRL is high
492  uint8_t SKMUTE : 1; //!< 0: disable soft mute when seeking; 1: enable soft mute when seeking
493  } refined;
495 } bk_reg14;
496 
497 /**
498  * @ingroup GA01
499  * @brief 15h. Boot Configuration6 (0x0000)
500  */
501 typedef union
502 {
503  struct
504  {
505  uint8_t lowByte;
506  uint8_t highByte;
507  } refined;
509 } bk_reg15;
510 
511 /**
512  * @ingroup GA01
513  * @brief Register 16h. Boot Configuration7 (0x0400)
514  */
515 typedef union
516 {
517  struct
518  {
519  uint8_t lowByte;
520  uint8_t highByte;
521  } refined;
523 } bk_reg16;
524 
525 /**
526  * @ingroup GA01
527  * @brief Register 17h. Boot Configuration8 (0x0001)
528  */
529 typedef union
530 {
531  struct
532  {
533  uint8_t lowByte;
534  uint8_t highByte;
535  } refined;
537 } bk_reg17;
538 
539 /**
540  * @ingroup GA01
541  * @brief Register 18h. Boot Configuration9 (0x143c)
542  */
543 typedef union
544 {
545  struct
546  {
547  uint8_t lowByte;
548  uint8_t highByte;
549  } refined;
551 } bk_reg18;
552 
553 /**
554  * @ingroup GA01
555  * @brief Register 19h. Boot Configuration10 (0x4351)
556  */
557 typedef union
558 {
559  struct
560  {
561  uint8_t lowByte;
562  uint8_t highByte;
563  } refined;
565 } bk_reg19;
566 
567 /**
568  * @ingroup GA01
569  * @brief Register 1Ah. Boot Configuration11 (0x0000)
570  */
571 typedef union
572 {
573  struct
574  {
575  uint16_t ANT_SEL : 9; //!< Antenna varactor tune
576  uint16_t RESERVED : 7;
577  } refined;
579 } bk_reg1A;
580 
581 /**
582  * @ingroup GA01
583  * @brief Register 1Bh. Analog Configuration1 (0x0000)
584  */
585 typedef union
586 {
587  struct
588  {
589  uint16_t RESERVED : 15;
590  uint16_t FREQ_SEL : 1; //!< Reference clock divider control ,Refer to Reg1D. Default 0 for 32.768kHz reference input.
591  } refined;
593 } bk_reg1B;
594 
595 /**
596  * @ingroup GA01
597  * @brief Register 1Ch. Analog Configuration2 (0x0000)
598  */
599 typedef union
600 {
601  struct
602  {
603  uint16_t RESERVED : 15;
604  uint16_t FREQ_SEL : 1; //!< Reference clock divider control ,Refer to Reg1D Default 0 for 32.768kHz reference input.
605  } refined;
607 } bk_reg1C;
608 
609 /**
610  * @ingroup GA01
611  * @brief Register 1Dh. Analog Configuration2 (0x0000)
612  */
613 typedef union
614 {
615  struct
616  {
617  uint8_t lowByte;
618  uint8_t highByte;
619  } refined;
620  uint16_t raw; //!< //!< Reference clock divider control , FREQ_SEL[17:0] = HEX | Ref Frequency/512+0.5 | Default 16 for 32.768kHz reference.
621 } bk_reg1D;
622 
623 typedef uint16_t bk_reg1E; // Internal register
624 typedef uint16_t bk_reg1F; // Internal Register
625 
626 /**
627  * @ingroup GA01
628  * @brief RDS Block B data type
629  *
630  * @details For GCC on System-V ABI on 386-compatible (32-bit processors), the following stands:
631  *
632  * 1) Bit-fields are allocated from right to left (least to most significant).
633  * 2) A bit-field must entirely reside in a storage unit appropriate for its declared type.
634  * Thus a bit-field never crosses its unit boundary.
635  * 3) Bit-fields may share a storage unit with other struct/union members, including members that are not bit-fields.
636  * Of course, struct members occupy different parts of the storage unit.
637  * 4) Unnamed bit-fields' types do not affect the alignment of a structure or union, although individual
638  * bit-fields' member offsets obey the alignment constraints.
639  *
640  * @see also https://en.wikipedia.org/wiki/Radio_Data_System
641  */
642 typedef union
643 {
644  struct
645  {
646  uint8_t address : 2; // Depends on Group Type and Version codes. If 0A or 0B it is the Text Segment Address.
647  uint8_t DI : 1; // Decoder Controll bit
648  uint8_t MS : 1; // Music/Speech
649  uint8_t TA : 1; // Traffic Announcement
650  uint8_t programType : 5; // PTY (Program Type) code
651  uint8_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
652  uint8_t versionCode : 1; // (B0) => 0=A; 1=B
653  uint8_t groupType : 4; // Group Type code.
654  } group0;
655  struct
656  {
657  uint8_t address : 4; // Depends on Group Type and Version codes. If 2A or 2B it is the Text Segment Address.
658  uint8_t textABFlag : 1; // Do something if it chanhes from binary "0" to binary "1" or vice-versa
659  uint8_t programType : 5; // PTY (Program Type) code
660  uint8_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
661  uint8_t versionCode : 1; // (B0) => 0=A; 1=B
662  uint8_t groupType : 4; // Group Type code.
663  } group2;
664  struct
665  {
666  uint8_t content : 4; // Depends on Group Type and Version codes.
667  uint8_t textABFlag : 1; // Do something if it chanhes from binary "0" to binary "1" or vice-versa
668  uint8_t programType : 5; // PTY (Program Type) code
669  uint8_t trafficProgramCode : 1; // (TP) => 0 = No Traffic Alerts; 1 = Station gives Traffic Alerts
670  uint8_t versionCode : 1; // (B0) => 0=A; 1=B
671  uint8_t groupType : 4; // Group Type code.
672  } refined;
673  bk_reg0d blockB;
674 } bk_rds_blockb;
675 
676 /**
677  * @ingroup GA01
678  * Group RDS type 4A ( RDS Date and Time)
679  * When group type 4A is used by the station, it shall be transmitted every minute according to EN 50067.
680  * This Structure uses blocks 2,3 and 5 (B,C,D)
681  *
682  * ATTENTION:
683  * To make it compatible with 8, 16 and 32 bits platforms and avoid Crosses boundary, it was necessary to
684  * split minute and hour representation.
685  */
686 typedef union
687 {
688  struct
689  {
690  uint8_t offset : 5; // Local Time Offset
691  uint8_t offset_sense : 1; // Local Offset Sign ( 0 = + , 1 = - )
692  uint8_t minute1 : 2; // UTC Minutes - 2 bits less significant (void “Crosses boundary”).
693  uint8_t minute2 : 4; // UTC Minutes - 4 bits more significant (void “Crosses boundary”)
694  uint8_t hour1 : 4; // UTC Hours - 4 bits less significant (void “Crosses boundary”)
695  uint8_t hour2 : 1; // UTC Hours - 4 bits more significant (void “Crosses boundary”)
696  uint32_t mjd : 17; // Modified Julian Day Code
697  } refined;
699 } bk_rds_date_time;
700 
701 /**
702  * @ingroup GA01
703  * @brief Converts 16 bits word to two bytes
704  */
705 typedef union
706 {
707  struct
708  {
709  uint8_t lowByte;
710  uint8_t highByte;
711  } refined;
713 } word16_to_bytes;
714 
715 
716 
717 /**
718  * @ingroup GA01
719  * @brief KT0915 Class
720  * @details This class implements all functions that will help you to control the KT0915 devices.
721  *
722  * @author PU2CLR - Ricardo Lima Caratti
723  */
724 class BK108X
725 {
726 
727 private:
728 
729  uint8_t i2cBuffer[32];
730 
731  uint16_t shadowRegisters[32]; //!< shadow registers 0x00 to 0x1F (0 - 31)
732 
733  // Device registers map - References to the shadow registers
734  bk_reg00 *reg00 = (bk_reg00 *)&shadowRegisters[REG00];
735  bk_reg01 *reg01 = (bk_reg01 *)&shadowRegisters[REG01];
736  bk_reg02 *reg02 = (bk_reg02 *)&shadowRegisters[REG02];
737  bk_reg03 *reg03 = (bk_reg03 *)&shadowRegisters[REG03];
738  bk_reg04 *reg04 = (bk_reg04 *)&shadowRegisters[REG04];
739  bk_reg05 *reg05 = (bk_reg05 *)&shadowRegisters[REG05];
740  bk_reg06 *reg06 = (bk_reg06 *)&shadowRegisters[REG06];
741  bk_reg07 *reg07 = (bk_reg07 *)&shadowRegisters[REG07];
742  bk_reg08 *reg08 = (bk_reg08 *)&shadowRegisters[REG08];
743  bk_reg09 *reg09 = (bk_reg09 *)&shadowRegisters[REG09];
744  bk_reg0a *reg0a = (bk_reg0a *)&shadowRegisters[REG0A];
745  bk_reg0b *reg0b = (bk_reg0b *)&shadowRegisters[REG0B];
746  bk_reg0c *reg0c = (bk_reg0c *)&shadowRegisters[REG0C];
747  bk_reg0d *reg0d = (bk_reg0d *)&shadowRegisters[REG0D];
748  bk_reg0e *reg0e = (bk_reg0e *)&shadowRegisters[REG0E];
749  bk_reg0f *reg0f = (bk_reg0f *)&shadowRegisters[REG0F];
750  bk_reg10 *reg10 = (bk_reg10 *)&shadowRegisters[REG10];
751  bk_reg11 *reg11 = (bk_reg11 *)&shadowRegisters[REG11];
752  bk_reg12 *reg12 = (bk_reg12 *)&shadowRegisters[REG12];
753  bk_reg13 *reg13 = (bk_reg13 *)&shadowRegisters[REG13];
754  bk_reg14 *reg14 = (bk_reg14 *)&shadowRegisters[REG14];
755  bk_reg15 *reg15 = (bk_reg15 *)&shadowRegisters[REG15];
756  bk_reg16 *reg16 = (bk_reg16 *)&shadowRegisters[REG16];
757  bk_reg17 *reg17 = (bk_reg17 *)&shadowRegisters[REG17];
758  bk_reg18 *reg18 = (bk_reg18 *)&shadowRegisters[REG18];
759  bk_reg19 *reg19 = (bk_reg19 *)&shadowRegisters[REG19];
760  bk_reg1A *reg1A = (bk_reg1A *)&shadowRegisters[REG1A];
761  bk_reg1B *reg1b = (bk_reg1B *)&shadowRegisters[REG1B];
762  bk_reg1C *reg1c = (bk_reg1C *)&shadowRegisters[REG1C];
763  bk_reg1D *reg1d = (bk_reg1D *)&shadowRegisters[REG1D];
764  bk_reg1E *reg1e = (bk_reg1E *)&shadowRegisters[REG1E];
765  bk_reg1F *reg1f = (bk_reg1F *)&shadowRegisters[REG1F];
766 
767  uint16_t fmStartBand[4] = {6400, 7400, 7600, 8700}; //!< Start FM band limit
768  uint16_t fmEndBand[4] = {10800, 7600, 9100, 10800}; //!< End FM band limit
769  uint16_t fmSpace[4] = {1, 5, 10, 20}; //!< FM channel space
770 
771  uint16_t amStartBand[4] = {153, 520, 2300, 522}; //!< Start FM band limit
772  uint16_t amEndBand[4] = {279, 1710, 21850, 1710}; //!< End FM band limit
773  uint16_t amSpace[4] = {1, 5, 9, 10}; //!< AM channel space
774 
775  int pin_sdio, pin_sclk;
776 
777 protected:
778  char rds_buffer2A[65]; //!< RDS Radio Text buffer - Program Information
779  char rds_buffer2B[33]; //!< RDS Radio Text buffer - Station Informaation
780  char rds_buffer0A[9]; //!< RDS Basic tuning and switching information (Type 0 groups)
781  char rds_time[20]; //!< RDS date time received information
782 
784 
788 
796 
798  int rdsInterruptPin = -1;
802 
803 
804 public:
805  void setI2C(uint8_t i2c_addr = I2C_DEVICE_ADDR);
806  void i2cInit(int pin_sdio, int pin_sclk);
807  void i2cBeginTransaction();
808  void i2cEndTransaction();
809  void i2cAck();
810  void i2cNack();
812  void i2cWriteByte(uint8_t data);
814  void writeRegister(uint8_t reg,uint16_t vakue);
816 
817  void reset();
818  void powerUp();
819  void powerDown();
820  void waitAndFinishTune();
821 
822 
823 
824  /**
825  * @ingroup GA03
826  * @brief Sets the I2C bus address
827  * @details This function must to be called before setup function if your device are not using 0x10 (default)
828  * @param bus_addr I2C buss address
829  */
830  inline void setI2CAddress(int bus_addr) { this->deviceAddress = bus_addr; };
831 
832  /**
833  * @ingroup GA03
834  * @brief Set the Delay After Crystal On (default 500ms)
835  *
836  * @param ms_value Value in milliseconds
837  */
838  inline void setDelayAfterCrystalOn(uint8_t ms_value) { maxDelayAftarCrystalOn = ms_value; };
839 
841  void setRegister(uint8_t reg, uint16_t value);
842  bk_reg0a getStatus();
843 
844  /**
845  * @ingroup GA03
846  * @brief Get the Shadown Register object
847  * @details if you want to get the current value of the device register, call getAllRegisters() before calling this function.
848  * @details if you are dealing with the status register (0x0A), you can call getStatus() instead getAllRegisters().
849  * @see setAllRegisters, getAllRegisters, getShadownRegister, getStatus
850  * @param register_number
851  * @return 16 bits word with the Shadown registert
852  */
853  inline uint16_t getShadownRegister(uint8_t register_number) { return shadowRegisters[register_number]; };
854 
855  /**
856  * @ingroup GA03
857  * @brief Sets a given value to the Shadown Register
858  * @details You have to call setAllRegisters() after setting the Shadow Registers to store the value into the device.
859  * @see setAllRegisters, getAllRegisters, getShadownRegister, getStatus
860  * @param register_number register index (from 0x00 to 0x0F)
861  * @param value 16 bits word with the content of the register
862  */
863  void setShadownRegister(uint8_t register_number, uint16_t value)
864  {
865  if (register_number > 0x0F)
866  return;
867  shadowRegisters[register_number] = value;
868  };
869 
872 
873  void setup(int sda_pin, int sclk_pin, int rdsInterruptPin = -1, int seekInterruptPin = -1, uint8_t oscillator_type = OSCILLATOR_TYPE_CRYSTAL);
874 
875  void setFM(uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step);
876  void setAM(uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step, uint16_t am_space = 0);
877 
878  /**
879  * @ingroup GA03
880  * @brief Get the Current Mode (AM or FM)
881  *
882  * @return uint8_t 0 = FM; 1 = AM
883  */
884  inline uint8_t getCurrentMode() { return this->currentMode; };
885 
886  void setFrequency(uint16_t frequency);
887  void setFrequencyUp();
888  void setFrequencyDown();
893  void setChannel(uint16_t channel);
894  void seek(uint8_t seek_mode, uint8_t direction);
895  void seek(uint8_t seek_mode, uint8_t direction, void (*showFunc)());
896  void setSeekThreshold(uint8_t value);
897 
898  void setBand(uint8_t band = 1);
899  void setSpace(uint8_t space = 0);
900  int getRssi();
901 
902  void setSoftmute(bool value);
903  void setSoftmuteAttack(uint8_t value);
904  void setSoftmuteAttenuation(uint8_t value);
905  void setAgc(bool value);
906 
907  void setMono(bool value);
908 
909  bool isStereo();
910 
911  void setMute(bool value);
912  void setVolume(uint8_t value);
913  uint8_t getVolume();
914  void setVolumeUp();
915  void setVolumeDown();
916  void setExtendedVolumeRange(bool value);
917 
918  void setFmDeemphasis(uint8_t de);
919 
920  void getRdsStatus();
921  void setRdsMode(uint8_t rds_mode = 0);
922  void setRds(bool value);
923  inline void setRDS(bool value) { setRds(value); };
924  bool getRdsReady();
925 
926  uint8_t getRdsFlagAB(void);
930  void getNext2Block(char *c);
931  void getNext4Block(char *c);
932  char *getRdsText(void);
933  char *getRdsText0A(void);
934  char *getRdsText2A(void);
935  char *getRdsText2B(void);
936  char *getRdsTime();
937  bool getRdsSync();
938 };
REG08
#define REG08
Definition: BK108X.h:58
BK108X::getRdsText
char * getRdsText(void)
Gets the RDS Text when the message is of the Group Type 2 version A.
Definition: BK108X.cpp:988
REG14
#define REG14
Definition: BK108X.h:70
BK108X::rds_buffer0A
char rds_buffer0A[9]
RDS Basic tuning and switching information (Type 0 groups)
Definition: BK108X.h:780
BK108X::setFM
void setFM(uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step)
Sets the receiver to FM mode.
Definition: BK108X.cpp:435
bk_reg0a::raw
uint16_t raw
Definition: BK108X.h:348
REG18
#define REG18
Definition: BK108X.h:74
bk_reg11::raw
uint16_t raw
Definition: BK108X.h:450
bk_reg16::raw
uint16_t raw
Definition: BK108X.h:522
BK108X::i2cInit
void i2cInit(int pin_sdio, int pin_sclk)
Sets the MCU pins connected to the I2C bus.
Definition: BK108X.cpp:54
bk_reg1C::raw
uint16_t raw
Definition: BK108X.h:606
bk_reg10::raw
uint16_t raw
Definition: BK108X.h:436
BK108X::readRegister
uint16_t readRegister(uint8_t reg)
Gets an array of values from a BK108X given register.
Definition: BK108X.cpp:235
BK108X::setBand
void setBand(uint8_t band=1)
Sets the FM Band
Definition: BK108X.cpp:681
bk_reg1E
uint16_t bk_reg1E
Definition: BK108X.h:623
BK108X::isStereo
bool isStereo()
Checks stereo / mono status.
Definition: BK108X.cpp:776
BK108X::getChannel
uint16_t getChannel()
Gets the current channel.
Definition: BK108X.cpp:577
BK108X::getRdsTime
char * getRdsTime()
Gets the RDS time and date when the Group type is 4.
Definition: BK108X.cpp:1033
BK108X::getRdsText2A
char * getRdsText2A(void)
Gets the Text processed for the 2A group.
Definition: BK108X.cpp:1013
BK108X::i2cReceiveAck
uint8_t i2cReceiveAck()
Gets Acknowledge (ACK)
Definition: BK108X.cpp:136
bk_reg0c::raw
uint16_t raw
Definition: BK108X.h:377
BK108X::setI2CAddress
void setI2CAddress(int bus_addr)
Sets the I2C bus address.
Definition: BK108X.h:830
bk_reg08::raw
uint16_t raw
Definition: BK108X.h:315
BK108X::seek
void seek(uint8_t seek_mode, uint8_t direction)
Seek function.
Definition: BK108X.cpp:621
BK108X::currentMode
uint8_t currentMode
Definition: BK108X.h:795
BK108X::i2cAck
void i2cAck()
Sends Acknowledge (ACK)
Definition: BK108X.cpp:102
BK108X::currentVolume
uint8_t currentVolume
Definition: BK108X.h:797
REG03
#define REG03
Definition: BK108X.h:53
BK108X::setExtendedVolumeRange
void setExtendedVolumeRange(bool value)
Sets Extended Volume Range.
Definition: BK108X.cpp:841
BK108X::setRDS
void setRDS(bool value)
Definition: BK108X.h:923
BK108X::getDeviceId
uint16_t getDeviceId()
Returns the Device Indentifiction.
Definition: BK108X.cpp:302
bk_reg02::raw
uint16_t raw
Definition: BK108X.h:146
word16_to_bytes::raw
uint16_t raw
Definition: BK108X.h:712
BK108X::i2cBeginTransaction
void i2cBeginTransaction()
Starts the I2C bus transaction
Definition: BK108X.cpp:63
BK108X::oscillatorType
int oscillatorType
Definition: BK108X.h:800
bk_reg19::raw
uint16_t raw
Definition: BK108X.h:564
BK108X::powerDown
void powerDown()
Powers the receiver off.
Definition: BK108X.cpp:392
REG15
#define REG15
Definition: BK108X.h:71
bk_reg03::raw
uint16_t raw
Definition: BK108X.h:162
BK108X::getNext4Block
void getNext4Block(char *c)
Process data received from group 2A.
Definition: BK108X.cpp:977
REG04
#define REG04
Definition: BK108X.h:54
BK108X::getRealFrequency
uint16_t getRealFrequency()
Gets the frequency based on READCHAN register (0x0B)
Definition: BK108X.cpp:601
REG1B
#define REG1B
Definition: BK108X.h:77
bk_reg0d::raw
uint16_t raw
Definition: BK108X.h:392
BK108X::rdsInterruptPin
int rdsInterruptPin
Definition: BK108X.h:798
BK108X::setFrequency
void setFrequency(uint16_t frequency)
Sets the FM frequency.
Definition: BK108X.cpp:518
BK108X::setDelayAfterCrystalOn
void setDelayAfterCrystalOn(uint8_t ms_value)
Set the Delay After Crystal On (default 500ms)
Definition: BK108X.h:838
bk_reg1A::raw
uint16_t raw
Definition: BK108X.h:578
REG10
#define REG10
Definition: BK108X.h:66
BK108X::setShadownRegister
void setShadownRegister(uint8_t register_number, uint16_t value)
Sets a given value to the Shadown Register.
Definition: BK108X.h:863
BK108X::getRssi
int getRssi()
Gets the Rssi.
Definition: BK108X.cpp:701
REG0F
#define REG0F
Definition: BK108X.h:65
REG1F
#define REG1F
Definition: BK108X.h:81
BK108X::currentFrequency
uint32_t currentFrequency
Definition: BK108X.h:785
BK108X::rds_buffer2A
char rds_buffer2A[65]
RDS Radio Text buffer - Program Information.
Definition: BK108X.h:778
REG13
#define REG13
Definition: BK108X.h:69
BK108X::seek
void seek(uint8_t seek_mode, uint8_t direction, void(*showFunc)())
Seek function.
Definition: BK108X.cpp:659
BK108X::seekInterruptPin
int seekInterruptPin
Definition: BK108X.h:799
BK108X::setMute
void setMute(bool value)
Sets the Mute true or false.
Definition: BK108X.cpp:754
BK108X::getRdsVersionCode
uint8_t getRdsVersionCode(void)
Gets the version code (extracted from the Block B)
Definition: BK108X.cpp:943
bk_reg0e::raw
uint16_t raw
Definition: BK108X.h:407
bk_reg15::raw
uint16_t raw
Definition: BK108X.h:508
BK108X::getRdsText0A
char * getRdsText0A(void)
Gets the station name and other messages.
Definition: BK108X.cpp:1001
BK108X::i2cReadByte
uint8_t i2cReadByte()
Gets a Byte from the slave device.
Definition: BK108X.cpp:180
BK108X::setSpace
void setSpace(uint8_t space=0)
Sets the FM Space
Definition: BK108X.cpp:690
BK108X::getRealChannel
uint16_t getRealChannel()
Gets the current channel stored in register 0x0B.
Definition: BK108X.cpp:588
BK108X::getRdsSync
bool getRdsSync()
Get the Rds Sync.
Definition: BK108X.cpp:1044
BK108X::currentChannel
uint16_t currentChannel
Definition: BK108X.h:789
BK108X::setSoftmuteAttenuation
void setSoftmuteAttenuation(uint8_t value)
Sets Softmute Attenuation..
Definition: BK108X.cpp:733
BK108X::getChipId
uint16_t getChipId()
Returns the Chip Indentifiction.
Definition: BK108X.cpp:312
bk_reg05::raw
uint16_t raw
Definition: BK108X.h:235
BK108X::getRegister
uint16_t getRegister(uint8_t reg)
Gets a givens current register content of the device.
Definition: BK108X.cpp:271
BK108X::setChannel
void setChannel(uint16_t channel)
Sets the channel.
Definition: BK108X.cpp:497
REG0C
#define REG0C
Definition: BK108X.h:62
REG17
#define REG17
Definition: BK108X.h:73
BK108X::minimumFrequency
uint32_t minimumFrequency
Definition: BK108X.h:786
OSCILLATOR_TYPE_CRYSTAL
#define OSCILLATOR_TYPE_CRYSTAL
Definition: BK108X.h:27
BK108X::writeRegister
void writeRegister(uint8_t reg, uint16_t vakue)
Sends an array of values to a BK108X given register.
Definition: BK108X.cpp:207
REG19
#define REG19
Definition: BK108X.h:75
BK108X::setVolumeDown
void setVolumeDown()
Decrements the audio volume.
Definition: BK108X.cpp:827
BK108X::waitAndFinishTune
void waitAndFinishTune()
Wait STC (Seek/Tune Complete) status becomes 0.
Definition: BK108X.cpp:332
BK108X::currentFMBand
uint8_t currentFMBand
Definition: BK108X.h:791
BK108X::getNext2Block
void getNext2Block(char *c)
Process data received from group 2B.
Definition: BK108X.cpp:965
BK108X::setSoftmute
void setSoftmute(bool value)
Sets the Softmute true or false.
Definition: BK108X.cpp:711
bk_reg09::raw
uint16_t raw
Definition: BK108X.h:329
bk_reg1D::raw
uint16_t raw
//!< Reference clock divider control , FREQ_SEL[17:0] = HEX | Ref Frequency/512+0....
Definition: BK108X.h:620
bk_reg13::raw
uint16_t raw
Definition: BK108X.h:478
bk_reg06::raw
uint16_t raw
Definition: BK108X.h:273
BK108X::currentFMSpace
uint8_t currentFMSpace
Definition: BK108X.h:793
BK108X::deviceAddress
int deviceAddress
Definition: BK108X.h:783
BK108X::getRdsStatus
void getRdsStatus()
Gets the RDS registers information.
Definition: BK108X.cpp:872
BK108X::getFrequency
uint16_t getFrequency()
Gets the current frequency.
Definition: BK108X.cpp:567
BK108X::setFrequencyUp
void setFrequencyUp()
Increments the current frequency.
Definition: BK108X.cpp:537
BK108X::setSoftmuteAttack
void setSoftmuteAttack(uint8_t value)
Sets Softmute Attack/Recover Rate.
Definition: BK108X.cpp:722
bk_reg01::chipId
uint16_t chipId
Definition: BK108X.h:121
REG11
#define REG11
Definition: BK108X.h:67
BK108X::currentAMBand
uint8_t currentAMBand
Definition: BK108X.h:792
BK108X::reset
void reset()
Resets the device.
Definition: BK108X.cpp:348
BK108X::getRdsProgramType
uint8_t getRdsProgramType(void)
Returns the Program Type (extracted from the Block B)
Definition: BK108X.cpp:954
bk_reg0b::raw
uint16_t raw
Definition: BK108X.h:362
BK108X::setVolume
void setVolume(uint8_t value)
Sets the audio volume level.
Definition: BK108X.cpp:787
bk_reg12::raw
uint16_t raw
Definition: BK108X.h:464
REG1C
#define REG1C
Definition: BK108X.h:78
bk_reg07::raw
uint16_t raw
Definition: BK108X.h:293
REG1E
#define REG1E
Definition: BK108X.h:80
REG09
#define REG09
Definition: BK108X.h:59
BK108X::rds_time
char rds_time[20]
RDS date time received information.
Definition: BK108X.h:781
REG01
#define REG01
Definition: BK108X.h:51
BK108X::getRdsFlagAB
uint8_t getRdsFlagAB(void)
Returns the current Text Flag A/B
Definition: BK108X.cpp:921
REG12
#define REG12
Definition: BK108X.h:68
BK108X::getCurrentMode
uint8_t getCurrentMode()
Get the Current Mode (AM or FM)
Definition: BK108X.h:884
REG0B
#define REG0B
Definition: BK108X.h:61
BK108X::setFmDeemphasis
void setFmDeemphasis(uint8_t de)
Sets De-emphasis.
Definition: BK108X.cpp:855
BK108X::currentAMSpace
uint8_t currentAMSpace
Definition: BK108X.h:794
BK108X::maximumFrequency
uint32_t maximumFrequency
Definition: BK108X.h:787
bk_reg18::raw
uint16_t raw
Definition: BK108X.h:550
BK108X::powerUp
void powerUp()
Powers the receiver on.
Definition: BK108X.cpp:363
BK108X::getShadownRegister
uint16_t getShadownRegister(uint8_t register_number)
Get the Shadown Register object.
Definition: BK108X.h:853
bk_reg17::raw
uint16_t raw
Definition: BK108X.h:536
REG0D
#define REG0D
Definition: BK108X.h:63
MAX_DELAY_AFTER_OSCILLATOR
#define MAX_DELAY_AFTER_OSCILLATOR
Definition: BK108X.h:21
bk_reg14::raw
uint16_t raw
Definition: BK108X.h:494
BK108X::getVolume
uint8_t getVolume()
Gets the current audio volume level.
Definition: BK108X.cpp:803
BK108X::setup
void setup(int sda_pin, int sclk_pin, int rdsInterruptPin=-1, int seekInterruptPin=-1, uint8_t oscillator_type=OSCILLATOR_TYPE_CRYSTAL)
Starts the device.
Definition: BK108X.cpp:409
bk_reg1B::raw
uint16_t raw
Definition: BK108X.h:592
REG0A
#define REG0A
Definition: BK108X.h:60
bk_rds_date_time::raw
uint8_t raw[6]
Definition: BK108X.h:698
MODE_FM
#define MODE_FM
Definition: BK108X.h:47
BK108X::maxDelayAftarCrystalOn
uint16_t maxDelayAftarCrystalOn
Definition: BK108X.h:801
bk_reg1F
uint16_t bk_reg1F
Definition: BK108X.h:624
REG00
#define REG00
Definition: BK108X.h:50
BK108X::setFrequencyDown
void setFrequencyDown()
Decrements the current frequency.
Definition: BK108X.cpp:552
REG16
#define REG16
Definition: BK108X.h:72
BK108X::i2cNack
void i2cNack()
Sends Not Acknowledge (ACK)
Definition: BK108X.cpp:118
BK108X::setRdsMode
void setRdsMode(uint8_t rds_mode=0)
Sets the Rds Mode Standard or Verbose.
Definition: BK108X.cpp:883
REG1A
#define REG1A
Definition: BK108X.h:76
I2C_DEVICE_ADDR
#define I2C_DEVICE_ADDR
Definition: BK108X.h:23
BK108X::getStatus
bk_reg0a getStatus()
Definition: BK108X.cpp:321
BK108X::getRdsGroupType
uint16_t getRdsGroupType()
Return the group type.
Definition: BK108X.cpp:932
bk_rds_blockb::blockB
bk_reg0d blockB
Definition: BK108X.h:673
bk_reg00::deviceId
uint16_t deviceId
Definition: BK108X.h:106
REG05
#define REG05
Definition: BK108X.h:55
BK108X::currentStep
uint16_t currentStep
Definition: BK108X.h:790
BK108X::getRdsText2B
char * getRdsText2B(void)
Gets the Text processed for the 2B group.
Definition: BK108X.cpp:1023
REG0E
#define REG0E
Definition: BK108X.h:64
REG07
#define REG07
Definition: BK108X.h:57
BK108X::setAM
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.
Definition: BK108X.cpp:465
bk_reg0f::raw
uint16_t raw
Definition: BK108X.h:422
BK108X::setMono
void setMono(bool value)
Sets the Mono true or false (stereo)
Definition: BK108X.cpp:765
BK108X::i2cEndTransaction
void i2cEndTransaction()
Finish the I2C bus transaction.
Definition: BK108X.cpp:82
BK108X::setI2C
void setI2C(uint8_t i2c_addr=I2C_DEVICE_ADDR)
Sets I2C bus address.
Definition: BK108X.cpp:42
BK108X::setSeekThreshold
void setSeekThreshold(uint8_t value)
Sets RSSI Seek Threshold.
Definition: BK108X.cpp:669
REG06
#define REG06
Definition: BK108X.h:56
BK108X::setRds
void setRds(bool value)
Sets the RDS operation.
Definition: BK108X.cpp:895
REG1D
#define REG1D
Definition: BK108X.h:79
BK108X::setVolumeUp
void setVolumeUp()
Increments the audio volume.
Definition: BK108X.cpp:813
bk_reg04::raw
uint16_t raw
Definition: BK108X.h:199
REG02
#define REG02
Definition: BK108X.h:52
BK108X::setAgc
void setAgc(bool value)
Sets the AGC enable or disable.
Definition: BK108X.cpp:743
BK108X::setRegister
void setRegister(uint8_t reg, uint16_t value)
Sets a given value to the device registers.
Definition: BK108X.cpp:291
BK108X::i2cWriteByte
void i2cWriteByte(uint8_t data)
Sends a Byte to the slave device.
Definition: BK108X.cpp:158
BK108X::rds_buffer2B
char rds_buffer2B[33]
RDS Radio Text buffer - Station Informaation.
Definition: BK108X.h:779
BK108X::getRdsReady
bool getRdsReady()
Returns true if RDS Ready.
Definition: BK108X.cpp:909