updated setRfPower function. It now sets the PADRV bits on the AU1846
This commit is contained in:
		
							parent
							
								
									81fc8a6566
								
							
						
					
					
						commit
						0bfd349b64
					
				| 
						 | 
				
			
			@ -384,7 +384,7 @@ void HamShield::setTX(bool on_noff){
 | 
			
		|||
      setGpioLow(5); // remember that RX and TX are active low
 | 
			
		||||
      // then turn on VREG (PWM output)
 | 
			
		||||
      // 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
 | 
			
		||||
| 
						 | 
				
			
			@ -943,19 +943,12 @@ void HamShield::setRfPower(uint8_t pwr) {
 | 
			
		|||
   // (see RF6886 datasheet)
 | 
			
		||||
   // 30 is 0.5V, which is ~min loop reference 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) {
 | 
			
		||||
     pwr = max_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);
 | 
			
		||||
   I2Cdev::writeBitsW(devAddr, A1846S_PABIAS_REG, A1846S_PADRV_BIT, A1846S_PADRV_LENGTH, pwr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,6 +89,9 @@
 | 
			
		|||
#define A1846S_PABIAS_BIT          5  // pabias_voltage<5:0>
 | 
			
		||||
#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
 | 
			
		||||
#define A1846S_BAND_SEL_BIT        7  // band_sel<1:0>
 | 
			
		||||
#define A1846S_BAND_SEL_LENGTH     2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 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
 | 
			
		||||
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
 | 
			
		||||
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
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +81,7 @@ void setup() {
 | 
			
		|||
  radio.setVolume2(0xF);
 | 
			
		||||
  radio.setModeReceive();
 | 
			
		||||
  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.setSQOn();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue