PU2CLR QN8066 Arduino Library 1.3.0
Arduino Library for QN8066Devices - By Ricardo Lima Caratti
|
Functions | |
void | QN8066::rdsSendRT (char *rt) |
Sends RDS Radio Text Message (group 2A) | |
void | QN8066::rdsSetPI (uint16_t pi) |
Sets the Program Identification (PI) | |
uint8_t | QN8066::rdsGetPI () |
Gets the Program Identification (PI) | |
void | QN8066::rdsSetPTY (uint16_t pty) |
Sets the Program Type (PTY) | |
uint8_t | QN8066::rdsGetPTY () |
Gets the Program Type (PTY) | |
void | QN8066::rdsSetTP (uint16_t tp) |
Sets the Traffic Program. | |
uint8_t | QN8066::rdsGetTP () |
Sets the Traffic Program. | |
char * | QN8066::rdsGetPS () |
Gets the Program Station (Station Name). | |
uint8_t | QN8066::rdsGetError () |
Gets TX RDS error setup. | |
void | QN8066::rdsClearBuffer () |
Clear RDS register (Buffer) | |
void | QN8066::rdsSetSyncTime (uint8_t syncTime) |
Sets the wait time for the QN8066 to be available to send the next RDS block. | |
void | QN8066::rdsSetRepeatSendGroup (uint8_t count) |
Sets the number of time that a group will be sent at once. | |
void | QN8066::rdsSetMode (uint8_t mode) |
Sets RDS Mode Selection. | |
void | QN8066::rdsSet4KMode (uint8_t value) |
Sets RDS 4K Mode . | |
void | QN8066::rdsSetInterrupt (uint8_t value) |
Sets RDS interrupt. | |
void | QN8066::rdsInitTx (uint8_t countryId=0, uint8_t programId=0, uint8_t reference=0, uint8_t pty=1, uint8_t rdsSyncTime=60, uint8_t rdsRepeatGroup=5) |
Sets some RDS parameters. | |
void | QN8066::rdsSetPI (uint8_t countryId, uint8_t programId, uint8_t reference=0) |
Sets the Program Identification (PI) | |
void | QN8066::rdsTxEnable (bool value) |
Transmitter RDS enable. | |
uint8_t | QN8066::rdsSetTxToggle () |
RDS transmitting ready. | |
bool | QN8066::rdsGetTxUpdated () |
RDS TX Updated. | |
void | QN8066::rdsSetFrequencyDerivation (uint8_t freq=6) |
Sets RDS frequency deviation. | |
void | QN8066::rdsSetTxLineIn (bool value=0) |
Audio Line-in enable control. | |
void | QN8066::rdsSendGroup (RDS_BLOCK1 blockA, RDS_BLOCK2 blockB, RDS_BLOCK3 blockC, RDS_BLOCK4 blockD) |
Sends a RDS group (four blocks) to the QN8066. | |
void | QN8066::rdsSetStationName (char *stationName) |
Sets the station name. | |
void | QN8066::rdsSendPS (char *ps=NULL) |
Sends the Program Service Message. | |
void | QN8066::rdsSendRTMessage (char *rt) |
Sends RDS Radio Text Message (group 2A) | |
int32_t | QN8066::calculateMJD (uint16_t year, uint8_t month, uint8_t day) |
Calculates the Modified Julian Date. | |
void | QN8066::rdsSendDateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, int8_t offset) |
Sends the RDS Date Time information. | |
|
inline |
Sends RDS Radio Text Message (group 2A)
It is a synonym to rdsSendRTMessage. This function repeats sending a group this->rdsRepeatGroup times.
rt | - Radio Text (string of 32 character) |
Example
References QN8066::rdsSendRTMessage().
|
inline |
Sets the Program Identification (PI)
The Program Identification (PI) code is a critical component of the RDS (Radio Data System) protocol.
It is used to uniquely identify the radio station transmitting the RDS data. The PI code is a 16-bit
value (4 hexadecimal digits) assigned to each station.
PI Code Structure
The PI code is a 16-bit binary value (4 hexadecimal digits), and its structure is as follows:
a) Country Identifier (First 4 Bits) - The first 4 bits of the PI code represent the country identifier.
This helps to differentiate stations in different countries. For example, the code 0x1 might represent
one country, while 0x2 represents another.
b) Program Type (Next 4 Bits) - The next 4 bits indicate the program type. This categorizes the type of content
being broadcast, such as music, news, sports, etc.
c) Program Reference Number (Last 8 Bits) - The last 8 bits provide a unique reference number for the specific
station or program.
You can set the PI code using the rdsSetPI. The are three ways of setting PI code:
rdsInitTx(countryId, programId, reference); rdsSetPI(countryId, programId, reference);
rdsSetPI(piCode);
Example
pi | - PI Code |
|
inline |
Gets the Program Identification (PI)
pi | - PI Code |
|
inline |
Sets the Program Type (PTY)
pty | - Program type |
|
inline |
Gets the Program Type (PTY)
pty | - Program type |
|
inline |
Sets the Traffic Program.
tp | - tp Code |
|
inline |
Sets the Traffic Program.
tp | - tp Code |
|
inline |
Gets the Program Station (Station Name).
|
inline |
Gets TX RDS error setup.
void QN8066::rdsClearBuffer | ( | ) |
Clear RDS register (Buffer)
Clear and Flushes the RDS Buffer.
|
inline |
Sets the wait time for the QN8066 to be available to send the next RDS block.
The default time is 60ms, but depending on the microcontroller you are using, it may be necessary to reduce this time.
syncTime | - time in ms |
|
inline |
Sets the number of time that a group will be sent at once.
The default value is 5.
count | - number of times |
void QN8066::rdsSetMode | ( | uint8_t | mode | ) |
Sets RDS Mode Selection.
if 0, Received bit-stream have both RDS and MMBS blocks (āEā block);
if 1, Received bit-stream has RDS block only, no MMBS block (āEā block)
mode |
Example
void QN8066::rdsSet4KMode | ( | uint8_t | value | ) |
void QN8066::rdsSetInterrupt | ( | uint8_t | value | ) |
Sets RDS interrupt.
RDS RX interrupt enable. When RDS_INT_EN=1, a 4.5ms low pulse will be output from pad din (RX mode)
when a new group data is received and stored into RDS0~RDS7 (RX mode).
value | 0 or 1 |
Example
void QN8066::rdsInitTx | ( | uint8_t | countryId = 0 , |
uint8_t | programId = 0 , |
||
uint8_t | reference = 0 , |
||
uint8_t | pty = 1 , |
||
uint8_t | rdsSyncTime = 60 , |
||
uint8_t | rdsRepeatGroup = 5 |
||
) |
Sets some RDS parameters.
countryId | - Country Identifier (First 4 Bits) |
programId | - Program Id code |
reference | - Program Reference Number (8 bits). It provides a unique reference number for the specific station or program. |
pty | - Program type (PTY) - Default is 1 (News) |
rdsSyncTime | - Time in ms to wait for sending the next group - Default value is 60 ms |
rdsRepeatGroup | - Number of times that a RDS group will send at once. - Default is 5. |
Example
void QN8066::rdsSetPI | ( | uint8_t | countryId, |
uint8_t | programId, | ||
uint8_t | reference = 0 |
||
) |
Sets the Program Identification (PI)
countryId | - Country Identifier (First 4 Bits) |
programId | - Program Id code |
reference | - Program Reference Number (8 bits). It provides a unique reference number for the specific station or program. |
void QN8066::rdsTxEnable | ( | bool | value | ) |
Transmitter RDS enable.
Enable RDS service
value | (true = enabled; false = disabled) |
Example
uint8_t QN8066::rdsSetTxToggle | ( | ) |
RDS transmitting ready.
If user want the chip transmitting all the 8 bytes in RDS0~RDS7, user should toggle this bit.
description the chip internally will fetch these bytes after completing transmitting of current group.
Example
bool QN8066::rdsGetTxUpdated | ( | ) |
RDS TX Updated.
To transmit the 8 bytes in RDS0~RDS7, user should toggle the register bit RDSRDY (See SYSTEM2 register).
Then the chip internally fetches these bytes after completing transmitting of current group.
Once the chip internally fetched these bytes, it will toggle this bit, and user can write in another group.
Example
References QN8066::getStatus3().
void QN8066::rdsSetFrequencyDerivation | ( | uint8_t | freq = 6 | ) |
Sets RDS frequency deviation.
RDS frequency deviation = 0.35KHz*RDSFDEV in normal mode.
RDS frequency deviation = 0.207KHz*RDSFDEV in 4k mode and private mode.
freq | ( valid values: from 0 to 127) |
Example
void QN8066::rdsSetTxLineIn | ( | bool | value = 0 | ) |
Audio Line-in enable control.
value | (true = enabled; false = disabled) |
Example
void QN8066::rdsSendGroup | ( | RDS_BLOCK1 | block1, |
RDS_BLOCK2 | block2, | ||
RDS_BLOCK3 | block3, | ||
RDS_BLOCK4 | block4 | ||
) |
Sends a RDS group (four blocks) to the QN8066.
Each block is packaged in 16 bits word (two bytes)
block1 | - RDS_BLOCK1 datatype |
block2 | - RDS_BLOCK2 datatype |
block3 | - RDS_BLOCK3 datatype |
block4 | - RDS_BLOCK4 datatype |
References RDS_BLOCK1::byteContent, RDS_BLOCK2::byteContent, RDS_BLOCK3::byteContent, and RDS_BLOCK4::byteContent.
void QN8066::rdsSetStationName | ( | char * | stationName | ) |
void QN8066::rdsSendPS | ( | char * | ps = NULL | ) |
Sends the Program Service Message.
Like rdsSendPS this method sends the Station Name or other 8 char message.
This function repeats sending a group this->rdsRepeatGroup times.
ps | - String with the name of Station or message limeted to 8 character. |
Example
References QN8066::rdsSetStationName().
void QN8066::rdsSendRTMessage | ( | char * | rt | ) |
Sends RDS Radio Text Message (group 2A)
This function repeats sending a group this->rdsRepeatGroup times.
rt | - Radio Text (string of 32 character) |
Example
Referenced by QN8066::rdsSendRT().
int32_t QN8066::calculateMJD | ( | uint16_t | year, |
uint8_t | month, | ||
uint8_t | day | ||
) |
Calculates the Modified Julian Date.
year | |
month | |
day |
void QN8066::rdsSendDateTime | ( | uint16_t | year, |
uint8_t | month, | ||
uint8_t | day, | ||
uint8_t | hour, | ||
uint8_t | min, | ||
int8_t | offset | ||
) |
Sends the RDS Date Time information.
To use this function (service), you will need to add an integrated clock to your system that provides
the date and time to the system.
year | |
month | |
day | |
hour | |
min | |
offset |
References RDS_BLOCK3::byteContent.