2
3
4
5
6
7
8
9
10
11
12
13
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
37
38
39
40
41
42
45 this->deviceAddress = i2c_addr;
49
50
51
52
53
54
55
58 this->pin_sdio = pin_sdio;
59 this->pin_sclk = pin_sclk;
63
64
65
68 pinMode(
this->pin_sdio, OUTPUT);
69 pinMode(
this->pin_sclk, OUTPUT);
70 digitalWrite(
this->pin_sdio, HIGH);
71 digitalWrite(
this->pin_sclk, HIGH);
74 digitalWrite(
this->pin_sdio, LOW);
76 digitalWrite(
this->pin_sclk, LOW);
78 digitalWrite(
this->pin_sdio, HIGH);
82
83
84
87 pinMode(pin_sdio, OUTPUT);
88 digitalWrite(
this->pin_sdio, LOW);
91 digitalWrite(
this->pin_sclk, HIGH);
94 digitalWrite(
this->pin_sdio, HIGH);
99
100
101
102
103
104
107 pinMode(pin_sdio, OUTPUT);
108 digitalWrite(
this->pin_sclk, LOW);
109 digitalWrite(
this->pin_sdio, LOW);
110 delayMicroseconds(1);
111 digitalWrite(
this->pin_sclk, HIGH);
112 delayMicroseconds(1);
113 digitalWrite(
this->pin_sclk, LOW);
117
118
119
120
123 pinMode(pin_sdio, OUTPUT);
125 digitalWrite(
this->pin_sclk, LOW);
126 digitalWrite(
this->pin_sdio, HIGH);
127 delayMicroseconds(1);
128 digitalWrite(
this->pin_sclk, HIGH);
129 delayMicroseconds(1);
130 digitalWrite(
this->pin_sclk, LOW);
134
135
136
137
138
142 pinMode(pin_sdio, INPUT);
143 delayMicroseconds(1);
145 digitalWrite(
this->pin_sclk, HIGH);
146 delayMicroseconds(1);
148 ack = digitalRead(
this->pin_sdio);
150 digitalWrite(
this->pin_sclk, LOW);
151 delayMicroseconds(1);
157
158
159
160
163 pinMode(pin_sdio, OUTPUT);
164 delayMicroseconds(1);
166 for (
int i = 0; i < 8; i++)
169 digitalWrite(
this->pin_sdio, (
bool)(data &
this->deviceAddress));
171 delayMicroseconds(1);
172 digitalWrite(
this->pin_sclk, HIGH);
173 delayMicroseconds(1);
174 digitalWrite(
this->pin_sclk, LOW);
180
181
182
183
188 pinMode(pin_sdio, INPUT);
189 delayMicroseconds(1);
191 for (
int i = 0; i < 8; i++)
193 digitalWrite(
this->pin_sclk, HIGH);
195 delayMicroseconds(1);
196 if (digitalRead(
this->pin_sdio))
198 digitalWrite(
this->pin_sclk, LOW);
199 delayMicroseconds(1);
206
207
208
209
210
214 word16_to_bytes data;
219 this->i2cReceiveAck();
223 this->i2cWriteByte(reg);
224 this->i2cReceiveAck();
226 this->i2cWriteByte(data.refined.highByte);
227 this->i2cReceiveAck();
228 this->i2cWriteByte(data.refined.lowByte);
229 this->i2cReceiveAck();
235
236
237
238
239
243 word16_to_bytes data;
247 this->i2cReceiveAck();
249 reg = (reg << 1) | 1;
251 this->i2cWriteByte(reg);
252 this->i2cReceiveAck();
254 data.refined.highByte =
this->i2cReadByte();
256 data.refined.lowByte =
this->i2cReadByte();
265
266
267
270
271
272
273
274
275
278 uint16_t reg_content;
279 reg_content =
this->readRegister(reg);
280 shadowRegisters[reg] = reg_content;
285
286
287
288
289
290
291
292
293
294
295
298 this->writeRegister(reg, value);
299 shadowRegisters[reg] = value;
300 delayMicroseconds(250);
304
305
306
309 return getRegister(
REG00);
313
314
315
316
319 return getRegister(
REG01);
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
344 tmp.raw = getRegister(
REG0A);
349
350
351
352
353
356 while (reg0a->refined.STC == 0)
362 reg03->refined.TUNE = 0;
363 setRegister(
REG03, reg03->raw);
368
369
370
373 reg02->refined.DISABLE = 1;
374 reg02->refined.ENABLE = 0;
375 setRegister(
REG02, reg02->raw);
376 reg02->refined.DISABLE = 0;
377 reg02->refined.ENABLE = 1;
378 setRegister(
REG02, reg02->raw);
382
383
384
385
386
387
397 reg02->refined.DISABLE = 0;
398 reg02->refined.ENABLE = 1;
399 setRegister(
REG02, reg02->raw);
401 setRegister(
REG03, 0x0000);
403 setRegister(
REG04, 0x60D4);
404 setRegister(
REG05, 0x37CF);
407 reg06->refined.CLKSEL =
this->oscillatorType;
408 setRegister(
REG06, reg06->raw);
410 setRegister(
REG07, 0x0101);
411 setRegister(
REG08, 0xAC90);
413 setRegister(
REG10, 0x7B11);
414 setRegister(
REG11, 0x004A);
415 setRegister(
REG12, 0x4000);
416 setRegister(
REG13, 0x3E00);
417 setRegister(
REG14, 0xC29A);
418 setRegister(
REG15, 0x79F8);
419 setRegister(
REG16, 0x4012);
421 setRegister(
REG17, 0x0040);
423 setRegister(
REG18, 0x341C);
424 setRegister(
REG19, 0x0080);
425 setRegister(
REG1A, 0x0000);
426 setRegister(
REG1B, 0x4CA2);
428 setRegister(
REG1C, 0x8820);
429 setRegister(
REG1D, 0x0200);
433 uint32_t bk_number = (oscillatorFrequency / 512) + 0.5;
434 uint16_t final_result;
438 reg1c->refined.FREQ_SEL = (bk_number >> 16);
439 setRegister(
REG1C, reg1c->raw);
441 final_result = bk_number & 0b001111111111111111;
448 setRegister(
REG1D, final_result);
453 delay(
this->maxDelayAfterCrystalOn);
457
458
459
462 reg02->refined.DISABLE = 1;
463 reg02->refined.ENABLE = 0;
464 setRegister(
REG02, reg02->raw);
470
471
472
473
474
475
476
477
478
479
480void BK108X::
setup(
int sda_pin,
int sclk_pin, uint8_t oscillator_type, uint32_t oscillator_frequency)
484 this->oscillatorType = oscillator_type;
485 this->oscillatorFrequency = oscillator_frequency;
491
492
493
494
495
496
497
498
499
500void BK108X::
setFM(uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step)
502 this->currentStep = step;
503 this->currentFrequency = default_frequency;
504 this->minimumFrequency = minimum_frequency;
505 this->maximumFrequency = maximum_frequency;
509 setRegister(
REG07, reg07->raw);
512 this->currentFMBand = reg05->refined.BAND = 0;
513 this->currentFMSpace = reg05->refined.SPACE = 2;
514 setRegister(
REG05, reg05->raw);
515 setFrequency(default_frequency);
519
520
521
522
523
524
525
526
527
528
529
530void BK108X::
setAM(uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step, uint16_t am_space)
532 this->currentStep = step;
533 this->currentFrequency = default_frequency;
534 this->minimumFrequency = minimum_frequency;
535 this->maximumFrequency = maximum_frequency;
537 this->currentMode = reg07->refined.MODE =
BK_MODE_AM;
538 setRegister(
REG07, reg07->raw);
542 if (minimum_frequency < 520)
543 this->currentAMBand = reg05->refined.BAND = 0;
544 else if (minimum_frequency < 1800)
545 this->currentAMBand = reg05->refined.BAND = 1;
547 this->currentAMBand = reg05->refined.BAND = 2;
549 this->currentAMSpace = reg05->refined.SPACE = am_space;
551 setRegister(
REG05, reg05->raw);
552 this->setFrequency(default_frequency);
556
557
558
559
562 reg02->refined.SEEK = 0;
563 setRegister(
REG02, reg02->raw);
565 reg03->refined.TUNE = 1;
566 reg03->refined.CHAN = channel;
568 setRegister(
REG03, reg03->raw);
572 this->currentChannel = channel;
576
577
578
579
580
587 channel = (frequency -
this->fmStartBand[
this->currentFMBand]) /
this->fmSpace[
this->currentFMSpace];
591 channel = (frequency -
this->amStartBand[
this->currentAMBand]) /
this->amSpace[
this->currentAMSpace];
594 this->setChannel(channel);
598
599
600
601
604 this->currentFrequency +=
this->currentStep;
606 if (
this->currentFrequency >
this->maximumFrequency)
607 this->currentFrequency =
this->minimumFrequency;
609 setFrequency(
this->currentFrequency);
613
614
615
616
619 this->currentFrequency -=
this->currentStep;
621 if (
this->currentFrequency <
this->minimumFrequency)
622 this->currentFrequency =
this->maximumFrequency;
624 setFrequency(
this->currentFrequency);
628
629
630
631
634 return this->currentFrequency;
638
639
640
641
644 return this->currentChannel;
648
649
650
651
652
656 return reg0b->refined.READCHAN;
660
661
662
663
664
665
670 return getRealChannel() *
this->amSpace[
this->currentAMSpace] +
this->amStartBand[
this->currentAMBand];
674 return getRealChannel() *
this->fmSpace[
this->currentFMSpace] +
this->fmStartBand[
this->currentFMBand];
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
714 long max_time = millis();
718 reg03->refined.TUNE = 0;
719 setRegister(
REG03, reg03->raw);
721 reg02->refined.SKMODE = seek_mode;
722 reg02->refined.SEEKUP = direction;
723 reg02->refined.SEEK = 1;
724 setRegister(
REG02, reg02->raw);
726 if (showFunc != NULL)
728 this->currentFrequency = getRealFrequency();
732 }
while ((!reg0a->refined.STC && reg0a->refined.SF_BL) && (millis() - max_time) <
MAX_SEEK_TIME);
734 reg02->refined.SEEK = 0;
735 reg03->refined.TUNE = 0;
736 setRegister(
REG02, reg02->raw);
737 setRegister(
REG03, reg03->raw);
739 this->currentFrequency = getRealFrequency();
743
744
745
746
747
748
749
753 long max_time = millis();
757 reg03->refined.TUNE = 0;
758 setRegister(
REG03, reg03->raw);
760 reg02->refined.SKMODE = seek_mode;
761 reg02->refined.SEEKUP = direction;
762 reg02->refined.SKAFCRL = 1;
763 reg02->refined.SEEK = 1;
764 setRegister(
REG02, reg02->raw);
766 while (reg0a->refined.STC == 0 && (millis() - max_time) <
MAX_SEEK_TIME)
768 if (showFunc != NULL)
770 this->currentFrequency = getRealFrequency();
776 reg02->refined.SEEK = 0;
777 setRegister(
REG02, reg02->raw);
780 this->setChannel(
this->getRealChannel());
781 this->currentFrequency = getRealFrequency();
782 this->setFrequency(
this->currentFrequency);
784 }
while (reg0a->refined.SF_BL != 0 && (millis() - max_time) <
MAX_SEEK_TIME);
785 reg03->refined.TUNE = 0;
786 setRegister(
REG03, reg03->raw);
790
791
792
793
794
795
798 reg05->refined.SEEKTH = rssiValue;
799 setRegister(
REG05, reg05->raw);
801 reg06->refined.SKSNR = snrValue;
802 setRegister(
REG06, reg06->raw);
806
807
808
809
810
811
812
813
814
815
816
817
818
819
824 this->currentAMBand = band;
826 this->currentFMBand = band;
828 reg05->refined.BAND = band;
829 setRegister(
REG05, reg05->raw);
833
834
835
836
837
838
839
840
841
842
843
844
845
849 this->currentAMSpace = space;
851 this->currentFMSpace = space;
853 reg05->refined.SPACE = space;
854 setRegister(
REG05, reg05->raw);
858
859
860
861
862
866 return reg0a->refined.RSSI;
870
871
872
873
874
878 return reg09->refined.SNR;
882
883
884
885
886
889 reg02->refined.DSMUTE = !value;
890 setRegister(
REG02, reg02->raw);
894
895
896
897
898
899
900
901
902
903
904
905
906
907
910 reg06->refined.SMUTER = value;
911 setRegister(
REG06, reg06->raw);
915
916
917
918
919
920
921
922
923
924
925
926
929 reg06->refined.SMUTEA = value;
930 setRegister(
REG06, reg06->raw);
934
935
936
937
938
939
940
943 reg14->refined.RSSIMTH = rssi;
944 reg14->refined.SNRMTH = snr;
945 setRegister(
REG14, reg14->raw);
949
950
951
952
953
956 reg14->refined.SKMUTE = value;
957 setRegister(
REG14, reg14->raw);
961
962
963
964
965
968 reg14->refined.AFCMUTE = value;
969 setRegister(
REG14, reg14->raw);
973
974
975
976
977
978
981 reg02->refined.MUTEL = left;
982 reg02->refined.MUTER = right;
983 setRegister(
REG02, reg02->raw);
987
988
989
990
991
998
999
1000
1001
1002
1005 reg02->refined.MONO = value;
1006 reg02->refined.STEREO = !value;
1007 setRegister(
REG02, reg02->raw);
1011
1012
1013
1014
1015
1016
1020 return reg0a->refined.STEN;
1024
1025
1026
1027
1028
1033 this->currentVolume = value;
1035 reg05->refined.VOLUME = value;
1037 setRegister(
REG05, reg05->raw);
1041
1042
1043
1044
1045
1048 return this->currentVolume;
1052
1053
1054
1055
1058 if (
this->currentVolume < 31)
1060 this->currentVolume++;
1061 setVolume(
this->currentVolume);
1066
1067
1068
1069
1072 if (
this->currentVolume > 0)
1074 this->currentVolume--;
1075 setVolume(
this->currentVolume);
1080
1081
1082
1086
1087
1088
1089
1090
1093 this->rds_mode = rds_mode;
1097
1098
1099
1100
1101
1102
1103
1104
1107 reg04->refined.RDSEN = value;
1108 if ( interrupt_enable ) {
1109 reg04->refined.RDSIEN = interrupt_enable;
1110 reg04->refined.GPIO2 = 1;
1112 setRegister(
REG04, reg04->raw);
1116
1117
1118
1119
1120
1121
1122
1123
1127 if (!reg0a->refined.RDSR)
1137
1138
1139
1140
1141
1142
1146 blkb.blockB = reg0d->raw;
1147 return blkb.refined.textABFlag;
1151
1152
1153
1154
1155
1159 b.blockB = reg0d->raw;
1160 return b.refined.groupType;
1164
1165
1166
1167
1168
1169
1173 b.blockB = reg0d->raw;
1174 return b.refined.versionCode;
1178
1179
1180
1181
1182
1183
1187 b.blockB = reg0d->raw;
1188 return b.refined.programType;
1192
1193
1194
1195
1196
1197
1198
1199
1202 c[1] = reg0f->refined.lowByte;
1203 c[0] = reg0f->refined.highByte;
1207
1208
1209
1210
1211
1212
1215 c[0] = reg0e->refined.highByte;
1216 c[1] = reg0e->refined.lowByte;
1217 c[2] = reg0f->refined.highByte;
1218 c[3] = reg0f->refined.lowByte;
1222
1223
1224
1225
1226
1233
1234
1235
1236
1237
1238
1239
1240
1243 static int rdsTextAdress0A;
1246 blkb.blockB = reg0d->raw;
1248 if (blkb.group0.groupType == 0)
1251 rdsTextAdress0A = blkb.group0.address;
1252 if (rdsTextAdress0A >= 0 && rdsTextAdress0A < 4)
1263
1264
1265
1266
1267
1268
1271 static int rdsTextAdress2A;
1274 blkb.blockB = reg0d->raw;
1275 rdsTextAdress2A = blkb.group2.address;
1277 if (blkb.group2.groupType == 2)
1281 if (rdsTextAdress2A >= 0 && rdsTextAdress2A < 16)
1292
1293
1294
1295
1298 static int rdsTextAdress2B;
1301 blkb.blockB = reg0d->raw;
1302 if (blkb.group2.groupType == 1)
1305 rdsTextAdress2B = blkb.group2.address;
1306 if (rdsTextAdress2B >= 0 && rdsTextAdress2B < 16)
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340bool BK108X::
getRdsAllData(
char **stationName,
char **stationInformation,
char **programInformation,
char **utcTime)
1350 return (
bool)stationName | (
bool)stationInformation | (
bool)programInformation | (
bool)utcTime;
1354
1355
1356
1357
1360 bk_rds_date_time dt;
1361 word16_to_bytes blk_b, blk_c, blk_d;
1364 blk_b.raw = blkb.blockB = reg0d->raw;
1365 blk_c.raw = reg0e->raw;
1366 blk_d.raw = reg0f->raw;
1371 if (blkb.group0.groupType == 4)
1379 dt.raw[4] = blk_b.refined.lowByte;
1380 dt.raw[5] = blk_b.refined.highByte;
1382 dt.raw[2] = blk_c.refined.lowByte;
1383 dt.raw[3] = blk_c.refined.highByte;
1385 dt.raw[0] = blk_d.refined.lowByte;
1386 dt.raw[1] = blk_d.refined.highByte;
1388 minute = dt.refined.minute;
1389 hour = dt.refined.hour;
1391 offset_sign = (dt.refined.offset_sense == 1) ?
'+' :
'-';
1392 offset_h = (dt.refined.offset * 30) / 60;
1393 offset_m = (dt.refined.offset * 30) - (offset_h * 60);
1396 if (offset_h > 12 || offset_m > 60 || hour > 24 || minute > 60)
1399 this->convertToChar(hour, rds_time, 2, 0,
' ',
false);
1401 this->convertToChar(minute, &rds_time[3], 2, 0,
' ',
false);
1404 this->convertToChar(offset_h, &
rds_time[7], 2, 0,
' ',
false);
1406 this->convertToChar(offset_m, &
rds_time[10], 2, 0,
' ',
false);
1416
1417
1418
1419
1420
1421
1422
1423
1426 bk_rds_date_time dt;
1427 word16_to_bytes blk_b, blk_c, blk_d;
1430 blk_b.raw = blkb.blockB = reg0d->raw;
1431 blk_c.raw = reg0e->raw;
1432 blk_d.raw = reg0f->raw;
1438 if (blkb.group0.groupType == 4)
1443 dt.raw[4] = blk_b.refined.lowByte;
1444 dt.raw[5] = blk_b.refined.highByte;
1446 dt.raw[2] = blk_c.refined.lowByte;
1447 dt.raw[3] = blk_c.refined.highByte;
1449 dt.raw[0] = blk_d.refined.lowByte;
1450 dt.raw[1] = blk_d.refined.highByte;
1452 minute = dt.refined.minute;
1453 hour = dt.refined.hour;
1455 offset_h = (dt.refined.offset * 30) / 60;
1456 offset_m = (dt.refined.offset * 30) - (offset_h * 60);
1458 localTime = (hour * 60 + minute);
1459 if (dt.refined.offset_sense == 1)
1460 localTime -= (offset_h * 60 + offset_m);
1462 localTime += (offset_h * 60 + offset_m);
1464 hour = localTime / 60;
1465 minute = localTime - (hour * 60);
1467 if (hour > 24 || minute > 60)
1470 this->convertToChar(hour, rds_time, 2, 0,
' ',
false);
1472 this->convertToChar(minute, &rds_time[3], 2, 0,
' ',
false);
1482
1483
1484
1485
1486
1493
1494
1495
1496
1506
1507
1508
1511
1512
1513
1514
1515
1516
1517
1518
1524 for (address = 1; address < 127; address++)
1526 Wire.beginTransmission(address);
1527 error = Wire.endTransmission();
1530 addressArray[idx] = address;
1533 else if (error == 4)
1542
1543
1544
1545
1546
1548 for (uint8_t i = 0; i < 32; i++ ) {
1549 this->getRegister(i);
1551 return shadowRegisters;
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567void BK108X::
convertToChar(uint16_t value,
char *strValue, uint8_t len, uint8_t dot, uint8_t separator,
bool remove_leading_zeros)
1570 for (
int i = (len - 1); i >= 0; i--)
1574 strValue[i] = d + 48;
1576 strValue[len] =
'\0';
1579 for (
int i = len; i >= dot; i--)
1581 strValue[i + 1] = strValue[i];
1583 strValue[dot] = separator;
1586 if (remove_leading_zeros)
1588 if (strValue[0] ==
'0')
1591 if (strValue[1] ==
'0')
#define OSCILLATOR_TYPE_CRYSTAL
uint16_t getChipId()
Returns the Chip Indentifiction.
char rds_buffer2A[65]
RDS Radio Text buffer - Program Information.
char rds_buffer2B[33]
RDS Radio Text buffer - Station Informaation.
uint16_t getDeviceId()
Returns the Device Indentifiction.
char rds_buffer0A[9]
RDS Basic tuning and switching information (Type 0 groups)
char rds_time[20]
RDS date time received information.
uint8_t i2cReceiveAck()
Gets Acknowledge (ACK)
uint8_t i2cReadByte()
Gets a Byte from the slave device.
uint16_t readRegister(uint8_t reg)
Gets an array of values from a BK108X given register.
void i2cBeginTransaction()
Starts the I2C bus transaction.
void i2cEndTransaction()
Finish the I2C bus transaction.
void i2cWriteByte(uint8_t data)
Sends a Byte to the slave device.
void writeRegister(uint8_t reg, uint16_t vakue)
Sends an array of values to a BK108X given register.
void i2cNack()
Sends Not Acknowledge (ACK)
void setI2C(uint8_t i2c_addr=I2C_DEVICE_ADDR)
Sets I2C bus address.
void i2cAck()
Sends Acknowledge (ACK)
void i2cInit(int pin_sdio, int pin_sclk)
Sets the MCU pins connected to the I2C bus.
void reset()
Resets the device.
uint16_t getChannel()
Gets the current channel.
void seekHardware(uint8_t seek_mode, uint8_t direction, void(*showFunc)()=NULL)
Seeks a station via hardware functionality.
void setSpace(uint8_t space=0)
Sets the Space channel for AM or FM.
void seekSoftware(uint8_t seek_mode, uint8_t direction, void(*showFunc)()=NULL)
Seeks a station via Software.
uint16_t getRealChannel()
Gets the current channel stored in register 0x0B.
void waitAndFinishTune()
Wait STC (Seek/Tune Complete) status becomes 0.
void setSoftMuteAttack(uint8_t value)
Sets Softmute Attack/Recover Rate.
void setSeekThreshold(uint8_t rssiValue, uint8_t snrValue)
Sets RSSI and SNR Seek Threshold.
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.
int getSnr()
Gets the current SNR.
void setAudioMute(bool left, bool right)
Sets the Mute true or false.
void setFrequency(uint16_t frequency)
Sets the FM frequency.
void setBand(uint8_t band=1)
Sets the current band for AM or FM.
void setFrequencyDown()
Decrements the current frequency.
void setAudioMute(bool value)
Sets the Mute true or false.
void setSoftMute(bool value)
Sets the Softmute true or false.
void setAfcMute(bool value)
Disable or Enable soft mute when AFCRL is high.
bk_reg0a getStatus()
Gets the current status (register 0x0A) content.
bool isStereo()
Checks stereo / mono status.
void setVolumeUp()
Increments the audio volume.
uint16_t getFrequency()
Gets the current frequency.
void setSoftMuteAttenuation(uint8_t value)
Sets Softmute Attenuation.
void powerDown()
Powers the receiver off.
void setChannel(uint16_t channel)
Sets the channel.
void setFM(uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step)
Sets the receiver to FM mode.
void setVolume(uint8_t value)
Sets the audio volume level.
uint8_t getVolume()
Gets the current audio volume level.
void setMono(bool value)
Sets the Mono true or false (stereo)
void setFrequencyUp()
Increments the current frequency.
uint16_t getRealFrequency()
Gets the frequency based on READCHAN register (0x0B)
void setVolumeDown()
Decrements the audio volume.
void powerUp()
Powers the receiver on.
void setup(int sda_pin, int sclk_pin, uint8_t oscillator_type=OSCILLATOR_TYPE_CRYSTAL, uint32_t oscillator_frequency=32768)
Starts the device.
int getRssi()
Gets the current Rssi.
void setRegister(uint8_t reg, uint16_t value)
Sets a given value to the device registers.
void setMuteThreshold(uint8_t rssi, uint8_t snr)
Set the Mute Threshold based on RSSI and SNR.
void setSeekMute(bool value)
Disable or Enable soft mute when seeking.
uint16_t getRegister(uint8_t reg)
Gets a givens current register content of the device.
char * getRdsText0A(void)
Gets the Station Name and other messages.
bool getRdsReady()
Returns true if RDS Ready.
char * getRdsText(void)
Gets the RDS Text when the message is of the Group Type 2 version A.
char * getRdsText2B(void)
Gets the Text processed for the 2B group.
void getNext4Block(char *c)
Processes data received from group 2A.
uint8_t getRdsVersionCode(void)
Gets the version code (extracted from the Block B)
bool getRdsAllData(char **stationName, char **stationInformation, char **programInformation, char **utcTime)
Gets Station Name, Station Information, Program Information and utcTime.
char * getRdsTime()
Gets the RDS time and date when the Group type is 4.
uint16_t getRdsGroupType()
Return the group type - Gets the Group Type (extracted from the Block B)
uint8_t getRdsFlagAB(void)
Returns the current Text Flag A/B.
uint8_t getRdsProgramType(void)
Returns the Program Type (extracted from the Block B)
void getNext2Block(char *c)
Process data received from group 2B - Station Name.
char * getRdsText2A(void)
Gets the Text processed for the 2A group.
void clearRdsBuffer()
Clear RDS Information (Station Name, Station Information, Program Information and Time)
bool getRdsSync()
Get the Rds Sync.
void setRdsMode(uint8_t rds_mode=0)
Sets the Rds Mode Standard or Verbose.
void setRds(bool value, bool interrupt_enable=false)
Sets the RDS operation.
char * getRdsLocalTime()
Gets the RDS time converted to local time.
void convertToChar(uint16_t value, char *strValue, uint8_t len, uint8_t dot, uint8_t separator, bool remove_leading_zeros=true)
Converts a number to a char array.
uint16_t * getRegisterValues()
Returns the point of uint16_t array (size 32)
int checkI2C(uint8_t *addressArray)
Check the I2C bus address.