diff --git a/Doc/QN8066_01.pdf b/Doc/QN8066_01.pdf index 8681675..bb57a83 100644 Binary files a/Doc/QN8066_01.pdf and b/Doc/QN8066_01.pdf differ diff --git a/examples/compile.sh b/examples/compile.sh new file mode 100644 index 0000000..66b7365 --- /dev/null +++ b/examples/compile.sh @@ -0,0 +1,14 @@ +# This script uses the arduino-cli to compile the arduino sketches using command line (without Arduino IDE). +# It is very useful to check the library on multiple board types after bug fixes and improvements. +# It runs on a MacOS but you can port it to Linux o Windows easily. +# Some compilation results (bin and hex files) will be stores in your Download directory (/Users//Downloads/hex) +# ATTENTION: be careful with --output-dir arduino-cli option. Before compiling, this option removes all the contents of the last level folder. +# For example: if you use "--output-dir ~/Downloads", all the current content of the Downloads folder will be lost. +# if you use "--output-dir ~/Downloads/hex", all current content of the hex folder will be lost and the Downloads +# content will be preserved. +# Ricardo Lima Caratti Mar 2024 + +echo "Arduino ATmega328 based board" + +arduino-cli compile -b arduino:avr:nano ./examples/01_SERIAL_MONITOR/B_TX --output-dir ~/Downloads/hex/atmega/B_TX + diff --git a/src/QN8066.cpp b/src/QN8066.cpp index 3eca3db..a3d4bf5 100644 --- a/src/QN8066.cpp +++ b/src/QN8066.cpp @@ -468,3 +468,29 @@ void QN8066::setTxToggleRDSReady() { system2.arg.rdsrdy = !system2.arg.rdsrdy; this->setRegister(QN_SYSTEM2, system2.raw); } + +/** + * @ingroup group04 TX RDS + * @brief RDS TX Updated + * @details To transmit the 8 bytes in RDS0~RDS7, user should toggle the register bit RDSRDY (See SYSTEM2 register). + * @details Then the chip internally fetches these bytes after completing transmitting of current group. + * @details Once the chip internally fetched these bytes, it will toggle this bit, and user can write in another group. + * @return true + * @return false + */ +bool QN8066::getTxRDSUpdated() { + return this->getStatus3().arg.RDS_TXUPD; +} + +/** + * @ingroup group04 TX RDS + * @brief Writes the RDS data bytes to be sent (SEE TX_RDSD0 to TX_RDSD7 registers) + * @details The data written into RDSD0~RDSD7 cannot be sent out if user didn’t toggle RDSTXRDY to allow the data loaded into internal transmitting buffer. + * @param text (point to array of char with 8 bytes to be loaded into the RDS data buffer) + */ +void QN8066::writeTxRDSBuffer(char *text) { + for (uint8_t address = QN_TX_RDSD0; address <= QN_TX_RDSD7; address++ ) { + this->setRegister(address, *text++); + } +} + diff --git a/src/QN8066.h b/src/QN8066.h index 06c26ca..befaeeb 100644 --- a/src/QN8066.h +++ b/src/QN8066.h @@ -842,9 +842,11 @@ class QN8066 { inline void setTxFrequency(float frequency) { setTxChannel(frequency); }; - // RDS + // RDS TX void setTxRDS(bool value); void setTxToggleRDSReady(); + bool getTxRDSUpdated(); + void writeTxRDSBuffer(char *text); };