 |
PU2CLR SI470X Arduino Library
1.0.1
Arduino Library for Si470X Devices - By Ricardo Lima Caratti
|
Go to the documentation of this file.
17 #define MAX_DELAY_AFTER_OSCILLATOR 500
20 #define I2C_DEVICE_ADDR 0x10
21 #define OSCILLATOR_TYPE_CRYSTAL 1
22 #define OSCILLATOR_TYPE_REFCLK 0
24 #define RDS_STANDARD 0
26 #define SI470X_SEEK_DOWN 0
27 #define SI470X_SEEK_UP 1
28 #define SI470X_SEEK_WRAP 0
29 #define SI470X_SEEK_STOP 1
31 #define FM_BAND_USA_EU 0
32 #define FM_BAND_JAPAN_WIDE 1
33 #define FM_BAND_JAPAN 2
34 #define FM_BAND_RESERVED 3
85 uint16_t FIRMWARE : 6;
101 uint8_t RESERVED1 : 5;
103 uint8_t RESERVED2 : 1;
108 uint8_t RESERVED3 : 1;
128 uint16_t RESERVED : 5;
155 uint8_t RESERVED1 : 2;
159 uint8_t RESERVED2 : 1;
214 uint8_t RESERVED : 3;
233 uint16_t RESERVED : 14;
317 uint16_t READCHAN : 10;
376 uint8_t programType : 5;
377 uint8_t trafficProgramCode : 1;
378 uint8_t versionCode : 1;
379 uint8_t groupType : 4;
384 uint8_t textABFlag : 1;
385 uint8_t programType : 5;
386 uint8_t trafficProgramCode : 1;
387 uint8_t versionCode : 1;
388 uint8_t groupType : 4;
393 uint8_t textABFlag : 1;
394 uint8_t programType : 5;
395 uint8_t trafficProgramCode : 1;
396 uint8_t versionCode : 1;
397 uint8_t groupType : 4;
416 uint8_t offset_sense : 1;
424 } si470x_rds_date_time;
449 uint16_t shadowRegisters[17];
452 si470x_reg00 *reg00 = (si470x_reg00 *)&shadowRegisters[
REG00];
453 si470x_reg01 *reg01 = (si470x_reg01 *)&shadowRegisters[
REG01];
454 si470x_reg02 *reg02 = (si470x_reg02 *)&shadowRegisters[
REG02];
455 si470x_reg03 *reg03 = (si470x_reg03 *)&shadowRegisters[
REG03];
456 si470x_reg04 *reg04 = (si470x_reg04 *)&shadowRegisters[
REG04];
457 si470x_reg05 *reg05 = (si470x_reg05 *)&shadowRegisters[
REG05];
458 si470x_reg06 *reg06 = (si470x_reg06 *)&shadowRegisters[
REG06];
459 si470x_reg07 *reg07 = (si470x_reg07 *)&shadowRegisters[
REG07];
460 si470x_reg08 *reg08 = (si470x_reg08 *)&shadowRegisters[
REG08];
461 si470x_reg09 *reg09 = (si470x_reg09 *)&shadowRegisters[
REG09];
462 si470x_reg0a *reg0a = (si470x_reg0a *)&shadowRegisters[
REG0A];
463 si470x_reg0b *reg0b = (si470x_reg0b *)&shadowRegisters[
REG0B];
469 uint16_t startBand[4] = {8750, 7600, 7600, 6400 };
470 uint16_t endBand[4] = {10800, 10800, 9000, 10800};
471 uint16_t fmSpace[4] = {20, 10, 5, 1};
523 if (register_number > 0x0F)
525 shadowRegisters[register_number] = value;
529 void setup(
int resetPin,
int sdaPin,
int rdsInterruptPin = -1,
int seekInterruptPin = -1, uint8_t oscillator_type =
OSCILLATOR_TYPE_CRYSTAL);
530 void setup(
int resetPin,
int sdaPin, uint8_t oscillator_type);
539 void seek(uint8_t seek_mode, uint8_t direction);
540 void seek(uint8_t seek_mode, uint8_t direction,
void (*showFunc)());
543 void setBand(uint8_t band = 1);
uint16_t raw
Definition: SI470X.h:113
#define REG01
Definition: SI470X.h:37
uint16_t raw
Definition: SI470X.h:89
#define REG05
Definition: SI470X.h:41
void setAllRegisters(uint8_t limit=0x07)
Sets values to the device registers from 0x02 to 0x07.
Definition: SI470X.cpp:62
void getStatus()
Gets the value of the 0x0A register.
Definition: SI470X.cpp:81
uint16_t getShadownRegister(uint8_t register_number)
Get the Shadown Register object.
Definition: SI470X.h:511
uint16_t getManufacturerId()
Gets the Manufacturer ID.
Definition: SI470X.cpp:652
#define REG0F
Definition: SI470X.h:51
#define I2C_DEVICE_ADDR
Definition: SI470X.h:20
int rdsInterruptPin
Definition: SI470X.h:480
void powerUp()
Powers the receiver on.
Definition: SI470X.cpp:133
uint16_t maxDelayAftarCrystalOn
Definition: SI470X.h:483
#define REG00
Definition: SI470X.h:36
uint16_t getRealChannel()
Gets the current channel stored in register 0x0B.
Definition: SI470X.cpp:314
int deviceAddress
Definition: SI470X.h:474
void setMono(bool value)
Sets the Mono true or false (stereo)
Definition: SI470X.cpp:553
void seek(uint8_t seek_mode, uint8_t direction)
Seek function.
Definition: SI470X.cpp:344
uint8_t getChipVersion()
Gets the Chip Version.
Definition: SI470X.cpp:683
void setRdsMode(uint8_t rds_mode=0)
Sets the Rds Mode Standard or Verbose.
Definition: SI470X.cpp:712
uint16_t raw
Definition: SI470X.h:436
#define REG09
Definition: SI470X.h:45
#define REG0C
Definition: SI470X.h:48
void setSoftmuteAttenuation(uint8_t value)
Sets Softmute Attenuation..
Definition: SI470X.cpp:518
int resetPin
Definition: SI470X.h:475
uint16_t raw
Definition: SI470X.h:251
void setFrequencyUp()
Increments the current frequency.
Definition: SI470X.cpp:273
void setVolume(uint8_t value)
Sets the audio volume level.
Definition: SI470X.cpp:577
uint16_t raw
Definition: SI470X.h:218
uint8_t currentFMBand
Definition: SI470X.h:477
uint16_t raw
Definition: SI470X.h:186
#define REG03
Definition: SI470X.h:39
uint16_t raw
Definition: SI470X.h:237
int getRssi()
Gets the Rssi.
Definition: SI470X.cpp:469
void setFrequencyDown()
Decrements the current frequency.
Definition: SI470X.cpp:288
void waitAndFinishTune()
Wait STC (Seek/Tune Complete) status becomes 0.
Definition: SI470X.cpp:98
uint16_t getRealFrequency()
Gets the frequency based on READCHAN register (0x0B)
Definition: SI470X.cpp:327
#define REG04
Definition: SI470X.h:40
void setAgc(bool value)
Sets the AGC enable or disable.
Definition: SI470X.cpp:529
void setDelayAfterCrystalOn(uint8_t ms_value)
Set the Delay After Crystal On (default 500ms)
Definition: SI470X.h:496
uint16_t getFrequency()
Gets the current frequency.
Definition: SI470X.cpp:303
void setBand(uint8_t band=1)
Sets the FM Band
Definition: SI470X.cpp:440
uint8_t getVolume()
Gets the current audio volume level.
Definition: SI470X.cpp:591
void setVolumeDown()
Decrements the audio volume.
Definition: SI470X.cpp:615
void setChannel(uint16_t channel)
Sets the channel.
Definition: SI470X.cpp:245
void setSeekThreshold(uint8_t value)
Sets RSSI Seek Threshold.
Definition: SI470X.cpp:420
void setShadownRegister(uint8_t register_number, uint16_t value)
Sets a given value to the Shadown Register.
Definition: SI470X.h:521
uint16_t si470x_reg0c
RDS Block A.
Definition: SI470X.h:330
uint8_t currentFMSpace
Definition: SI470X.h:478
#define REG02
Definition: SI470X.h:38
#define REG0D
Definition: SI470X.h:49
void seek(uint8_t seek_mode, uint8_t direction, void(*showFunc)())
Seek function.
Definition: SI470X.cpp:389
uint16_t currentFrequency
Definition: SI470X.h:476
uint16_t raw
Definition: SI470X.h:265
uint8_t raw[6]
Definition: SI470X.h:423
#define OSCILLATOR_TYPE_CRYSTAL
Definition: SI470X.h:21
void setup(int resetPin, int sdaPin, uint8_t oscillator_type)
Starts the device.
Definition: SI470X.cpp:235
int seekInterruptPin
Definition: SI470X.h:481
uint16_t getRdsGroupType()
Definition: SI470X.cpp:745
si470x_reg0d blockB
Definition: SI470X.h:399
#define REG07
Definition: SI470X.h:43
#define REG08
Definition: SI470X.h:44
void getAllRegisters()
Gets all current register content of the device.
Definition: SI470X.cpp:26
bool isStereo()
Checks stereo / mono status.
Definition: SI470X.cpp:565
bool getRdsReady()
Returns true if RDS Ready.
Definition: SI470X.cpp:739
void setFrequency(uint16_t frequency)
Sets the FM frequency.
Definition: SI470X.cpp:260
#define MAX_DELAY_AFTER_OSCILLATOR
Definition: SI470X.h:17
void reset()
Resets the device.
Definition: SI470X.cpp:119
uint16_t raw
Definition: SI470X.h:297
uint8_t currentVolume
Definition: SI470X.h:479
void setup(int resetPin, int sdaPin, int rdsInterruptPin=-1, int seekInterruptPin=-1, uint8_t oscillator_type=OSCILLATOR_TYPE_CRYSTAL)
Starts the device.
Definition: SI470X.cpp:208
uint16_t si470x_reg0e
RDS Block C.
Definition: SI470X.h:344
#define REG06
Definition: SI470X.h:42
void setSpace(uint8_t space=0)
Sets the FM Space
Definition: SI470X.cpp:457
uint8_t getFirmwareVersion()
Gets the Firmware Version.
Definition: SI470X.cpp:663
uint16_t si470x_reg0f
RDS Block D.
Definition: SI470X.h:351
void setSoftmuteAttack(uint8_t value)
Sets Softmute Attack/Recover Rate.
Definition: SI470X.cpp:499
uint16_t raw
Definition: SI470X.h:322
void setExtendedVolumeRange(bool value)
Sets Extended Volume Range.
Definition: SI470X.cpp:630
void setSoftmute(bool value)
Sets the Softmute true or false.
Definition: SI470X.cpp:480
void setVolumeUp()
Increments the audio volume.
Definition: SI470X.cpp:601
#define REG0E
Definition: SI470X.h:50
uint16_t raw
Definition: SI470X.h:131
uint16_t raw
Definition: SI470X.h:163
#define REG0A
Definition: SI470X.h:46
void setMute(bool value)
Sets the Mute true or false.
Definition: SI470X.cpp:541
uint16_t raw
Definition: SI470X.h:74
void setRds(bool value)
Sets the RDS operation.
Definition: SI470X.cpp:725
uint8_t getPartNumber()
Gets the Part Number.
Definition: SI470X.cpp:642
uint8_t getDeviceId()
Gets the Device identification.
Definition: SI470X.cpp:673
int oscillatorType
Definition: SI470X.h:482
void setFmDeemphasis(uint8_t de)
Sets De-emphasis.
Definition: SI470X.cpp:695
void powerDown()
Powers the receiver off.
Definition: SI470X.cpp:185
#define REG0B
Definition: SI470X.h:47
uint16_t si470x_reg0d
RDS Block B.
Definition: SI470X.h:337