diff --git a/.DS_Store b/.DS_Store index 3686aa0..3f40116 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/app/__pycache__/__init__.cpython-39.pyc b/app/__pycache__/__init__.cpython-39.pyc index 23a2cc5..e6a82ad 100644 Binary files a/app/__pycache__/__init__.cpython-39.pyc and b/app/__pycache__/__init__.cpython-39.pyc differ diff --git a/app/about_interface.py b/app/about_interface.py index 77cc348..2dac91a 100644 --- a/app/about_interface.py +++ b/app/about_interface.py @@ -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): diff --git a/assets/User_code/device/led.c b/assets/User_code/device/led.c index f7fd317..eab5735 100644 --- a/assets/User_code/device/led.c +++ b/assets/User_code/device/led.c @@ -7,45 +7,32 @@ #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; // 错误:占空比超出范围 - } - uint16_t pulse = (uint16_t)(duty_cycle * (float)UINT16_MAX); - BSP_PWM_Start(channel); - BSP_PWM_SetComp(channel, pulse); - return DEVICE_OK; + if (duty_cycle < 0.0f || duty_cycle > 1.0f) { + return DEVICE_ERR_NULL; // 错误:占空比超出范围 + } + uint16_t pulse = (uint16_t)(duty_cycle * (float)UINT16_MAX); + BSP_PWM_Start(channel); + BSP_PWM_SetComp(channel, pulse); + return DEVICE_OK; } -int8_t LED_GPIOSet(BSP_GPIO_t gpio,bool value) -{ - BSP_GPIO_WritePin(gpio,value); +int8_t DEVICE_LED_GPIO_Set(BSP_GPIO_t gpio, bool value) +{ + if (value) { + BSP_GPIO_WritePin(gpio, true); + } else { + BSP_GPIO_WritePin(gpio, false); + } return DEVICE_OK; } - - - - diff --git a/assets/User_code/device/led.h b/assets/User_code/device/led.h index 7765a57..04fdb54 100644 --- a/assets/User_code/device/led.h +++ b/assets/User_code/device/led.h @@ -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 }