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
394 reg02->refined.DISABLE = 0;
395 reg02->refined.ENABLE = 1;
396 setRegister(
REG02, reg02->raw);
398 setRegister(
REG03, 0x0000);
400 setRegister(
REG04, 0x60D4);
401 setRegister(
REG05, 0x37CF);
404 reg06->refined.CLKSEL =
this->oscillatorType;
405 setRegister(
REG06, reg06->raw);
407 setRegister(
REG07, 0x0101);
408 setRegister(
REG08, 0xAC90);
410 setRegister(
REG10, 0x7B11);
411 setRegister(
REG11, 0x004A);
412 setRegister(
REG12, 0x4000);
413 setRegister(
REG13, 0x3E00);
414 setRegister(
REG14, 0xC29A);
415 setRegister(
REG15, 0x79F8);
416 setRegister(
REG16, 0x4012);
418 setRegister(
REG17, 0x0040);
420 setRegister(
REG18, 0x341C);
421 setRegister(
REG19, 0x0080);
422 setRegister(
REG1A, 0x0000);
423 setRegister(
REG1B, 0x4CA2);
425 setRegister(
REG1C, 0x8820);
426 setRegister(
REG1D, 0x0200);
430 uint32_t bk_number = (oscillatorFrequency / 512) + 0.5;
431 uint16_t final_result = 0;
435 reg1c->refined.FREQ_SEL = (bk_number >> 16);
436 setRegister(
REG1C, reg1c->raw);
438 aux = bk_number & 0b001111111111111111;
440 for (
int i = 0; i < 16; i++)
442 if ((aux & (1 << i)) != 0)
443 final_result |= 1 << (15 - i);
446 setRegister(
REG1D,0x71DA);
450 delay(
this->maxDelayAfterCrystalOn);
454
455
456
459 reg02->refined.DISABLE = 1;
460 reg02->refined.ENABLE = 0;
461 setRegister(
REG02, reg02->raw);
467
468
469
470
471
472
473
474
475
476
477void BK108X::
setup(
int sda_pin,
int sclk_pin, uint8_t oscillator_type, uint32_t oscillator_frequency)
481 this->oscillatorType = oscillator_type;
482 this->oscillatorFrequency = oscillator_frequency;
487
488
489
490
491
492
493
494
495
496void BK108X::
setFM(uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step)
498 this->currentStep = step;
499 this->currentFrequency = default_frequency;
500 this->minimumFrequency = minimum_frequency;
501 this->maximumFrequency = maximum_frequency;
505 setRegister(
REG07, reg07->raw);
508 this->currentFMBand = reg05->refined.BAND = 0;
509 this->currentFMSpace = reg05->refined.SPACE = 2;
510 setRegister(
REG05, reg05->raw);
511 setFrequency(default_frequency);
515
516
517
518
519
520
521
522
523
524
525
526void BK108X::
setAM(uint16_t minimum_frequency, uint16_t maximum_frequency, uint16_t default_frequency, uint16_t step, uint16_t am_space)
528 this->currentStep = step;
529 this->currentFrequency = default_frequency;
530 this->minimumFrequency = minimum_frequency;
531 this->maximumFrequency = maximum_frequency;
533 this->currentMode = reg07->refined.MODE =
BK_MODE_AM;
534 setRegister(
REG07, reg07->raw);
538 if (minimum_frequency < 520)
539 this->currentAMBand = reg05->refined.BAND = 0;
540 else if (minimum_frequency < 1800)
541 this->currentAMBand = reg05->refined.BAND = 1;
543 this->currentAMBand = reg05->refined.BAND = 2;
545 this->currentAMSpace = reg05->refined.SPACE = am_space;
547 setRegister(
REG05, reg05->raw);
548 this->setFrequency(default_frequency);
552
553
554
555
558 reg02->refined.SEEK = 0;
559 setRegister(
REG02, reg02->raw);
561 reg03->refined.TUNE = 1;
562 reg03->refined.CHAN = channel;
564 setRegister(
REG03, reg03->raw);
568 this->currentChannel = channel;
572
573
574
575
576
583 channel = (frequency -
this->fmStartBand[
this->currentFMBand]) /
this->fmSpace[
this->currentFMSpace];
587 channel = (frequency -
this->amStartBand[
this->currentAMBand]) /
this->amSpace[
this->currentAMSpace];
590 this->setChannel(channel);
594
595
596
597
600 this->currentFrequency +=
this->currentStep;
602 if (
this->currentFrequency >
this->maximumFrequency)
603 this->currentFrequency =
this->minimumFrequency;
605 setFrequency(
this->currentFrequency);
609
610
611
612
615 this->currentFrequency -=
this->currentStep;
617 if (
this->currentFrequency <
this->minimumFrequency)
618 this->currentFrequency =
this->maximumFrequency;
620 setFrequency(
this->currentFrequency);
624
625
626
627
630 return this->currentFrequency;
634
635
636
637
640 return this->currentChannel;
644
645
646
647
648
652 return reg0b->refined.READCHAN;
656
657
658
659
660
661
666 return getRealChannel() *
this->amSpace[
this->currentAMSpace] +
this->amStartBand[
this->currentAMBand];
670 return getRealChannel() *
this->fmSpace[
this->currentFMSpace] +
this->fmStartBand[
this->currentFMBand];
675
676
677
678
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
710 long max_time = millis();
714 reg03->refined.TUNE = 0;
715 setRegister(
REG03, reg03->raw);
717 reg02->refined.SKMODE = seek_mode;
718 reg02->refined.SEEKUP = direction;
719 reg02->refined.SEEK = 1;
720 setRegister(
REG02, reg02->raw);
722 if (showFunc != NULL)
724 this->currentFrequency = getRealFrequency();
728 }
while ((!reg0a->refined.STC && reg0a->refined.SF_BL) && (millis() - max_time) <
MAX_SEEK_TIME);
730 reg02->refined.SEEK = 0;
731 reg03->refined.TUNE = 0;
732 setRegister(
REG02, reg02->raw);
733 setRegister(
REG03, reg03->raw);
735 this->currentFrequency = getRealFrequency();
739
740
741
742
743
744
745
749 long max_time = millis();
753 reg03->refined.TUNE = 0;
754 setRegister(
REG03, reg03->raw);
756 reg02->refined.SKMODE = seek_mode;
757 reg02->refined.SEEKUP = direction;
758 reg02->refined.SKAFCRL = 1;
759 reg02->refined.SEEK = 1;
760 setRegister(
REG02, reg02->raw);
762 while (reg0a->refined.STC == 0 && (millis() - max_time) <
MAX_SEEK_TIME)
764 if (showFunc != NULL)
766 this->currentFrequency = getRealFrequency();
772 reg02->refined.SEEK = 0;
773 setRegister(
REG02, reg02->raw);
776 this->setChannel(
this->getRealChannel());
777 this->currentFrequency = getRealFrequency();
778 this->setFrequency(
this->currentFrequency);
780 }
while (reg0a->refined.SF_BL != 0 && (millis() - max_time) <
MAX_SEEK_TIME);
781 reg03->refined.TUNE = 0;
782 setRegister(
REG03, reg03->raw);
786
787
788
789
790
791
794 reg05->refined.SEEKTH = rssiValue;
795 setRegister(
REG05, reg05->raw);
797 reg06->refined.SKSNR = snrValue;
798 setRegister(
REG06, reg06->raw);
802
803
804
805
806
807
808
809
810
811
812
813
814
815
820 this->currentAMBand = band;
822 this->currentFMBand = band;
824 reg05->refined.BAND = band;
825 setRegister(
REG05, reg05->raw);
829
830
831
832
833
834
835
836
837
838
839
840
841
845 this->currentAMSpace = space;
847 this->currentFMSpace = space;
849 reg05->refined.SPACE = space;
850 setRegister(
REG05, reg05->raw);
854
855
856
857
858
862 return reg0a->refined.RSSI;
866
867
868
869
870
874 return reg09->refined.SNR;
878
879
880
881
882
885 reg02->refined.DSMUTE = !value;
886 setRegister(
REG02, reg02->raw);
890
891
892
893
894
895
896
897
898
899
900
901
902
903
906 reg06->refined.SMUTER = value;
907 setRegister(
REG06, reg06->raw);
911
912
913
914
915
916
917
918
919
920
921
922
925 reg06->refined.SMUTEA = value;
926 setRegister(
REG06, reg06->raw);
930
931
932
933
934
935
936
939 reg14->refined.RSSIMTH = rssi;
940 reg14->refined.SNRMTH = snr;
941 setRegister(
REG14, reg14->raw);
945
946
947
948
949
952 reg14->refined.SKMUTE = value;
953 setRegister(
REG14, reg14->raw);
957
958
959
960
961
964 reg14->refined.AFCMUTE = value;
965 setRegister(
REG14, reg14->raw);
969
970
971
972
973
974
977 reg02->refined.MUTEL = left;
978 reg02->refined.MUTER = right;
979 setRegister(
REG02, reg02->raw);
983
984
985
986
987
994
995
996
997
998
1001 reg02->refined.MONO = value;
1002 reg02->refined.STEREO = !value;
1003 setRegister(
REG02, reg02->raw);
1007
1008
1009
1010
1011
1012
1016 return reg0a->refined.STEN;
1020
1021
1022
1023
1024
1029 this->currentVolume = value;
1031 reg05->refined.VOLUME = value;
1033 setRegister(
REG05, reg05->raw);
1037
1038
1039
1040
1041
1044 return this->currentVolume;
1048
1049
1050
1051
1054 if (
this->currentVolume < 31)
1056 this->currentVolume++;
1057 setVolume(
this->currentVolume);
1062
1063
1064
1065
1068 if (
this->currentVolume > 0)
1070 this->currentVolume--;
1071 setVolume(
this->currentVolume);
1076
1077
1078
1081
1082
1083
1084
1085
1086
1092
1093
1094
1095
1096
1099 this->rds_mode = rds_mode;
1103
1104
1105
1106
1107
1108
1109
1110
1113 reg04->refined.RDSEN = value;
1114 if ( interrupt_enable ) {
1115 reg04->refined.RDSIEN = interrupt_enable;
1116 reg04->refined.GPIO2 = 1;
1118 setRegister(
REG04, reg04->raw);
1122
1123
1124
1125
1126
1127
1128
1129
1133 if (!reg0a->refined.RDSR)
1143
1144
1145
1146
1147
1148
1152 blkb.blockB = reg0d->raw;
1153 return blkb.refined.textABFlag;
1157
1158
1159
1160
1161
1165 b.blockB = reg0d->raw;
1166 return b.refined.groupType;
1170
1171
1172
1173
1174
1175
1179 b.blockB = reg0d->raw;
1180 return b.refined.versionCode;
1184
1185
1186
1187
1188
1189
1193 b.blockB = reg0d->raw;
1194 return b.refined.programType;
1198
1199
1200
1201
1202
1205 c[1] = reg0f->refined.lowByte;
1206 c[0] = reg0f->refined.highByte;
1210
1211
1212
1213
1214
1215
1218 c[0] = reg0e->refined.highByte;
1219 c[1] = reg0e->refined.lowByte;
1220 c[2] = reg0f->refined.highByte;
1221 c[3] = reg0f->refined.lowByte;
1225
1226
1227
1228
1229
1236
1237
1238
1239
1240
1241
1242
1243
1246 static int rdsTextAdress0A;
1249 blkb.blockB = reg0d->raw;
1251 if (blkb.group0.groupType == 0)
1254 rdsTextAdress0A = blkb.group0.address;
1255 if (rdsTextAdress0A >= 0 && rdsTextAdress0A < 4)
1267
1268
1269
1270
1271
1272
1275 static int rdsTextAdress2A;
1278 blkb.blockB = reg0d->raw;
1279 rdsTextAdress2A = blkb.group2.address;
1281 if (blkb.group2.groupType == 2)
1285 if (rdsTextAdress2A >= 0 && rdsTextAdress2A < 16)
1296
1297
1298
1299
1302 static int rdsTextAdress2B;
1305 blkb.blockB = reg0d->raw;
1306 if (blkb.group2.groupType == 1)
1309 rdsTextAdress2B = blkb.group2.address;
1310 if (rdsTextAdress2B >= 0 && rdsTextAdress2B < 16)
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344bool BK108X::
getRdsAllData(
char **stationName,
char **stationInformation,
char **programInformation,
char **utcTime)
1354 return (
bool)stationName | (
bool)stationInformation | (
bool)programInformation | (
bool)utcTime;
1358
1359
1360
1361
1364 bk_rds_date_time dt;
1365 word16_to_bytes blk_b, blk_c, blk_d;
1368 blk_b.raw = blkb.blockB = reg0d->raw;
1369 blk_c.raw = reg0e->raw;
1370 blk_d.raw = reg0f->raw;
1375 if (blkb.group0.groupType == 4)
1383 dt.raw[4] = blk_b.refined.lowByte;
1384 dt.raw[5] = blk_b.refined.highByte;
1386 dt.raw[2] = blk_c.refined.lowByte;
1387 dt.raw[3] = blk_c.refined.highByte;
1389 dt.raw[0] = blk_d.refined.lowByte;
1390 dt.raw[1] = blk_d.refined.highByte;
1392 minute = dt.refined.minute;
1393 hour = dt.refined.hour;
1395 offset_sign = (dt.refined.offset_sense == 1) ?
'+' :
'-';
1396 offset_h = (dt.refined.offset * 30) / 60;
1397 offset_m = (dt.refined.offset * 30) - (offset_h * 60);
1400 if (offset_h > 12 || offset_m > 60 || hour > 24 || minute > 60)
1403 this->convertToChar(hour, rds_time, 2, 0,
' ',
false);
1405 this->convertToChar(minute, &rds_time[3], 2, 0,
' ',
false);
1408 this->convertToChar(offset_h, &
rds_time[7], 2, 0,
' ',
false);
1410 this->convertToChar(offset_m, &
rds_time[10], 2, 0,
' ',
false);
1420
1421
1422
1423
1424
1425
1426
1427
1430 bk_rds_date_time dt;
1431 word16_to_bytes blk_b, blk_c, blk_d;
1434 blk_b.raw = blkb.blockB = reg0d->raw;
1435 blk_c.raw = reg0e->raw;
1436 blk_d.raw = reg0f->raw;
1442 if (blkb.group0.groupType == 4)
1447 dt.raw[4] = blk_b.refined.lowByte;
1448 dt.raw[5] = blk_b.refined.highByte;
1450 dt.raw[2] = blk_c.refined.lowByte;
1451 dt.raw[3] = blk_c.refined.highByte;
1453 dt.raw[0] = blk_d.refined.lowByte;
1454 dt.raw[1] = blk_d.refined.highByte;
1456 minute = dt.refined.minute;
1457 hour = dt.refined.hour;
1459 offset_h = (dt.refined.offset * 30) / 60;
1460 offset_m = (dt.refined.offset * 30) - (offset_h * 60);
1462 localTime = (hour * 60 + minute);
1463 if (dt.refined.offset_sense == 1)
1464 localTime -= (offset_h * 60 + offset_m);
1466 localTime += (offset_h * 60 + offset_m);
1468 hour = localTime / 60;
1469 minute = localTime - (hour * 60);
1471 if (hour > 24 || minute > 60)
1474 this->convertToChar(hour, rds_time, 2, 0,
' ',
false);
1476 this->convertToChar(minute, &rds_time[3], 2, 0,
' ',
false);
1486
1487
1488
1489
1490
1497
1498
1499
1500
1510
1511
1512
1515
1516
1517
1518
1519
1520
1521
1522
1528 for (address = 1; address < 127; address++)
1530 Wire.beginTransmission(address);
1531 error = Wire.endTransmission();
1534 addressArray[idx] = address;
1537 else if (error == 4)
1546
1547
1548
1549
1550
1552 for (uint8_t i = 0; i < 32; i++ ) {
1553 this->getRegister(i);
1555 return shadowRegisters;
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571void BK108X::
convertToChar(uint16_t value,
char *strValue, uint8_t len, uint8_t dot, uint8_t separator,
bool remove_leading_zeros)
1574 for (
int i = (len - 1); i >= 0; i--)
1578 strValue[i] = d + 48;
1580 strValue[len] =
'\0';
1583 for (
int i = len; i >= dot; i--)
1585 strValue[i + 1] = strValue[i];
1587 strValue[dot] = separator;
1590 if (remove_leading_zeros)
1592 if (strValue[0] ==
'0')
1595 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.
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 getRdsStatus()
Gets the RDS registers information.
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.