Made "static" all the variables local to each translation unit

pull/238/head
Silvano Seva 2023-12-26 11:12:31 +01:00
rodzic e54234f968
commit 24c4a25b2d
12 zmienionych plików z 56 dodań i 56 usunięć

Wyświetl plik

@ -64,8 +64,8 @@ typedef struct
} }
state_t; state_t;
extern uint32_t freq_steps[]; extern const uint32_t freq_steps[];
extern size_t n_freq_steps; extern const size_t n_freq_steps;
enum TunerMode enum TunerMode
{ {

Wyświetl plik

@ -32,11 +32,13 @@
state_t state; state_t state;
pthread_mutex_t state_mutex; pthread_mutex_t state_mutex;
long long int lastUpdate = 0; static long long int lastUpdate = 0;
// Commonly used frequency steps, expressed in Hz // Commonly used frequency steps, expressed in Hz
uint32_t freq_steps[] = { 1000, 5000, 6250, 10000, 12500, 15000, 20000, 25000, 50000, 100000 }; const uint32_t freq_steps[] = { 1000, 5000, 6250, 10000, 12500, 15000,
size_t n_freq_steps = sizeof(freq_steps) / sizeof(freq_steps[0]); 20000, 25000, 50000, 100000 };
const size_t n_freq_steps = sizeof(freq_steps) / sizeof(freq_steps[0]);
void state_init() void state_init()
{ {

Wyświetl plik

@ -24,18 +24,16 @@
#include <OpMode_FM.hpp> #include <OpMode_FM.hpp>
#include <OpMode_M17.hpp> #include <OpMode_M17.hpp>
pthread_mutex_t *cfgMutex; // Mutex for incoming config messages static pthread_mutex_t *cfgMutex; // Mutex for incoming config messages
static const rtxStatus_t *newCnf; // Pointer for incoming config messages
static rtxStatus_t rtxStatus; // RTX driver status
static float rssi; // Current RSSI in dBm
static bool reinitFilter; // Flag for RSSI filter re-initialisation
const rtxStatus_t *newCnf; // Pointer for incoming config messages static OpMode *currMode; // Pointer to currently active opMode handler
rtxStatus_t rtxStatus; // RTX driver status static OpMode noMode; // Empty opMode handler for opmode::NONE
static OpMode_FM fmMode; // FM mode handler
float rssi; // Current RSSI in dBm static OpMode_M17 m17Mode; // M17 mode handler
bool reinitFilter; // Flag for RSSI filter re-initialisation
OpMode *currMode; // Pointer to currently active opMode handler
OpMode noMode; // Empty opMode handler for opmode::NONE
OpMode_FM fmMode; // FM mode handler
OpMode_M17 m17Mode; // M17 mode handler
void rtx_init(pthread_mutex_t *m) void rtx_init(pthread_mutex_t *m)
{ {

Wyświetl plik

@ -22,7 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "ADC1_MDx.h" #include "ADC1_MDx.h"
pthread_mutex_t adcMutex; static pthread_mutex_t adcMutex;
void adc1_init() void adc1_init()
{ {

Wyświetl plik

@ -22,7 +22,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "ADC1_Mod17.h" #include "ADC1_Mod17.h"
pthread_mutex_t adcMutex; static pthread_mutex_t adcMutex;
void adc1_init() void adc1_init()
{ {

Wyświetl plik

@ -40,7 +40,7 @@ StreamHandler Dma2_Stream0_hdl = Dma2_Stream0::init(10, DataSize::_16BIT, false)
StreamHandler Dma2_Stream1_hdl = Dma2_Stream1::init(10, DataSize::_16BIT, false); StreamHandler Dma2_Stream1_hdl = Dma2_Stream1::init(10, DataSize::_16BIT, false);
StreamHandler Dma2_Stream2_hdl = Dma2_Stream2::init(10, DataSize::_16BIT, false); StreamHandler Dma2_Stream2_hdl = Dma2_Stream2::init(10, DataSize::_16BIT, false);
struct streamCtx *AdcContext[3]; static struct streamCtx *AdcContext[3];
static constexpr AdcPeriph periph[] = static constexpr AdcPeriph periph[] =
{ {

Wyświetl plik

@ -29,17 +29,17 @@
#include "HR_C6000.h" #include "HR_C6000.h"
#include "AT1846S.h" #include "AT1846S.h"
const rtxStatus_t *config; // Pointer to data structure with radio configuration static const rtxStatus_t *config; // Pointer to data structure with radio configuration
static gdxCalibration_t calData; // Calibration data static gdxCalibration_t calData; // Calibration data
Band currRxBand = BND_NONE; // Current band for RX static Band currRxBand = BND_NONE; // Current band for RX
Band currTxBand = BND_NONE; // Current band for TX static Band currTxBand = BND_NONE; // Current band for TX
uint16_t apcVoltage = 0; // APC voltage for TX output power control static uint16_t apcVoltage = 0; // APC voltage for TX output power control
enum opstatus radioStatus; // Current operating status static enum opstatus radioStatus; // Current operating status
HR_C6000& C6000 = HR_C6000::instance(); // HR_C5000 driver static HR_C6000& C6000 = HR_C6000::instance(); // HR_C5000 driver
AT1846S& at1846s = AT1846S::instance(); // AT1846S driver static AT1846S& at1846s = AT1846S::instance(); // AT1846S driver
void radio_init(const rtxStatus_t *rtxState) void radio_init(const rtxStatus_t *rtxState)
{ {

Wyświetl plik

@ -30,19 +30,19 @@
#include "HR_C5000.h" #include "HR_C5000.h"
#include "SKY72310.h" #include "SKY72310.h"
static const freq_t IF_FREQ = 49950000; // Intermediate frequency: 49.95MHz static const freq_t IF_FREQ = 49950000; // Intermediate frequency: 49.95MHz
const rtxStatus_t *config; // Pointer to data structure with radio configuration static const rtxStatus_t *config; // Pointer to data structure with radio configuration
static md3x0Calib_t calData; // Calibration data static md3x0Calib_t calData; // Calibration data
bool isVhfBand = false; // True if rtx stage is for VHF band static bool isVhfBand = false; // True if rtx stage is for VHF band
uint8_t vtune_rx = 0; // Tuning voltage for RX input filter static uint8_t vtune_rx = 0; // Tuning voltage for RX input filter
uint8_t txpwr_lo = 0; // APC voltage for TX output power control, low power static uint8_t txpwr_lo = 0; // APC voltage for TX output power control, low power
uint8_t txpwr_hi = 0; // APC voltage for TX output power control, high power static uint8_t txpwr_hi = 0; // APC voltage for TX output power control, high power
enum opstatus radioStatus; // Current operating status static enum opstatus radioStatus; // Current operating status
HR_C5000& C5000 = HR_C5000::instance(); // HR_C5000 driver static HR_C5000& C5000 = HR_C5000::instance(); // HR_C5000 driver
/* /*
* Parameters for RSSI voltage (mV) to input power (dBm) conversion. * Parameters for RSSI voltage (mV) to input power (dBm) conversion.

Wyświetl plik

@ -25,8 +25,8 @@
#include <MCP4551.h> #include <MCP4551.h>
#include "../audio/MAX9814.h" #include "../audio/MAX9814.h"
enum opstatus radioStatus; // Current operating status static enum opstatus radioStatus; // Current operating status
extern mod17Calib_t mod17CalData; // Calibration data extern mod17Calib_t mod17CalData; // Calibration data
void radio_init(const rtxStatus_t *rtxState) void radio_init(const rtxStatus_t *rtxState)

Wyświetl plik

@ -31,20 +31,20 @@
#include "AT1846S.h" #include "AT1846S.h"
const rtxStatus_t *config; // Pointer to data structure with radio configuration static const rtxStatus_t *config; // Pointer to data structure with radio configuration
static mduv3x0Calib_t calData; // Calibration data static mduv3x0Calib_t calData; // Calibration data
Band currRxBand = BND_NONE; // Current band for RX static Band currRxBand = BND_NONE; // Current band for RX
Band currTxBand = BND_NONE; // Current band for TX static Band currTxBand = BND_NONE; // Current band for TX
uint8_t txpwr_lo = 0; // APC voltage for TX output power control, low power static uint8_t txpwr_lo = 0; // APC voltage for TX output power control, low power
uint8_t txpwr_hi = 0; // APC voltage for TX output power control, high power static uint8_t txpwr_hi = 0; // APC voltage for TX output power control, high power
uint8_t rxModBias = 0; // VCXO bias for RX static uint8_t rxModBias = 0; // VCXO bias for RX
uint8_t txModBias = 0; // VCXO bias for TX static uint8_t txModBias = 0; // VCXO bias for TX
enum opstatus radioStatus; // Current operating status static enum opstatus radioStatus; // Current operating status
HR_C6000& C6000 = HR_C6000::instance(); // HR_C5000 driver static HR_C6000& C6000 = HR_C6000::instance(); // HR_C5000 driver
AT1846S& at1846s = AT1846S::instance(); // AT1846S driver static AT1846S& at1846s = AT1846S::instance(); // AT1846S driver
void radio_init(const rtxStatus_t *rtxState) void radio_init(const rtxStatus_t *rtxState)
{ {

Wyświetl plik

@ -25,13 +25,13 @@
#include "AT1846S.h" #include "AT1846S.h"
#include "SA8x8.h" #include "SA8x8.h"
const rtxStatus_t *config; // Pointer to data structure with radio configuration static const rtxStatus_t *config; // Pointer to data structure with radio configuration
Band currRxBand = BND_NONE; // Current band for RX static Band currRxBand = BND_NONE; // Current band for RX
Band currTxBand = BND_NONE; // Current band for TX static Band currTxBand = BND_NONE; // Current band for TX
enum opstatus radioStatus; // Current operating status static enum opstatus radioStatus; // Current operating status
AT1846S& at1846s = AT1846S::instance(); // AT1846S driver static AT1846S& at1846s = AT1846S::instance(); // AT1846S driver
void radio_init(const rtxStatus_t *rtxState) void radio_init(const rtxStatus_t *rtxState)

Wyświetl plik

@ -32,8 +32,8 @@
#include <string.h> #include <string.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
void *frameBuffer = NULL; /* Pointer to framebuffer */ static void *frameBuffer = NULL; /* Pointer to framebuffer */
bool inProgress; /* Flag to signal when rendering is in progress */ static bool inProgress; /* Flag to signal when rendering is in progress */
/* /*
* SDL main loop syncronization * SDL main loop syncronization