/* * "My_SA.h" * * Added in Version 2.2 by John Price (WA2FZW): * * This file contains all the user settable parameters for the TinySA spectrum * analyzer software. If tou change anything in any of the header files, you've * just become a test pilot! */ #ifndef _MY_SA_H_ #define _MY_SA_H_ // Prevent double inclusion //#define GLENN_BUILD /* * The following definitions are all related to the WiFi interface. If you don't want * to use the WiFi interface, set the "USE_WIFI" definition to 'false'. * * If you are going to use the WiFi interface, you'll need to set the "WIFI_SSID" * and "WIFI_PASSWORD" symbols to the appropriate values for your network. * * Don't comment out the SSID and password definitions. Doing so will cause compiler * errors. */ #define USE_WIFI true // Changed in Version 2.6 to true/false // #define USE_ACCESS_POINT // Comment out if want to connect to SSID, leave in to use access point // #define AP_PASSWORD "none" #define WIFI_SSID ":)" // SSID of your WiFi if not using access point #define WIFI_PASSWORD "S0ftR0ckRXTX" // Password for your WiFi #define MAX_WIFI_POINTS 75 // was 150 Number of sample points to send to clients in each wifi chunk // Some clients cannot handle too few (too frequent chart refresh) // ** IMPORTANT ** Must be less than or equal to DISPLAY_POINTS (290) #define WIFI_UPDATE_TARGET_TIME 500000 // No of microseconds to target chart updates. #define WEBSOCKET_INTERVAL 2000 // Microseconds between check for websocket events if no client connected /* * You can set your own colors for the various traces, but you can only choose * from the following colors: * * WHITE YELLOW ORANGE GREEN RED BLUE PINK LT_BLUE MAGENTA */ #define DB_COLOR YELLOW #define GAIN_COLOR GREEN #define AVG_COLOR MAGENTA #define STORAGE_COLOR LT_BLUE #define SIG_BACKGROUND_COLOR TFT_DARKGREY #define SLIDER_BOX_HEIGHT 8 #define SLIDER_BOX_COLOR TFT_LIGHTGREY #define SLIDER_FILL_COLOR TFT_ORANGE #define SLIDER_KNOB_RADIUS 15 // Sprite is twice this high #define SLIDER_WIDTH 200 // Sprite width is this plus twice knob radius #define SLIDER_KNOB_COLOR TFT_WHITE #define SLIDER_X 10 #define SLIDER_Y 195 //#define SHOW_FREQ_UP_DOWN_BUTTONS // Comment out if you don't like them! // #define SLIDER_MIN_POWER -43.0 // in dBm // #define SLIDER_MAX_POWER -13.0 #define ATTENUATOR_RANGE 30 // in dB // the B3555 SAW filter has max power rating of 10dBm. // Drive of 4 = 11dBm but 1 dB pad in my build. If you have a larger attenuator pad you can try higher powers #define RX_SI4432_MAX_DRIVE 4 // corresponds to 11dBm /* * These definitions control the values that get set when you select "AUTO SETTINGS" from * the main touch screen menu; feel free to change them as you wish, but the legal values * for some of them won't be obvious, so do your research first! */ #define AUTO_SWEEP_START 0 // Default sewwp start is 0Hz #define AUTO_SWEEP_STOP 100000000 // Default stop is 100MHz #define AUTO_PWR_GRID 10 // 10 dB per horizontal division #define AUTO_LNA 0x60 // Receiver Si4432 AGC on #define AUTO_REF_LEVEL -10 // Top line of the grid is at -10dB #define AUTO_REF_OUTPUT 1 // Transmitter GPIO2 is 15MHz #define AUTO_ATTEN 0 // No attenuation #define AUTO_RBW 0 // Automatic RBW /* * Some definitions for IF-Sweep to test the internal SAW filters */ #define IF_SWEEP_START 432000000 #define IF_SWEEP_STOP 435000000 // Limits for keypad entry of IF sweep frequency start/stop #define IF_STOP_MAX 500000000 // 500MHz #define IF_START_MIN 400000000 // 400MHz /* * Some definitions for RX-Sweep to test the internal FIR filters */ #define RX_SWEEP_START 432000000 #define RX_SWEEP_STOP 436000000 // Limits for keypad entry of IF sweep frequency start/stop #define RX_STOP_MAX 440000000 // 500MHz #define RX_START_MIN 430000000 // 400MHz /* * Spur reduction shifts the IF down from its normal setting every other scan * Set MAX_IF_SHIFT so that the IF cannot go outside the flat top of the SAW filter passband */ #define MAX_IF_SHIFT 300000 // Maximum shift of IF (Hz) in spur reduction mode #define PAST_PEAK_LIMIT 3 // number of consecutive lower values to detect a peak #define MARKER_NOISE_LIMIT 20 // Don't display marker if its RSSI value is < (min for sweep + this) #define MARKER_MIN_FREQUENCY 750000 // Ignore values at lower frequencies as probably IF bleed through. /* * There are three possible implementations for the PE4302 attenuator: * * The parallel version using a PCF8574 I2C GPIO expander interface to the processor * The parallel version using six separate GPIO pins to interface with the processor * The serial version. * * Change the following definition to select the version you are using. The options are: * * PE4302_PCF * PE4302_GPIO * PE4302_SERIAL */ #define PE4302_TYPE PE4302_SERIAL /* * If you're using the "PE4302_PCF" mode, you need to define the I2C address for * the PCF8574: */ // #define PCF8574_ADDRESS 0x38 // Change for your device if necessary /* * If you're using the "PE4302_SERIAL" mode, you need to define the chip select (LE) * pin number: */ #define PE4302_LE 21 // Chip Select for the serial attenuator /* * If you're using the "PE4302_GPIO" mode, you need to define the GPIO pins used for * the six data inputs to the PE4302: */ // #define DATA_0 nn // Replace the "nn" with real pin numbers // #define DATA_1 nn // #define DATA_2 nn // #define DATA_3 nn // #define DATA_4 nn // #define DATA_5 nn /* * If you're using the PE4302 attenuator, the 'ATTEN' command will set the attenuation. * The maximum setting for the PE4302 is 31dB. If you have some other attenuator arrangement * you can change this value appropriately so that the software can take into account * a higher attenuation; but note only the PE4302 will actually be congigured by the code. */ #define PE4302_MAX 31 /* * The Si4432 is an SPI device and we have it set up to use the ESP32's VSPI bus. * * Here, we define the chip select GPIO pins for the two Si4432 modules and the GPIO * pins for the clock and data lines. */ #define SI_RX_CS 4 // Receiver chip select pin #define SI_TX_CS 5 // Transmitter chip select pin #define V_SCLK 18 // VSPI clock pin #define V_SDI 23 // VSPI SDI (aka MOSI) pin #define V_SDO 19 // VSPI SDO (aka MISO) pin /* * An option is add more SI4432 devices to make a tracking generator * Options are for a single one producing the IF where the LO is tapped off from the TinySA LO * or two where the track gen LO is generated with another SI4432 to give improved * isolation and therefore better dynamic range. * Do NOT comment out these definitions if you plan to install/test with TG physically * installed. * */ #define SI_TG_IF_CS 2 // pin to use for tracking gen IF SI4432 #define SI_TG_LO_CS 25 // pin to use for tracking gen LO SI4432 /* * Comment both lines below out if you do not have the tracking generator * If only one SI4432 comment out the TG_LO_INSTALLED line * Leave both uncommented if you have the two SI4432 TG option */ #define TG_IF_INSTALLED #define TG_LO_INSTALLED /* * These two definitions are used to tune the Si4432 module frequencies. Once you have * performed the frequency calibration as explained in the documentation, you should * change the values defined here to the values you determined appropriate in the * calibration procedure or they may be lost when new software versions are released. * * The values here were Erik's original values */ #define TX_CAPACITANCE 0x65 // Transmitter (LO) crystal load capacitance #define RX_CAPACITANCE 0x59 // Receiver crystal load capacitance #define TG_LO_CAPACITANCE 0x64 // Tracking generator LO crystal load capacitance #define TG_IF_CAPACITANCE 0x62 // Tracking generator IF crystal load capacitance #define RX_PASSBAND_OFFSET 1300 // RX bandpass filters are offset from nominal IF by this /* * "CAL_POWER" is the calibrated power level determined when doing the calibration * procedure. As is the case with the crystal capacitances, you should change the * value here to prevent the calibration from being lost when new versions of the * code are released. */ #define CAL_POWER -30 // Si4432 GPIO2 normal reference level /* * The default transmitter Si4432 power output is based on the type of mixer being used. * For the ADE-1 mixer should be +7dBm and +17dBm for the ADE-25H mixer. * * The definition of "MIXER" can be set to one of the following symbols, or you can * define a power setting numerically (refer to A440). * * MIX_ADE_1 // For the ADE-1 mixer module * MIX_ADE_25H // For the ADE-25H mixer module * MIX_MINIMUM // Minimum power for testing */ #define MIXER MIX_ADE_25H // High power /* * These define the sweep range limits. The unit is capable of sweeping up to 430MHz, * but if you're using Glenn's PCBx, there is a 200MHz LPF on the input, so anyone * using that (or some other input LPF) might want to change the maximum frequency * accordingly. */ #define STOP_MAX 250000000 // 250MHz #define START_MIN 0 // 0MHz /* * The "FOCUS_FACTOR" is used in conjunction with the "FOCUS" command (from either * the serial interface or touch screen). The requested focus frequency is divided * by the "FOCUS_FACTOR" to set the frequency span. * * So for example, if you request a focus frequency of 50MHz, and the "FOCUS_FACTOR" * is set to 1000, 50MHz / 1000 = 25KHz which would be the total span. In other words, * the sweep frequency range would be from 49.975MHz to 50.025MHz. But since the * readings on the grid are only good to 2 decimal places, the display may not indicate * the exact span. */ #define FOCUS_FACTOR 1000UL /* * "TS_MINIMUM_Z" is the minimum touch pressure that will be considered to indicate a * valid touch screen touch. It was originally hard-coded in the "ui.cpp" module as * '600', but that proved to be too much for some displays, so now you can set it to * see what works for your particular display. */ #define TS_MINIMUM_Z 600 // The original setting /* * The "BACKLIGHT_LEVEL" setting can be used to control the brightness of the backlight * of the TFT display. Presently, there is no place in the menu system where this can be * adjusted, so if using the adjustable option, you have to set the symbol appropriately * * Glenn's PCB provides the option to simply connect the backlight to 3V3 through an * appropriate resistor. * Comment out if not using the PWM backlight (uses GPIO25 which can then be used for * a tracking generator, but not both) */ // #define BACKLIGHT_LEVEL 50 // Level setting /* * We haven't implemented the use of a rotary encoder to control the menu selections * yet, but if we ever do, the GPIO pins that it uses need to be defined. The ones * defined here are based on Glenn's PCB design. */ #ifdef USE_ROTARY // Not defined anywhere! #define ENC_PB 32 // Encoder pushbutton switch #define ENC_BB 33 // Back button pushbutton switch (or TS_INT) #define ENC_B 34 // Encoder pin "B" (input only pin) #define ENC_A 35 // Encoder pin "A" (input only pin) #endif #endif // #ifndef _MY_SA_H_