diff --git a/App/app/breakout.c b/App/app/breakout.c index 3019745c..3e1ff4e9 100644 --- a/App/app/breakout.c +++ b/App/app/breakout.c @@ -23,7 +23,7 @@ static uint32_t randSeed = 1; static uint8_t blockAnim = 0; -bool isInitialized = false; +static bool isInitialized = false; bool isPaused = false; bool isBeep = false; @@ -36,7 +36,7 @@ int16_t ballCount = BALL_NUMBER; char str[12]; -KeyboardState kbd = {KEY_INVALID, KEY_INVALID, 0}; +static KeyboardState kbd = {KEY_INVALID, KEY_INVALID, 0}; Brick brick[BRICK_NUMBER]; Racket racket; @@ -403,7 +403,7 @@ static void OnKeyDown(uint8_t key) // Key -KEY_Code_t GetKey() +static KEY_Code_t GetKey() { KEY_Code_t btn = KEYBOARD_Poll(); if (btn == KEY_INVALID && GPIO_IsPttPressed()) @@ -414,7 +414,7 @@ KEY_Code_t GetKey() } // HandleUserInput -bool HandleUserInput() +static bool HandleUserInput() { // Store previous key state kbd.prev = kbd.current; diff --git a/App/app/breakout.h b/App/app/breakout.h index 357d173d..afea94c1 100644 --- a/App/app/breakout.h +++ b/App/app/breakout.h @@ -14,6 +14,10 @@ * limitations under the License. */ +#pragma once + +#include "keyboard_state.h" + #include "../bitmaps.h" #include "../board.h" #include "py32f0xx.h" @@ -66,13 +70,6 @@ typedef struct { int8_t dy; // move y } Ball; -typedef struct KeyboardState -{ - KEY_Code_t current; - KEY_Code_t prev; - uint8_t counter; -} KeyboardState; - void initWall(void); void drawWall(void); void initRacket(void); diff --git a/App/app/keyboard_state.h b/App/app/keyboard_state.h new file mode 100644 index 00000000..d14314fe --- /dev/null +++ b/App/app/keyboard_state.h @@ -0,0 +1,24 @@ +/* Copyright 2025 Armel F4HWN + * https://github.com/armel + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include "../driver/keyboard.h" + +typedef struct { + KEY_Code_t current; + KEY_Code_t prev; + uint8_t counter; +} KeyboardState; diff --git a/App/app/spectrum.c b/App/app/spectrum.c index f681c5ac..65ba368f 100644 --- a/App/app/spectrum.c +++ b/App/app/spectrum.c @@ -50,7 +50,7 @@ const uint16_t RSSI_MAX_VALUE = 65535; static uint32_t initialFreq; static char String[32]; -bool isInitialized = false; +static bool isInitialized = false; bool isListening = true; bool monitorMode = false; bool redrawStatus = true; @@ -64,7 +64,7 @@ State currentState = SPECTRUM, previousState = SPECTRUM; PeakInfo peak; ScanInfo scanInfo; -KeyboardState kbd = {KEY_INVALID, KEY_INVALID, 0}; +static KeyboardState kbd = {KEY_INVALID, KEY_INVALID, 0}; #ifdef ENABLE_SCAN_RANGES static uint16_t blacklistFreqs[15]; @@ -268,7 +268,7 @@ static void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y, // Utility functions -KEY_Code_t GetKey() +static KEY_Code_t GetKey() { KEY_Code_t btn = KEYBOARD_Poll(); if (btn == KEY_INVALID && GPIO_IsPttPressed()) @@ -1495,7 +1495,7 @@ static void Render() ST7565_BlitFullScreen(); } -bool HandleUserInput() +static bool HandleUserInput() { kbd.prev = kbd.current; kbd.current = GetKey(); diff --git a/App/app/spectrum.h b/App/app/spectrum.h index b7862a9b..a0e81451 100644 --- a/App/app/spectrum.h +++ b/App/app/spectrum.h @@ -17,6 +17,10 @@ #ifndef SPECTRUM_H #define SPECTRUM_H +#pragma once + +#include "keyboard_state.h" + #include "../bitmaps.h" #include "../board.h" #include "py32f0xx.h" @@ -156,13 +160,6 @@ typedef struct SpectrumSettings bool backlightState; } SpectrumSettings; -typedef struct KeyboardState -{ - KEY_Code_t current; - KEY_Code_t prev; - uint8_t counter; -} KeyboardState; - typedef struct ScanInfo { uint16_t rssi, rssiMin, rssiMax; diff --git a/App/driver/bk4829.c b/App/driver/bk4829.c index 4cbca2e3..4a84de02 100644 --- a/App/driver/bk4829.c +++ b/App/driver/bk4829.c @@ -38,8 +38,8 @@ static const uint16_t FSK_RogerTable[7] = {0xF1A2, 0x7446, 0x61A4, 0x6544, 0x4E8A, 0xE044, 0xEA84}; -static const uint8_t DTMF_TONE1_GAIN = 65; -static const uint8_t DTMF_TONE2_GAIN = 93; +//static const uint8_t DTMF_TONE1_GAIN = 65; +//static const uint8_t DTMF_TONE2_GAIN = 93; static uint16_t gBK4819_GpioOutState;