Skip to content

Commit

Permalink
Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pu2clr committed Jul 14, 2024
1 parent 3b388ed commit 0ad14fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions examples/01_SERIAL_MONITOR/B_TX/B_TX.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <QN8066.h>

#define FREQ 106.8
#define FREQ 1067 // Frequency: 106.7 MHz

QN8066 dv;

Expand Down Expand Up @@ -53,10 +53,10 @@ void setup() {


dv.setTxInputImpedance(0); // 0=10; 1 = 20; 2=40 (default); 3=80. Kohms.
dv.setTxInputBufferGain(5); // With input inpedance 0 (10K), and input buffer 5, the gain shoud be 18dB
// dv.setTxInputBufferGain(5); // With input inpedance 0 (10K), and input buffer 5, the gain shoud be 18dB
dv.setTxSoftClipping(true);
dv.setTxDigitalGain(2); // TX digital gain => 2 = 2dB (default is 0 dB)
dv.setTxFrequencyDerivation(200); // Valid valued from 0 to 255
// dv.setTxDigitalGain(2); // TX digital gain => 2 = 2dB (default is 0 dB)
// dv.setTxFrequencyDerivation(200); // Valid valued from 0 to 255

sprintf(str, "\n\nBroadcasting...");
Serial.print(str);
Expand Down
14 changes: 7 additions & 7 deletions src/QN8066.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,12 @@ void QN8066::setRX() {
/**
* @ingroup group04 Start TX
* @brief Sets the TX mode
* @details To avoid working with the float data type, the frequency parameter must be the desired frequency multiplied by 10.
* @details For example, if the user wants to tune to 106.7 MHz, the parameter to be sent is 1067.
* @details This approach reduces the size of the final code (binary) as well as avoids the inaccuracies of floating-point mathematical operations.
* @param frequency - Frequency to be set
*/
void QN8066::setTX(float frequency) {
void QN8066::setTX(uint16_t frequency) {
this->setRegister(QN_SYSTEM1, 0B11100011); // RESET the SYSTEM
delay(200);

Expand All @@ -165,14 +168,11 @@ void QN8066::setTX(float frequency) {
this->setRegister(QN_CCA, 0B00010000);

// Sets the crystal oscillator divider
this->setRegister(QN_XTAL_DIV0,
this->xtal_div & 0xFF); // Lower 8 bits of xtal_div[10:0].
this->setRegister(QN_XTAL_DIV1,
(this->xtal_div >> 8) |
0B0001000); // Higher 3 bits of xtal_div[10:0].
this->setRegister(QN_XTAL_DIV0, this->xtal_div & 0xFF); // Lower 8 bits of xtal_div[10:0].
this->setRegister(QN_XTAL_DIV1, (this->xtal_div >> 8) | 0B0001000); // Higher 3 bits of xtal_div[10:0].

// Set frequency
int16_t auxFreq = (int16_t)((frequency - 60) / 0.05);
int16_t auxFreq = (frequency - 600) * 2;
this->setRegister(QN_INT_CTRL, 0B00100000 | auxFreq >> 8);
this->setRegister(QN_TXCH, 0B11111111 & auxFreq);

Expand Down
2 changes: 1 addition & 1 deletion src/QN8066.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ class QN8066 {
*/
void setRX();

void setTX(float frequency); // RESET the system and set to TX mode at a given frequency
void setTX(uint16_t frequency); // RESET the system and set to TX mode at a given frequency


void setTxStereo(bool value = true);
Expand Down

0 comments on commit 0ad14fc

Please sign in to comment.