unleashed-firmware/applications/external/spectrum_analyzer/spectrum_analyzer.h

80 lines
2.0 KiB
C
Raw Normal View History

2022-06-06 17:20:46 +03:00
#define NUM_CHANNELS 132
2022-06-22 04:11:52 +03:00
#define NUM_CHUNKS 6
#define CHUNK_SIZE (NUM_CHANNELS / NUM_CHUNKS)
2022-06-06 17:20:46 +03:00
// Screen coordinates
#define FREQ_BOTTOM_Y 50
#define FREQ_START_X 14
// How many channels displayed on the scale (On screen still 218)
#define FREQ_LENGTH_X 102
// dBm threshold to show peak value
#define PEAK_THRESHOLD -85
/*
* ultrawide mode: 80 MHz on screen, 784 kHz per channel
* wide mode (default): 20 MHz on screen, 196 kHz per channel
* narrow mode: 4 MHz on screen, 39 kHz per channel
2022-06-22 04:11:52 +03:00
* ultranarrow mode: 2 MHz on screen, 19 kHz per channel
2023-07-20 04:55:36 +03:00
* pricse mode: 400 KHz on screen, 3.92 kHz per channel
2022-06-06 17:20:46 +03:00
*/
#define WIDE 0
#define NARROW 1
#define ULTRAWIDE 2
2022-06-22 04:11:52 +03:00
#define ULTRANARROW 3
2023-07-20 04:55:36 +03:00
#define PRECISE 4
2022-06-06 17:20:46 +03:00
/* channel spacing in Hz */
#define WIDE_SPACING 196078
#define NARROW_SPACING 39215
#define ULTRAWIDE_SPACING 784313
2022-06-22 04:11:52 +03:00
#define ULTRANARROW_SPACING 19607
2023-07-20 04:55:36 +03:00
#define PRECISE_SPACING 3921
2022-06-06 17:20:46 +03:00
/* vertical scrolling */
#define VERTICAL_SHORT_STEP 16
#define MAX_VSCROLL 120
#define MIN_VSCROLL 0
#define DEFAULT_VSCROLL 48
2023-07-20 04:55:36 +03:00
/* frequencies in KHz */
#define DEFAULT_FREQ 440000
#define WIDE_STEP 5000
#define NARROW_STEP 1000
#define ULTRAWIDE_STEP 20000
2023-07-20 22:00:49 +03:00
#define ULTRANARROW_STEP 500
2023-07-20 04:55:36 +03:00
#define PRECISE_STEP 100
/* margin in KHz */
#define WIDE_MARGIN 13000
#define NARROW_MARGIN 3000
#define ULTRAWIDE_MARGIN 42000
#define ULTRANARROW_MARGIN 1000
#define PRECISE_MARGIN 200
2022-06-06 17:20:46 +03:00
/* frequency bands supported by device */
#define BAND_300 0
#define BAND_400 1
#define BAND_900 2
2023-07-20 04:55:36 +03:00
/* band limits in KHz */
#define MIN_300 281000
#define CEN_300 315000
#define MAX_300 361000
#define MIN_400 378000
#define CEN_400 435000
#define MAX_400 481000
#define MIN_900 749000
#define CEN_900 855000
#define MAX_900 962000
2022-06-06 17:20:46 +03:00
2023-07-20 04:55:36 +03:00
/* band transition points in KHz */
#define EDGE_400 369000
#define EDGE_900 615000
2022-06-06 17:20:46 +03:00
/* VCO transition points in Hz */
#define MID_300 318000000
#define MID_400 424000000
#define MID_900 848000000
#define UPPER(a, b, c) ((((a) - (b) + ((c) / 2)) / (c)) * (c))
2022-06-22 04:11:52 +03:00
#define LOWER(a, b, c) ((((a) + (b)) / (c)) * (c))