修改led

This commit is contained in:
Robofish 2025-09-20 01:28:28 +08:00
parent d7a56e656b
commit 92bb89124b
5 changed files with 22 additions and 31 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -8,7 +8,7 @@ from qfluentwidgets import InfoBar, InfoBarPosition, SubtitleLabel
from .function_fit_interface import FunctionFitInterface
from app.tools.check_update import check_update
__version__ = "1.0.4"
__version__ = "1.0.5"
class AboutInterface(QWidget):
def __init__(self, parent=None):

View File

@ -7,28 +7,15 @@
#include "bsp/pwm.h"
#include "device.h"
/* USER INCLUDE BEGIN */
/* USER INCLUDE END */
/* Private define ----------------------------------------------------------- */
/* USER DEFINE BEGIN */
/* USER DEFINE END */
/* Private macro ------------------------------------------------------------ */
/* Private typedef ---------------------------------------------------------- */
/* USER STRUCT BEGIN */
/* USER STRUCT END */
/* USER FUNCTION BEGIN */
/* USER FUNCTION END */
int8_t LED_PWMSet(BSP_PWM_Channel_t channel,float duty_cycle)
int8_t DEVICE_LED_PWM_Set(BSP_PWM_Channel_t channel, float duty_cycle)
{
if (duty_cycle < 0.0f || duty_cycle > 1.0f) {
return DEVICE_ERR_NULL; // 错误:占空比超出范围
}
@ -38,14 +25,14 @@ int8_t LED_PWMSet(BSP_PWM_Channel_t channel,float duty_cycle)
return DEVICE_OK;
}
int8_t LED_GPIOSet(BSP_GPIO_t gpio,bool value)
int8_t DEVICE_LED_GPIO_Set(BSP_GPIO_t gpio, bool value)
{
BSP_GPIO_WritePin(gpio,value);
if (value) {
BSP_GPIO_WritePin(gpio, true);
} else {
BSP_GPIO_WritePin(gpio, false);
}
return DEVICE_OK;
}

View File

@ -14,14 +14,18 @@ extern "C" {
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
typedef struct {
BSP_GPIO_t gpio;
BSP_PWM_Channel_t channel;
} DEVICE_LED_t;
extern DEVICE_LED_t LED_Map;
/* Exported functions prototypes -------------------------------------------- */
int8_t LED_PWMSet(BSP_PWM_Channel_t channel,float duty_cycle);
int8_t LED_GPIOSet(BSP_GPIO_t gpio,bool value);
int8_t BSP_LED_Set(char sign,DEVICE_LED_t ch,bool value,float duty_cycle);
#ifdef __cplusplus
}