Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Stephen Olesen 2015-07-02 21:32:24 -06:00
commit 1aa7f7d224
4 changed files with 10 additions and 14 deletions

View File

@ -256,7 +256,7 @@ void HamShield::softReset() {
void HamShield::setFrequency(uint32_t freq_khz) { void HamShield::setFrequency(uint32_t freq_khz) {
radio_frequency = freq_khz; radio_frequency = freq_khz;
uint32_t freq_raw = freq_khz << 3; // shift by 3 to multiply by 8 uint32_t freq_raw = freq_khz << 4; // shift by 4 to multiply by 16 (was shift by 3 in old 1846 chip)
// send top 16 bits to A1846S_FREQ_HI_REG // send top 16 bits to A1846S_FREQ_HI_REG
uint16_t freq_half = (uint16_t) (0x3FFF & (freq_raw >> 16)); uint16_t freq_half = (uint16_t) (0x3FFF & (freq_raw >> 16));
@ -386,7 +386,7 @@ void HamShield::setTX(bool on_noff){
setGpioLow(5); // remember that RX and TX are active low setGpioLow(5); // remember that RX and TX are active low
// then turn on VREG (PWM output) // then turn on VREG (PWM output)
// then apply RF signal // then apply RF signal
setRfPower(100); // figure out a good default number (or don't set a default) setRfPower(9); // figure out a good default number (or don't set a default)
} }
// todo: make sure gpio are set correctly after this // todo: make sure gpio are set correctly after this
@ -945,19 +945,12 @@ void HamShield::setRfPower(uint8_t pwr) {
// (see RF6886 datasheet) // (see RF6886 datasheet)
// 30 is 0.5V, which is ~min loop reference voltage // 30 is 0.5V, which is ~min loop reference voltage
// 127 is 2.5V, which is ~max loop ref voltage // 127 is 2.5V, which is ~max loop ref voltage
int max_pwr = 255; //167; // 167 is 3.3*255/5 - 1; int max_pwr = 15; //167; // 167 is 3.3*255/5 - 1;
if (pwr > max_pwr) { if (pwr > max_pwr) {
pwr = max_pwr; pwr = max_pwr;
} }
I2Cdev::writeBitsW(devAddr, A1846S_PABIAS_REG, A1846S_PADRV_BIT, A1846S_PADRV_LENGTH, pwr);
// using open loop reference voltage into Vreg1/2
/*int max_pwr = 78; // 78 = 1.58*255/5 - 1
if (pwr > max_pwr) {
pwr = max_pwr;
}*/
// using loop ref voltage as specified in RF6886 datasheet
// analogWrite(pwr_control_pin, pwr);
} }

View File

@ -89,6 +89,9 @@
#define A1846S_PABIAS_BIT 5 // pabias_voltage<5:0> #define A1846S_PABIAS_BIT 5 // pabias_voltage<5:0>
#define A1846S_PABIAS_LENGTH 6 #define A1846S_PABIAS_LENGTH 6
#define A1846S_PADRV_BIT 14 // pabias_voltage<14:11>
#define A1846S_PADRV_LENGTH 4
// Bitfields for A1846S_BAND_SEL_REG // Bitfields for A1846S_BAND_SEL_REG
#define A1846S_BAND_SEL_BIT 7 // band_sel<1:0> #define A1846S_BAND_SEL_BIT 7 // band_sel<1:0>
#define A1846S_BAND_SEL_LENGTH 2 #define A1846S_BAND_SEL_LENGTH 2

View File

@ -17,7 +17,7 @@ Frequency F<freq>; Set the receive frequency in KHz, if offset is disabl
CDCSS In G<code>; <code> must be a valid CDCSS code No CDCSS In G<code>; <code> must be a valid CDCSS code No
CDCSS Out H<code>; <code> must be a valid CDCSS code No CDCSS Out H<code>; <code> must be a valid CDCSS code No
Print tones I Prints out all configured tones and codes, coma delimited in format: CTCSS In, CTCSS Out, CDCSS In, CDCSS Out No Print tones I Prints out all configured tones and codes, coma delimited in format: CTCSS In, CTCSS Out, CDCSS In, CDCSS Out No
Power level P<level>; Set the power amp level, 0 = lowest, 255 = highest No Power level P<level>; Set the power amp level, 0 = lowest, 15 = highest No
Enable Offset R<state>; 1 turns on repeater offset mode, 0 turns off repeater offset mode No Enable Offset R<state>; 1 turns on repeater offset mode, 0 turns off repeater offset mode No
Squelch S<level>; Set the squelch level No Squelch S<level>; Set the squelch level No
TX Offset T<freq>; The absolute frequency of the repeater offset to transmit on in KHz No TX Offset T<freq>; The absolute frequency of the repeater offset to transmit on in KHz No
@ -81,7 +81,7 @@ void setup() {
radio.setVolume2(0xF); radio.setVolume2(0xF);
radio.setModeReceive(); radio.setModeReceive();
radio.setTxSourceMic(); radio.setTxSourceMic();
radio.setRfPower(255); // 30 is 0.5V, which corresponds to 29 dBm out (see RF6886 datasheet) radio.setRfPower(9);
radio.setSQLoThresh(80); radio.setSQLoThresh(80);
radio.setSQOn(); radio.setSQOn();
} }