mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 03:27:45 +08:00
完成了队列版本的pubsub机制,但尚未测试
This commit is contained in:
@@ -1,48 +1,34 @@
|
||||
/**
|
||||
****************************(C) COPYRIGHT 2019 DJI****************************
|
||||
* @file led_trigger_task.c/h
|
||||
* @brief led RGB show.led RGB灯效。
|
||||
* @note
|
||||
* @history
|
||||
* Version Date Author Modification
|
||||
* V1.0.0 Nov-11-2019 RM 1. rgb led
|
||||
*
|
||||
@verbatim
|
||||
==============================================================================
|
||||
* @file led_task.c
|
||||
* @author DJI RM
|
||||
* @author modified by NeoZeng neozng1@hnu.edu.cn
|
||||
* @brief 流水灯效
|
||||
* @version 0.1
|
||||
* @date 2022-11-30
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
==============================================================================
|
||||
@endverbatim
|
||||
****************************(C) COPYRIGHT 2019 DJI****************************
|
||||
*/
|
||||
#include "led_task.h"
|
||||
#include "bsp_led.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "main.h"
|
||||
#include <stdint-gcc.h>
|
||||
|
||||
#define RGB_FLOW_COLOR_CHANGE_TIME 1000
|
||||
#define RGB_FLOW_COLOR_LENGHT 6
|
||||
// blue-> green(dark)-> red -> blue(dark) -> green(dark) -> red(dark) -> blue
|
||||
|
||||
// 蓝 -> 绿(灭) -> 红 -> 蓝(灭) -> 绿 -> 红(灭) -> 蓝
|
||||
uint32_t RGB_flow_color[RGB_FLOW_COLOR_LENGHT + 1] = {0xFF0000FF, 0x0000FF00, 0xFFFF0000, 0x000000FF, 0xFF00FF00, 0x00FF0000, 0xFF0000FF};
|
||||
|
||||
/**
|
||||
* @brief led rgb task
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
/**
|
||||
* @brief led RGB任务
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
|
||||
void led_RGB_flow_task()
|
||||
{
|
||||
uint16_t i, j;
|
||||
float delta_alpha, delta_red, delta_green, delta_blue;
|
||||
float alpha, red, green, blue;
|
||||
uint32_t aRGB;
|
||||
static float delta_alpha, delta_red, delta_green, delta_blue;
|
||||
static float alpha, red, green, blue;
|
||||
static uint32_t aRGB;
|
||||
|
||||
for (i = 0; i < RGB_FLOW_COLOR_LENGHT; i++)
|
||||
for (size_t i = 0; i < RGB_FLOW_COLOR_LENGHT; i++)
|
||||
{
|
||||
alpha = (RGB_flow_color[i] & 0xFF000000) >> 24;
|
||||
red = ((RGB_flow_color[i] & 0x00FF0000) >> 16);
|
||||
@@ -58,7 +44,7 @@ void led_RGB_flow_task()
|
||||
delta_red /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_green /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_blue /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
for (j = 0; j < RGB_FLOW_COLOR_CHANGE_TIME; j++)
|
||||
for (size_t j = 0; j < RGB_FLOW_COLOR_CHANGE_TIME; j++)
|
||||
{
|
||||
alpha += delta_alpha;
|
||||
red += delta_red;
|
||||
@@ -69,5 +55,5 @@ void led_RGB_flow_task()
|
||||
aRGB_led_show(aRGB);
|
||||
}
|
||||
}
|
||||
HAL_Delay(1);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user