| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /**
- * @file LED_BREATH_ATY.h
- *
- * @param Project DEVICE_GENERAL_ATY_LIB
- *
- * @author ATY
- *
- * @copyright
- * - Copyright 2017 - 2026 MZ-ATY
- * - This code follows:
- * - MZ-ATY Various Contents Joint Statement -
- * <a href="https://mengze.top/MZ-ATY_VCJS">
- * https://mengze.top/MZ-ATY_VCJS</a>
- * - CC 4.0 BY-NC-SA -
- * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
- * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
- * - Your use will be deemed to have accepted the terms of this statement.
- *
- * @brief functions of LED for C platform
- *
- * @version
- * - 1_01_250814 > ATY
- * -# Preliminary version, first Release
- ********************************************************************************
- */
- #ifndef __LED_BREATH_ATY_H
- #define __LED_BREATH_ATY_H
- #include "INCLUDE_ATY.h"
- /******************************* For user *************************************/
- #define BREATH_LED_MAX 100 // LED最大亮度
- #define BREATH_LED_MIN 50 // LED最小亮度
- #define BREATH_LED_MID (BREATH_LED_MIN + ((BREATH_LED_MAX - BREATH_LED_MIN) / 2)) // LED中等亮度
- #define BREATH_LED_SPEED_MID 30 // LED中等速度
- /******************************************************************************/
- typedef enum {
- BREATH_MODE_SMOOTH, // 平滑呼吸
- BREATH_MODE_STEP, // 阶梯呼吸
- BREATH_MODE_FAST, // 快速呼吸
- BREATH_MODE_SLOW, // 慢速呼吸
- BREATH_MODE_PAUSE_TOP, // 顶部停顿
- BREATH_MODE_PAUSE_BOTTOM, // 底部停顿
- BREATH_MODE_PULSE // 突然亮起
- } LedBreathMode_t;
- struct LED_BREATH_ATY_Dev
- {
- LedBreathMode_t breathMode;
- uint32_t breathTimer;
- int8_t breathDir;
- uint8_t breathVal;
- uint8_t breathPauseCnt;
- uint8_t breathStep;
- uint8_t breathMax;
- uint8_t breathMin;
- uint8_t breathUpdate;
- void (*pwmSet)(uint8_t breathVal);
- uint8_t lock;
- uint8_t debugEnable;
- void (*LOG)(const char*, ...);
- };
- void LedBreath(struct LED_BREATH_ATY_Dev* dev);
- void SetLedBreathMode(struct LED_BREATH_ATY_Dev* dev, LedBreathMode_t mode);
- #endif /* __LED_BREATH_ATY_H */
- /******************************** End Of File *********************************/
|