/* * "tinySA.h" * * This file contains various parameters for the TinySA spectrum analyzer software. * * In general, the user should not have any need to change anything defined in here. * All the things that a user might need to (or want to) change can be found in the * "My_SA.h" file. * * The starting point for this version is the "tinySA_touch02" software developed * by Dave (M0WID). That software is based on the original version by Erik Kaashoek. * * Modified by John Price (WA2FZW): * * Version 1.0: * * Just add comments and try to figure out how it all works! * * * Version 1.7: * * Moved lots of definitions from the main file to here to reduce the clutter * in that file. */ #ifndef TINYSA_H_ #define TINYSA_H_ // Prevent double inclusion #include "my_SA.h" // User settable parameters #include // General Arduino definitions #include #define PROGRAM_NAME "simpleSA" // These are for the WiFi interface #define PROGRAM_VERSION "Version 0.11" // Current version - beta! /* * I think this symbol defines the number of different trace types that are available, * but I'm not sure about that yet. This is the way Dave has it set, so until I figure * it out, it will stay set at '1'. */ #define TRACE_COUNT 1 // Number of different traces available /* * Define variables and functions associated with drawing stuff on the screen. */ #define DISPLAY_POINTS 290 // Number of scan points in a sweep #define BANDSCOPE_POINTS 80 // Number of scan points in a bandscope sweep #define CHAR_HEIGHT 8 // Height of a character #define HALF_CHAR_H 4 // Half a character height #define CHAR_WIDTH 6 // Width of a character #define X_GRID 10 // Number of vertical grid lines #define Y_GRID 10 // Number of horizontal grid lines #define DELTA_X ( DISPLAY_POINTS / X_GRID ) // Spacing of x axis grid lines #define DELTA_Y ( 21 ) // Spacing of y axis grid lines #define X_ORIGIN 27 // 'X' origin of checkerboard #define Y_ORIGIN ( CHAR_HEIGHT * 2 + 3 ) // 'Y' origin of checkerboard #define GRID_HEIGHT ( Y_GRID * DELTA_Y ) // Height of checkerboard #define WATERFALL_HEIGHT 100 // Height of waterfall in Bandscope mode /* * Definitions used in signal generator mode */ enum {SIG_MENU_KEY, SIG_FM_KEY, SIG_AM_KEY, SIG_ON_KEY, SIG_FREQ_KEY, SIG_MOD_KEY}; #define SA_FONT_LARGE "NotoSansBold56" // sig gen mode key position, size and font #define KEY_W 50 // Width and height #define KEY_H 40 #define NUM_W 31 // width for numeric digits #define NUM_H 33 // height for numeric digit +/- keys #define KEY_FONT "NotoSansSCM14" //Semi Condensed Monospaced 14pt #define KEY_COLOR TFT_WHITE #define KEY_SEL_COLOR TFT_CYAN #define KEY_ON_COLOR TFT_GREEN #define KEY_OFF_COLOR TFT_PINK #define SIG_KEY_COUNT 18 #define MAX_SIGLO_FREQ 250000000 #define MIN_SIGLO_FREQ 100 /* * Symbols for the various attenuator options */ #define PE4302_PCF 1 #define PE4302_GPIO 2 #define PE4302_SERIAL 3 /* * Color definitions for the standard displays; Again, these need to be moved to * a separate header file. * * Modified in M0WID Version 05 - Eliminate all but the ILI9431 color definitions. * Modified in WA2FZW Version 1.1 - Change all "DISPLAY_color" to simply "color". * * The "TFT_color" values are defined in the "TFT_eSPI.h" file in the library. */ #define WHITE TFT_WHITE #define BLACK TFT_BLACK #define DARKGREY TFT_DARKGREY #define YELLOW TFT_YELLOW #define ORANGE TFT_ORANGE #define RED TFT_RED #define GREEN TFT_GREEN #define BLUE TFT_BLUE #define PINK TFT_PINK #define LT_BLUE 0x6F1F #define MAGENTA TFT_MAGENTA #define INVERSE TFT_WHITE #define BACKGROUND TFT_BLACK // Default background color #define SCREEN_WIDTH 320 // Display width, in pixels #define SCREEN_HEIGHT 240 // Display height, in pixels #define DELAY_ERROR 2 // Time in seconds to show error message on display #define ERR_INFO 1 // Informational type error #define ERR_WARN 2 // Warning #define ERR_FATAL 3 // Fatal error /* * A factor used to increase the number of measurement points above that calculated by * just dividing the sweep span by the RBW. Allows for some overlap to reduce the effect * of the 3dB drop at the filter edges */ #define OVERLAP 1.1 /* * Minimum delay left for the websockets to be checked while waiting * for the SI4432 filters to settle * Webocket.loop() takes around 35microseconds, varies a bit */ #define MIN_DELAY_WEBSOCKETS 50 /* * These are the minimum and maximum values for the "IF Frequency". In reality, testing has * shown that settings of more than about 100KHz from the normal 433.92MHz cause lots of * spurs, but some SAW filters may behave differently. */ #define MIN_IF_FREQ 433000000UL // 433MHz #define MAX_IF_FREQ 435000000UL // 435MHz /* * Tracking Generator offset limits - note signed */ #define MIN_TG_OFFSET -1000000L // -1MHz #define MAX_TG_OFFSET 1000000L // +1MHz /* * SI4432 max and min drive levels */ #define MIN_DRIVE 0 #define MAX_DRIVE 7 /* * SI4432 MAx no of bandpass filters */ #define MAX_SI4432_FILTERS 57 /* * The various operating modes: * * Only SA_LOW_RANGE implemented so far - some of these may never get implemented! * Low range is using the mixer, range around 1Mhz-250Mhz depending on low pass * filter installed. * * High range is direct to the LO SI4432, bypassing mixer, attenuator and filters, * range approx 240MHz - 930Mhz * * High range performance will be limited due to no bandpass filtering other than * in SI4432 itself. */ enum { SA_LOW_RANGE, SA_HIGH_RANGE, SIG_GEN_LOW_RANGE, SIG_GEN_HIGH_RANGE, IF_SWEEP, ZERO_SPAN_LOW_RANGE, ZERO_SPAN_HIGH_RANGE, BANDSCOPE, RX_SWEEP, OTA_UPDATE }; /* * The "AV_XXXX" symbols define various options for how readings are averaged" */ enum { AV_OFF, AV_MIN, AV_MAX, AV_2, AV_4, AV_8 }; /* * Modulation types for signal generator mode */ enum { MOD_OFF, MOD_AM, MOD_FM, NOISE }; /* * This is a macro that is used to determine the number of elements in an array. It figures * that out by dividing the total size of the array by the size of a single element. This is * how we will calculate the number of entries in the "msgTable" array. */ #define ELEMENTS(x) ( sizeof ( x ) / sizeof ( x[0] )) #define min(a,b) ( a