Make PE4302 optional

pull/4/head
erikkaashoek 5 years ago
parent 0aec13e49e
commit cd3bfac519

@ -26,6 +26,7 @@
#define __SA__ #define __SA__
#define __SI4432__ #define __SI4432__
//#define __PE4302__
//#define __SIMULATION__ //#define __SIMULATION__
//#define __PIPELINE__ //#define __PIPELINE__
#define __SCROLL__ #define __SCROLL__

@ -871,10 +871,12 @@ void calculate_step_delay(void)
void apply_settings(void) // Ensure all settings in the setting structure are translated to the right HW setup void apply_settings(void) // Ensure all settings in the setting structure are translated to the right HW setup
{ {
set_switches(setting.mode); set_switches(setting.mode);
#ifdef __PE4302__
if (setting.mode == M_HIGH) if (setting.mode == M_HIGH)
PE4302_Write_Byte(40); // Ensure defined input impedance of low port when using high input mode (power calibration) PE4302_Write_Byte(40); // Ensure defined input impedance of low port when using high input mode (power calibration)
else else
PE4302_Write_Byte((int)(setting.attenuate * 2)); PE4302_Write_Byte((int)(setting.attenuate * 2));
#endif
if (setting.mode == M_LOW) { if (setting.mode == M_LOW) {
} }
@ -974,8 +976,10 @@ void setupSA(void)
SI4432_Sel = SI4432_LO ; SI4432_Sel = SI4432_LO ;
SI4432_Transmit(0); SI4432_Transmit(0);
#endif #endif
#ifdef __PE4302__
PE4302_init(); PE4302_init();
PE4302_Write_Byte(0); PE4302_Write_Byte(0);
#endif
#if 0 // Measure fast scan time #if 0 // Measure fast scan time
setting.sweep_time_us = 0; setting.sweep_time_us = 0;
setting.additional_step_delay_us = 0; setting.additional_step_delay_us = 0;
@ -1513,7 +1517,9 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking)
if (a < -31) if (a < -31)
a = -31; a = -31;
a = -a; a = -a;
#ifdef __PE4302__
PE4302_Write_Byte((int)(a * 2) ); PE4302_Write_Byte((int)(a * 2) );
#endif
} }
} }
if (setting.mode == M_LOW && S_IS_AUTO(setting.agc) && UNIT_IS_LOG(setting.unit)) { // If in low input mode with auto AGC and log unit if (setting.mode == M_LOW && S_IS_AUTO(setting.agc) && UNIT_IS_LOG(setting.unit)) { // If in low input mode with auto AGC and log unit
@ -1529,7 +1535,9 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking)
int p = setting.attenuate * 2 + am_modulation[modulation_counter++]; int p = setting.attenuate * 2 + am_modulation[modulation_counter++];
if (p>63) p = 63; if (p>63) p = 63;
else if (p< 0) p = 0; else if (p< 0) p = 0;
#ifdef __PE4302__
PE4302_Write_Byte(p); PE4302_Write_Byte(p);
#endif
if (modulation_counter == 5) // 3dB modulation depth if (modulation_counter == 5) // 3dB modulation depth
modulation_counter = 0; modulation_counter = 0;
my_microsecond_delay(setting.modulation == MO_AM_10Hz ? 20000 : 180); my_microsecond_delay(setting.modulation == MO_AM_10Hz ? 20000 : 180);
@ -2039,7 +2047,9 @@ sweep_again: // stay in sweep loop when output mo
// Try update settings // Try update settings
if (changed){ if (changed){
#ifdef __PE4302__
PE4302_Write_Byte((int) get_attenuation() * 2); PE4302_Write_Byte((int) get_attenuation() * 2);
#endif
redraw_request |= REDRAW_CAL_STATUS; redraw_request |= REDRAW_CAL_STATUS;
#ifdef __SI4432__ #ifdef __SI4432__
SI4432_Sel = SI4432_RX ; SI4432_Sel = SI4432_RX ;

@ -658,6 +658,7 @@ void SI4432_SetReference(int freq)
#endif #endif
//------------PE4302 ----------------------------------------------- //------------PE4302 -----------------------------------------------
#ifdef __PE4302__
// Comment out this define to use parallel mode PE4302 // Comment out this define to use parallel mode PE4302
@ -707,7 +708,7 @@ bool PE4302_Write_Byte(unsigned char DATA )
return true; return true;
} }
#endif
#if 0 #if 0
//-----------------SI4432 dummy------------------ //-----------------SI4432 dummy------------------

Loading…
Cancel
Save

Powered by TurnKey Linux.