0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 14:48:03 +03:00

Lots n lots

This commit is contained in:
OneOfEleven
2023-10-29 22:33:38 +00:00
parent 230fdccf10
commit f3e347bc5a
39 changed files with 951 additions and 770 deletions

View File

@ -55,10 +55,17 @@ static void ACTION_FlashLight(void)
case FLASHLIGHT_BLINK:
g_flash_light_blink_tick_10ms = 0;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
g_flash_light_state = FLASHLIGHT_SOS;
if (g_current_function == FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_RECEIVE);
break;
case FLASHLIGHT_SOS:
#ifdef ENABLE_FLASH_LIGHT_SOS_TONE
BK4819_StopTones(g_current_function == FUNCTION_TRANSMIT);
#endif
// Fallthrough
@ -89,29 +96,39 @@ void ACTION_Power(void)
void ACTION_Monitor(void)
{
if (g_current_function != FUNCTION_MONITOR)
{ // enable the monitor
RADIO_select_vfos();
if (!g_monitor_enabled) // (g_current_function != FUNCTION_MONITOR)
{ // enable monitor mode
g_beep_to_play = BEEP_NONE;
g_monitor_enabled = true;
// g_squelch_open = true;
#ifdef ENABLE_NOAA
if (g_rx_vfo->channel_save >= NOAA_CHANNEL_FIRST && g_is_noaa_mode)
// if (g_rx_vfo->channel_save >= NOAA_CHANNEL_FIRST && g_is_noaa_mode)
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_is_noaa_mode)
g_noaa_channel = g_rx_vfo->channel_save - NOAA_CHANNEL_FIRST;
#endif
g_monitor_enabled = true;
RADIO_setup_registers(true);
APP_start_listening(FUNCTION_MONITOR);
APP_start_listening();
return;
}
// disable monitor
g_monitor_enabled = false;
if (!g_speaker_enabled)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
g_scan_pause_10ms = g_eeprom.scan_hold_time_500ms * 50;
g_scan_pause_tick_10ms = g_eeprom.scan_hold_time_500ms * 50;
#ifdef g_power_save_expired
if (g_eeprom.dual_watch == DUAL_WATCH_OFF && g_is_noaa_mode)
{
g_noaa_tick_10ms = noaa_tick_10ms;
g_schedule_noaa = false;
g_schedule_noaa = false;
}
#endif
@ -134,12 +151,12 @@ void ACTION_Scan(bool bRestart)
if (g_fm_radio_mode)
{
if (g_current_function != FUNCTION_RECEIVE &&
g_current_function != FUNCTION_MONITOR &&
g_current_function != FUNCTION_TRANSMIT)
g_current_function != FUNCTION_TRANSMIT &&
!g_monitor_enabled)
{
GUI_SelectNextDisplay(DISPLAY_FM);
g_monitor_enabled = false;
// g_monitor_enabled = false;
if (g_fm_scan_state != FM_SCAN_OFF)
{ // already scanning
@ -186,6 +203,7 @@ void ACTION_Scan(bool bRestart)
{ // not in freq/ctcss/cdcss search mode
g_monitor_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
DTMF_clear_RX();
@ -213,7 +231,7 @@ void ACTION_Scan(bool bRestart)
// jump to the next channel
APP_channel_next(true, g_scan_state_dir);
g_scan_pause_10ms = 0;
g_scan_pause_tick_10ms = 0;
g_scan_pause_time_mode = false;
g_update_status = true;
@ -233,13 +251,14 @@ void ACTION_Scan(bool bRestart)
// start scanning
// disable monitor mode
g_monitor_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
RADIO_setup_registers(true);
APP_channel_next(true, SCAN_STATE_DIR_FORWARD);
g_scan_pause_10ms = 0; // go NOW
g_scan_pause_tick_10ms = 0; // go NOW
g_scan_pause_time_mode = false;
#ifdef ENABLE_VOICE
@ -270,14 +289,13 @@ void ACTION_Scan(bool bRestart)
// jump to the next channel
APP_channel_next(true, g_scan_state_dir);
g_scan_pause_10ms = 0;
g_scan_pause_tick_10ms = 0;
g_scan_pause_time_mode = false;
g_update_status = true;
}
else
{ // stop scanning
g_monitor_enabled = false;
APP_stop_scan();
g_request_display_screen = DISPLAY_MAIN;
}
@ -324,7 +342,9 @@ void ACTION_Scan(bool bRestart)
#ifdef ENABLE_FMRADIO
void ACTION_FM(void)
{
if (g_current_function != FUNCTION_TRANSMIT && g_current_function != FUNCTION_MONITOR)
if (g_current_function != FUNCTION_TRANSMIT &&
// g_current_function != FUNCTION_MONITOR
!g_monitor_enabled)
{
if (g_fm_radio_mode)
{
@ -332,7 +352,7 @@ void ACTION_Scan(bool bRestart)
g_input_box_index = 0;
#ifdef ENABLE_VOX
g_vox_resume_count_down = 80;
g_vox_resume_tick_10ms = 80;
#endif
g_flag_reconfigure_vfos = true;
@ -340,7 +360,7 @@ void ACTION_Scan(bool bRestart)
return;
}
g_monitor_enabled = false;
// g_monitor_enabled = false;
RADIO_select_vfos();
RADIO_setup_registers(true);
@ -372,10 +392,7 @@ void ACTION_process(const key_code_t Key, const bool key_pressed, const bool key
}
if (!key_held && key_pressed)
{
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
return;
}
if (key_held || key_pressed)
{

View File

@ -80,6 +80,8 @@ void AIRCOPY_init(void)
// turn the backlight ON
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
RADIO_setup_registers(true);
BK4819_SetupAircopy(AIRCOPY_DATA_PACKET_SIZE);

610
app/app.c

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ extern const uint8_t orig_pga;
void APP_end_tx(void);
void APP_stop_scan(void);
void APP_channel_next(const bool remember_current, const scan_state_dir_t scan_direction);
bool APP_start_listening(function_type_t Function);
bool APP_start_listening(void);
uint32_t APP_set_frequency_by_step(vfo_info_t *pInfo, int8_t Step);
void APP_time_slice_10ms(void);
void APP_time_slice_500ms(void);

View File

@ -439,8 +439,8 @@ bool DTMF_Reply(void)
if (g_eeprom.dtmf_side_tone)
{ // the user will also hear the transmitted tones
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = true;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
}
SYSTEM_DelayMs(Delay);
@ -455,8 +455,8 @@ bool DTMF_Reply(void)
g_eeprom.dtmf_code_persist_time,
g_eeprom.dtmf_code_interval_time);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
BK4819_ExitDTMF_TX(false);

View File

@ -98,16 +98,19 @@ int FM_ConfigureChannelState(void)
void FM_TurnOff(void)
{
g_fm_radio_mode = false;
g_fm_scan_state = FM_SCAN_OFF;
g_fm_radio_mode = false;
g_fm_scan_state = FM_SCAN_OFF;
g_fm_restore_tick_10ms = 0;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = false;
if (!g_monitor_enabled)
{
g_speaker_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
}
BK1080_Init(0, false);
g_update_display = true;
g_update_status = true;
}
@ -125,9 +128,8 @@ void FM_EraseChannels(void)
void FM_Tune(uint16_t Frequency, int8_t Step, bool flag)
{
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_fm_play_tick_10ms = (g_fm_scan_state == FM_SCAN_OFF) ? fm_play_noscan_10ms : fm_play_scan_10ms;
@ -169,12 +171,13 @@ void FM_PlayAndUpdate(void)
SETTINGS_save_fm();
g_fm_play_tick_10ms = 0;
g_schedule_fm = false;
g_ask_to_save = false;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_schedule_fm = false;
g_ask_to_save = false;
g_speaker_enabled = true;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_update_display = true;
}
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
@ -402,9 +405,12 @@ static void FM_Key_STAR(bool key_pressed, bool key_held)
static void FM_Key_EXIT(bool key_pressed, bool key_held)
{
(void)key_held;
g_key_input_count_down = key_input_timeout_500ms;
if (key_held || key_pressed)
// if (key_held || key_pressed)
if (key_pressed)
return;
if (g_fm_scan_state == FM_SCAN_OFF)
@ -460,12 +466,15 @@ static void FM_Key_EXIT(bool key_pressed, bool key_held)
static void FM_Key_MENU(bool key_pressed, bool key_held)
{
(void)key_held;
unsigned int i;
int channel = -1;
g_key_input_count_down = key_input_timeout_500ms;
if (key_held || key_pressed)
// if (key_held || key_pressed)
if (key_pressed)
return; // key still pressed
// see if the frequency is already stored in a channel
@ -513,7 +522,7 @@ static void FM_Key_MENU(bool key_pressed, bool key_held)
else
g_ask_to_delete = true;
}
return;
}
@ -666,8 +675,8 @@ void FM_Play(void)
if (!g_eeprom.fm_channel_mode)
g_eeprom.fm_selected_frequency = g_eeprom.fm_frequency_playing;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = true;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
GUI_SelectNextDisplay(DISPLAY_FM);
return;
@ -694,14 +703,15 @@ void FM_Play(void)
void FM_Start(void)
{
g_fm_radio_mode = true;
g_fm_scan_state = FM_SCAN_OFF;
g_fm_radio_mode = true;
g_fm_scan_state = FM_SCAN_OFF;
g_fm_restore_tick_10ms = 0;
BK1080_Init(g_eeprom.fm_frequency_playing, true);
g_speaker_enabled = true;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = true;
g_update_display = true;
g_update_status = true;
}

View File

@ -41,13 +41,14 @@
#include "radio.h"
#include "settings.h"
#include "ui/inputbox.h"
#include "ui/ui.h"
#include "ui/main.h"
#include "ui/menu.h"
#include "ui/ui.h"
bool scanning_paused(void)
{
if ((g_scan_state_dir != SCAN_STATE_DIR_OFF || g_eeprom.dual_watch != DUAL_WATCH_OFF) &&
g_scan_pause_10ms > 0 && g_scan_pause_10ms <= (200 / 10))
g_scan_pause_tick_10ms > 0 && g_scan_pause_tick_10ms <= (200 / 10))
{ // scanning isn't paused
return false;
}
@ -130,6 +131,7 @@ void toggle_chan_scanlist(void)
RADIO_select_vfos();
RADIO_ApplyOffset(g_tx_vfo, false);
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
RADIO_setup_registers(true);
// find the first channel that contains this frequency
@ -427,7 +429,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
{ // key held down
if (key_pressed)
{ // and pressed
{
if (g_current_display_screen == DISPLAY_MAIN)
{
if (g_input_box_index > 0)
@ -473,7 +475,9 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
INPUTBOX_append(Key);
g_request_display_screen = DISPLAY_MAIN;
UI_DisplayMain();
// g_request_display_screen = DISPLAY_MAIN;
if (IS_USER_CHANNEL(g_tx_vfo->channel_save))
{ // user is entering channel number
@ -483,9 +487,8 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
if (g_input_box_index != 3)
{
#ifdef ENABLE_VOICE
g_another_voice_id = (voice_id_t)Key;
g_another_voice_id = (voice_id_t)Key;
#endif
g_request_display_screen = DISPLAY_MAIN;
return;
}
@ -500,7 +503,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
}
#ifdef ENABLE_VOICE
g_another_voice_id = (voice_id_t)Key;
g_another_voice_id = (voice_id_t)Key;
#endif
g_eeprom.user_channel[Vfo] = (uint8_t)Channel;
@ -508,6 +511,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_update_display = true;
return;
}
@ -521,7 +525,6 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
#ifdef ENABLE_VOICE
g_another_voice_id = (voice_id_t)Key;
#endif
return;
}
@ -578,6 +581,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
g_request_save_channel = 1;
g_vfo_configure_mode = VFO_CONFIGURE;
g_update_display = true;
return;
}
@ -594,7 +598,7 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
#ifdef ENABLE_VOICE
g_another_voice_id = (voice_id_t)Key;
#endif
g_request_display_screen = DISPLAY_MAIN;
// g_request_display_screen = DISPLAY_MAIN;
return;
}
@ -611,13 +615,16 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
g_eeprom.screen_channel[Vfo] = Channel;
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_update_display = true;
return;
}
}
#endif
g_request_display_screen = DISPLAY_MAIN;
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
g_update_display = true;
// g_request_display_screen = DISPLAY_MAIN;
}
void MAIN_Key_EXIT(bool key_pressed, bool key_held)
@ -671,18 +678,36 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held)
return;
}
if (key_held && key_pressed)
{ // exit key held down
if (g_input_box_index > 0 || g_dtmf_input_box_index > 0 || g_dtmf_input_mode)
{ // cancel key input mode (channel/frequency entry)
g_dtmf_input_mode = false;
g_dtmf_input_box_index = 0;
memset(g_dtmf_string, 0, sizeof(g_dtmf_string));
g_input_box_index = 0;
g_request_display_screen = DISPLAY_MAIN;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
if (!key_held)
return;
if (key_pressed)
return;
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode)
{
ACTION_FM();
return;
}
#endif
if (g_input_box_index > 0 || g_dtmf_input_box_index > 0 || g_dtmf_input_mode)
{ // cancel key input mode (channel/frequency entry)
g_dtmf_input_mode = false;
g_dtmf_input_box_index = 0;
memset(g_dtmf_string, 0, sizeof(g_dtmf_string));
g_input_box_index = 0;
g_request_display_screen = DISPLAY_MAIN;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
return;
}
if (g_flash_light_state != FLASHLIGHT_OFF && g_flash_light_state != FLASHLIGHT_SOS)
{ // the the flash light off
g_flash_light_state = FLASHLIGHT_OFF;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
return;
}
}
@ -831,14 +856,17 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
if (!key_pressed)
{
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_FREQ_CHANNEL(Channel))
{ // key released in frequency mode
if (g_scan_state_dir == SCAN_STATE_DIR_OFF &&
(Channel <= USER_CHANNEL_LAST || IS_FREQ_CHANNEL(Channel)))
{ // key released
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
if (key_held && !monitor_was_enabled && g_current_function == FUNCTION_MONITOR)
if (key_held && !monitor_was_enabled)
{ // re-enable the squelch
APP_start_listening(FUNCTION_RECEIVE);
g_monitor_enabled = false;
APP_start_listening();
}
#endif
@ -898,7 +926,7 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
uint8_t Next;
if (IS_FREQ_CHANNEL(Channel))
{ // step/down in frequency
{ // frequency mode
frequency_band_t new_band;
const frequency_band_t old_band = FREQUENCY_GetBand(g_tx_vfo->freq_config_rx.frequency);
@ -947,7 +975,7 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
if (key_held && key_pressed && !monitor_was_enabled)
{ // open the squelch if the user holds the key down
g_monitor_enabled = true;
APP_start_listening(FUNCTION_MONITOR);
APP_start_listening();
}
#endif
@ -958,9 +986,20 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
return;
}
// suppress audio click
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = false;
// channel mode
g_tx_vfo->freq_in_channel = 0xff;
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
if (!key_held && key_pressed)
monitor_was_enabled = g_monitor_enabled;
if (key_held && key_pressed && !monitor_was_enabled)
{ // open the squelch if the user holds the key down
g_monitor_enabled = true;
APP_start_listening();
}
#endif
Next = RADIO_FindNextChannel(Channel + Direction, Direction, false, 0);
if (Next == 0xFF)
@ -989,20 +1028,23 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
}
#endif
g_request_save_vfo = true;
if (!key_held && key_pressed) // save when the user releases the button - save a LOT of eeprom wear
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
return;
}
// g_speaker_enabled = false;
// g_monitor_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
g_speaker_enabled = false;
// jump to the next channel
APP_channel_next(false, Direction);
// go NOW
g_scan_pause_10ms = 0;
g_scan_pause_tick_10ms = 0;
g_scan_pause_time_mode = false;
g_squelch_open = false;
g_rx_reception_mode = RX_MODE_NONE;
@ -1020,9 +1062,12 @@ void MAIN_process_key(key_code_t key, bool key_pressed, bool key_held)
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode && key != KEY_PTT && key != KEY_EXIT)
{
if (!key_held && key_pressed)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
if (g_current_display_screen == DISPLAY_FM)
{
if (!key_held && key_pressed)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
}
#endif
@ -1061,10 +1106,10 @@ void MAIN_process_key(key_code_t key, bool key_pressed, bool key_held)
MAIN_Key_MENU(key_pressed, key_held);
break;
case KEY_UP:
MAIN_Key_UP_DOWN(key_pressed, key_held, 1);
MAIN_Key_UP_DOWN(key_pressed, key_held, SCAN_STATE_DIR_FORWARD);
break;
case KEY_DOWN:
MAIN_Key_UP_DOWN(key_pressed, key_held, -1);
MAIN_Key_UP_DOWN(key_pressed, key_held, SCAN_STATE_DIR_REVERSE);
break;
case KEY_EXIT:
MAIN_Key_EXIT(key_pressed, key_held);

View File

@ -86,7 +86,7 @@ void MENU_start_css_scan(int8_t Direction)
MENU_SelectNextCode();
g_scan_pause_10ms = scan_pause_css_10ms;
g_scan_pause_tick_10ms = scan_pause_css_10ms;
}
void MENU_stop_css_scan(void)
@ -939,7 +939,7 @@ void MENU_SelectNextCode(void)
RADIO_setup_registers(true);
g_scan_pause_10ms = (g_selected_code_type == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_ctcss_10ms : scan_pause_cdcss_10ms;
g_scan_pause_tick_10ms = (g_selected_code_type == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_ctcss_10ms : scan_pause_cdcss_10ms;
g_update_display = true;
}
@ -2014,11 +2014,11 @@ void MENU_process_key(key_code_t Key, bool key_pressed, bool key_held)
#endif
g_menu_cursor == MENU_BAT_CAL)
{
g_menu_count_down = menu_timeout_long_500ms;
g_menu_tick_10ms = menu_timeout_long_500ms;
}
else
{
g_menu_count_down = menu_timeout_500ms;
g_menu_tick_10ms = menu_timeout_500ms;
}
}
}

View File

@ -19,7 +19,9 @@
#include "app/search.h"
#include "audio.h"
#include "board.h"
#include "bsp/dp32g030/gpio.h"
#include "driver/bk4819.h"
#include "driver/gpio.h"
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
#include "driver/uart.h"
#endif
@ -400,6 +402,9 @@ void SEARCH_Start(void)
g_rx_vfo->step_setting = BackupStep;
g_rx_vfo->step_freq = BackupStepFreq;
g_monitor_enabled = false;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
RADIO_setup_registers(true);
#ifdef ENABLE_NOAA

View File

@ -345,9 +345,9 @@ uint32_t GetOffsetedF(uint32_t f) {
bool IsTXAllowed() { return g_setting_ALL_TX != 2; }
static void ToggleAudio(bool on) {
if (on) {
if (on)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
} else {
else {
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
}
}