mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
add beep in setting
This commit is contained in:
@@ -146,7 +146,7 @@ void MX_TIM4_Init(void)
|
|||||||
htim4.Instance = TIM4;
|
htim4.Instance = TIM4;
|
||||||
htim4.Init.Prescaler = 99;
|
htim4.Init.Prescaler = 99;
|
||||||
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
|
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
htim4.Init.Period = 250;
|
htim4.Init.Period = 500;
|
||||||
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
htim4.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
htim4.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||||
if (HAL_TIM_PWM_Init(&htim4) != HAL_OK)
|
if (HAL_TIM_PWM_Init(&htim4) != HAL_OK)
|
||||||
@@ -160,7 +160,7 @@ void MX_TIM4_Init(void)
|
|||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||||
sConfigOC.Pulse = 0;
|
sConfigOC.Pulse = 250;
|
||||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||||
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||||
if (HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_4) != HAL_OK)
|
if (HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_4) != HAL_OK)
|
||||||
|
|||||||
@@ -6,15 +6,19 @@
|
|||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
|
|
||||||
lv_obj_t * ui_SetPage = NULL;
|
lv_obj_t * ui_SetPage = NULL;
|
||||||
|
// backlight
|
||||||
static lv_obj_t * ui_PanelBL = NULL;
|
static lv_obj_t * ui_PanelBL = NULL;
|
||||||
static lv_obj_t * ui_SliderBL = NULL;
|
static lv_obj_t * ui_SliderBL = NULL;
|
||||||
static lv_obj_t * ui_LabelBL = NULL;
|
static lv_obj_t * ui_LabelBL = NULL;
|
||||||
|
// key sound
|
||||||
static lv_obj_t * ui_PanelKS = NULL;
|
static lv_obj_t * ui_PanelKS = NULL;
|
||||||
static lv_obj_t * ui_SwitchKS = NULL;
|
static lv_obj_t * ui_SwitchKS = NULL;
|
||||||
static lv_obj_t * ui_LabelKS = NULL;
|
static lv_obj_t * ui_LabelKS = NULL;
|
||||||
|
// language
|
||||||
static lv_obj_t * ui_PanelLang = NULL;
|
static lv_obj_t * ui_PanelLang = NULL;
|
||||||
static lv_obj_t * ui_SwitchLang = NULL;
|
static lv_obj_t * ui_SwitchLang = NULL;
|
||||||
static lv_obj_t * ui_LabelLang = NULL;
|
static lv_obj_t * ui_LabelLang = NULL;
|
||||||
|
// about
|
||||||
static lv_obj_t * ui_PanelAbout = NULL;
|
static lv_obj_t * ui_PanelAbout = NULL;
|
||||||
static lv_obj_t * ui_LabelAbout = NULL;
|
static lv_obj_t * ui_LabelAbout = NULL;
|
||||||
|
|
||||||
@@ -177,7 +181,7 @@ void ui_SetPage_screen_init(void)
|
|||||||
lv_label_set_text(ui_LabelAbout, "About\nPower-Pico\nA uA current meter\nV 1.0.0");
|
lv_label_set_text(ui_LabelAbout, "About\nPower-Pico\nA uA current meter\nV 1.0.0");
|
||||||
lv_obj_set_style_text_font(ui_LabelAbout, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
lv_obj_set_style_text_font(ui_LabelAbout, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||||
|
|
||||||
//
|
// store panels in array
|
||||||
panels[0] = ui_PanelBL;
|
panels[0] = ui_PanelBL;
|
||||||
panels[1] = ui_PanelKS;
|
panels[1] = ui_PanelKS;
|
||||||
panels[2] = ui_PanelLang;
|
panels[2] = ui_PanelLang;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "user_TasksInit.h"
|
#include "user_TasksInit.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
|
#include "beep.h"
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
|
||||||
@@ -27,6 +28,13 @@ void KeyTask(void *argument)
|
|||||||
if(keystr != 0)
|
if(keystr != 0)
|
||||||
{
|
{
|
||||||
osMessageQueuePut(Key_MessageQueue, &keystr, 0, 1);
|
osMessageQueuePut(Key_MessageQueue, &keystr, 0, 1);
|
||||||
|
// beep
|
||||||
|
if(1)
|
||||||
|
{
|
||||||
|
beep_open();
|
||||||
|
osDelay(50);
|
||||||
|
beep_close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
osDelay(10);
|
osDelay(10);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user