急求!這是本人寫的一些代碼!
0.png (40.82 KB, 下載次數: 152)
下載附件
2017-1-11 16:01 上傳
源程序下載:
ws2811.rar
(3.52 KB, 下載次數: 280)
2017-1-11 15:58 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
程序預覽:
- /****************************************************************************************
- * WS2811 彩燈驅動函數
- *
- * 調用方法:
- * 修改宏定義: #define nWs 1 // 有多少顆WS2811級聯
- * WS_Init(); // IO初始化
- * WsDat[0] = 0x808080;//顯存賦值
- * WS_SetAll(); // 發送數據
- * ColorToColor(unsigned long color0, unsigned long color1);// 顏色漸變算法
- *
- * 作者:星希望(已校驗)
- * 日期:2015年6月24日
- ****************************************************************************************/
- #include "includes.h"
-
- #define RCC_PAout RCC_AHBPeriph_GPIOB
- #define PORT_PAout GPIOB
- #define PIN_PAout GPIO_Pin_15
- #define RCC_PEN RCC_AHBPeriph_GPIOB
- #define PORT_PEN GPIOB
- #define PIN_PEN GPIO_Pin_9
- #define PAout_0() PORT_PAout->BRR = PIN_PAout
- #define PAout_1() PORT_PAout->BSRR = PIN_PAout
- #define PEN_0() PORT_PEN->BRR = PIN_PEN
- #define PEN_1() PORT_PEN->BSRR = PIN_PEN
-
- /* 顯存 */
- unsigned long WsDat[nWs];
- uint32_t WsCol[nWs];
- /*
- *********************************************************************************************************
- * 函 數 名: WS_Init
- * 功能說明: 初始化WS2811輸出GPIO
- * 形 參:無
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WS_Init()
- {
- GPIO_InitTypeDef GPIO_InitStruct;
-
- //端口時鐘,使能
- RCC_AHBPeriphClockCmd(RCC_PAout | RCC_PEN, ENABLE);
- // 端口配置
- GPIO_InitStruct.GPIO_Pin = PIN_PAout; // PIN
- GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; // 推挽輸出
- GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; // IO口速度為50MHz
- GPIO_InitStruct.GPIO_OType=GPIO_OType_PP;
- GPIO_Init(PORT_PAout, &GPIO_InitStruct); // 根據設定參數初始化
- GPIO_InitStruct.GPIO_Pin = PIN_PEN; // PIN
- GPIO_Init(PORT_PEN, &GPIO_InitStruct); // 根據設定參數初始化
-
- PEN_1();
- }
- /*
- *********************************************************************************************************
- * 函 數 名: delay2us
- * 功能說明: 延時2us
- * 形 參:無
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void delay2us(void)
- {
- unsigned char i;
- for(i=0; i<12; i++);
- }
- /*
- *********************************************************************************************************
- * 函 數 名: delay05us
- * 功能說明: 延時0.5us
- * 形 參:無
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void delay05us(void)
- {
- unsigned char i;
- for(i=0; i<2; i++);
- }
- /*
- *********************************************************************************************************
- * 函 數 名: TX0,TX1
- * 功能說明: 高速模式(最快)發送碼值0 ,1
- * 形 參:無
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void TX0() { PAout_1(); delay05us; PAout_0(); delay_us(2); } // 發送0
- void TX1() { PAout_1(); delay_us(2); PAout_0(); delay05us; } // 發送1
- /*
- *********************************************************************************************************
- * 函 數 名: TXL0,TXL1
- * 功能說明: 速度降一倍發送碼值0 ,1
- * 形 參:無
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void TXL0(void) { PAout_1(); delay2us; PAout_0(); delay_us(5); } // 發送0
- void TXL1(void) { PAout_1(); delay_us(5); PAout_0(); delay2us; } // 發送1
- /*
- *********************************************************************************************************
- * 函 數 名: WS_Reset
- * 功能說明: 發送碼值 幀單位
- * 形 參:無
- * 返 回 值: 無
- *********************************************************************************************************
- */void WS_Reset() {PAout_0() ; delay_us(60); PAout_1();}//PAout_0();
- /*
- *********************************************************************************************************
- * 函 數 名: WS_Set1
- * 功能說明: 高速發送24Bit數據
- * 形 參:dat,發送的數據
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WS_SetH(unsigned long dat)
- {
- unsigned char i;
-
- for(i=0; i<24; i++)
- {
- if(0x800000 == (dat & 0x800000) ) TX1();
- else TX0();
- dat<<=1; //左移一位
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WS_SetL
- * 功能說明: 低速發送24Bit數據
- * 形 參:dat,發送的數據
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WS_SetL(unsigned long dat)
- {
- unsigned char i;
-
- for(i=0; i<24; i++)
- {
- if(0x800000 == (dat & 0x800000) ) TXL1();
- else TXL0();
- dat<<=1; //左移一位
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WS_SetAll
- * 功能說明: 發送數組內全部數據
- * 形 參:無
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WS_L_SetAll()
- {
- unsigned char j;
-
- for (j=0; j<20; j++)
- {
- //WsCol[j] = SpiData.SpiData[j * 3]<<16 | SpiData.SpiData[j * 3 + 1]<<8 | SpiData.SpiData[j * 3 + 2];
- WsCol[j] = WsDat[j];
- WS_SetH(WsCol[j]); // j 級聯個數/ 0
- }
- WS_Reset();
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WS_SetAll
- * 功能說明: 發送數組內全部數據
- * 形 參:無
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WS_H_SetAll()
- {
- unsigned char j;
-
- for (j=0; j<nWs; j++)
- {
- //WsCol[j] = SpiData.SpiData[j * 3]<<16 | SpiData.SpiData[j * 3 + 1]<<8 | SpiData.SpiData[j * 3 + 2];
- WsCol[j] = WsDat[j];
- WS_SetH(WsCol[j]); // j 級聯個數/ 0
- }
- WS_Reset();
- }
- /*
- *********************************************************************************************************
- * 函 數 名: abs0
- * 功能說明: 求絕對值
- * 形 參:num,比較后的數據
- * 返 回 值: num,形參的絕對值
- *********************************************************************************************************
- */
- unsigned char abs0(int num)
- {
- if (num>0) return num;
-
- num = -num;
- return (unsigned char) num;
- }
- /*
- *********************************************************************************************************
- * 函 數 名: ColorToColor
- * 功能說明: 顏色漸變算法(正向)
- * 形 參:color0、color1 從一種顏色變到別一種顏色
- * 返 回 值: color 變化后的顏色
- *********************************************************************************************************
- */
- void ColorToColor(unsigned long color0, unsigned long color1)
- {
- unsigned char Red0, Green0, Blue0; // 起始三原色
- unsigned char Red1, Green1, Blue1; // 結果三原色
- int RedMinus, GreenMinus, BlueMinus; // 顏色差(color1 - color0)
- unsigned char NStep; // 需要幾步
- float RedStep, GreenStep, BlueStep; // 各色步進值
- unsigned long color; // 結果色
- unsigned char i;
- uint8_t Pack = 0;
-
- // 綠 紅 藍 三原色分解
- Red0 = color0>>8;
- Green0 = color0>>16;
- Blue0 = color0;
-
- Red1 = color1>>8;
- Green1 = color1>>16;
- Blue1 = color1;
-
- // 計算需要多少步(取差值的最大值)
- RedMinus = Red1 - Red0;
- GreenMinus = Green1 - Green0;
- BlueMinus = Blue1 - Blue0;
-
- NStep = ( abs0(RedMinus) > abs0(GreenMinus) ) ? abs0(RedMinus):abs0(GreenMinus);
- NStep = ( NStep > abs0(BlueMinus) ) ? NStep:abs0(BlueMinus);
-
- // 計算出各色步進值
- RedStep = (float)RedMinus / NStep;
- GreenStep = (float)GreenMinus / NStep;
- BlueStep = (float)BlueMinus / NStep;
-
- // 漸變開始
- for (i = 0; i < NStep; i++) //燈點亮的個數可變
- {
- Red1 = Red0 + (int)(RedStep * i);
- Green1 = Green0 + (int)(GreenStep * i);
- Blue1 = Blue0 + (int)(BlueStep * i);
-
- color = Green1<<16 | Red1<<8 | Blue1; // 合成 綠紅藍
- WsDat[Pack] = color; //這里只第一個燈
- WS_L_SetAll(); // 輸出
- delay_ms(20); // 漸變速度
- if (Pack > nWs)
- {
- Pack = 0;
- }
- else
- {
- Pack++;
- }
- }
- // 漸變結束
- // return color;
- }
- /*
- *********************************************************************************************************
- * 函 數 名: ColorToColor1
- * 功能說明: 顏色漸變算法 (反向)
- * 形 參:color0、color1 從一種顏色變到別一種顏色
- * 返 回 值: color 變化后的顏色
- *********************************************************************************************************
- */
- void ColorToColor1(unsigned long color0, unsigned long color1)
- {
- unsigned char Red0, Green0, Blue0; // 起始三原色
- unsigned char Red1, Green1, Blue1; // 結果三原色
- int RedMinus, GreenMinus, BlueMinus; // 顏色差(color1 - color0)
- unsigned char NStep; // 需要幾步
- float RedStep, GreenStep, BlueStep; // 各色步進值
- unsigned long color; // 結果色
- unsigned char i;
- int8_t Pack = nWs;
-
- // 綠 紅 藍 三原色分解
- Red0 = color0>>8;
- Green0 = color0>>16;
- Blue0 = color0;
-
- Red1 = color1>>8;
- Green1 = color1>>16;
- Blue1 = color1;
-
- // 計算需要多少步(取差值的最大值)
- RedMinus = Red1 - Red0;
- GreenMinus = Green1 - Green0;
- BlueMinus = Blue1 - Blue0;
-
- NStep = ( abs0(RedMinus) > abs0(GreenMinus) ) ? abs0(RedMinus):abs0(GreenMinus);
- NStep = ( NStep > abs0(BlueMinus) ) ? NStep:abs0(BlueMinus);
-
- // 計算出各色步進值
- RedStep = (float)RedMinus / NStep;
- GreenStep = (float)GreenMinus / NStep;
- BlueStep = (float)BlueMinus / NStep;
-
- // 漸變開始
- for (i = 0; i < NStep; i++) //燈點亮的個數可變
- {
- Red1 = Red0 + (int)(RedStep * i);
- Green1 = Green0 + (int)(GreenStep * i);
- Blue1 = Blue0 + (int)(BlueStep * i);
-
- color = Green1<<16 | Red1<<8 | Blue1; // 合成 綠紅藍
- WsDat[Pack] = color; //這里只第一個燈
- WS_H_SetAll(); // 輸出
- delay_ms(2); // 漸變速度
- if (Pack > 0)
- {
- Pack--;
- }
- else
- {
- Pack = nWs;
- }
- }
-
- // 漸變結束
- // return color;
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol1
- * 功能說明: 從前向后移動(單組)
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol1(uint32_t _uColor, uint16_t _uTime)
- {
- uint8_t i;
-
- // for (i = 0; i < 3; i++)
- // {
- // _uColor = g_tSpi.RxBuf[0]<<16 | g_tSpi.RxBuf[1]<<8 | g_tSpi.RxBuf[2];
- //
- // //_uColor = _uColor + 0xfffff*i;
- // WsDat[i] = _uColor;
- // // delay_ms(_uTime);
- // //memset(WsDat, 0, sizeof(WsDat));
- //
- // }
- WS_L_SetAll();
- //delay_ms(_uTime);
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol2
- * 功能說明: 單組燈移位顯示
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol2(uint32_t _uColor, uint16_t _uTime)
- {
- uint8_t i, j;
- uint8_t Red2, Green2, Blue2; // 三原色
-
- Red2 = _uColor>>8;
- Green2 = _uColor>>16;
- Blue2 = _uColor;
-
- for (i = 0; i < nWs; i++)
- {
- for (j = 0; j < i; j++)
- {
- Red2 = Red2 + 0x22;
- //Green2 = Green2 + 0x22;
- //Blue2 = Blue2 + 0x22;
- _uColor = Green2<<16 | Red2<<8 | Blue2;
-
- // _uColor = _uColor + 0xfffff*i;
- WsDat[j] = _uColor;
- }
- WS_L_SetAll();
- delay_ms(_uTime);
- // memset(WsDat, 0, sizeof(WsDat));
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol5
- * 功能說明: 與模式2反向
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol5(uint32_t _uColor, uint16_t _uTime)
- {
- uint8_t i, j;
- uint8_t Red2, Green2, Blue2; // 三原色
-
- Red2 = _uColor>>8;
- Green2 = _uColor>>16;
- Blue2 = _uColor;
-
- for (i = nWs; i > 0; i--)
- {
- for (j = i; j > 0; j--)
- {
- Red2 = Red2 + 0x22;
- //Green2 = Green2 + 0x22;
- //Blue2 = Blue2 + 0x22;
- _uColor = Green2<<16 | Red2<<8 | Blue2;
-
- // _uColor = _uColor + 0xfffff*i;
- WsDat[j] = _uColor;
- }
- WS_L_SetAll();
- delay_ms(_uTime);
- // memset(WsDat, 0, sizeof(WsDat));
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol3
- * 功能說明: 從中點向兩端移動
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol3(uint32_t _uColor, uint16_t _uTime)
- {
- uint8_t i;
-
- for (i = nWs/2; i < nWs; i++)
- {
- _uColor = _uColor + 0xfffff*i;
- WsDat[i] = _uColor;
- WsDat[nWs/2 -(i - nWs/2)] = _uColor;
- WS_L_SetAll();
- delay_ms(_uTime);
- memset(WsDat, 0, sizeof(WsDat));
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol4
- * 功能說明: 從后向前移動(單組)
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol4(uint32_t _uColor, uint16_t _uTime)
- {
- int8_t i;
-
- for (i = nWs-1; i >= 0; i--)
- {
- _uColor = _uColor + 0xff0000*i + 0xff00*i + 0xff*i;
- WsDat[i] = _uColor;
- WS_L_SetAll();
- delay_ms(_uTime);
- memset(WsDat, 0, sizeof(WsDat));
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol6
- * 功能說明: 從后向前移動(跳一個)
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol6(uint32_t _uColor, uint16_t _uTime)
- {
- uint8_t i;
-
- for (i = 0; i < nWs; i++)
- {
- i = i + 1;
- //_uColor = _uColor + 0xfffff*i;
- WsDat[i] = _uColor;
- }
- WS_L_SetAll();
- delay_ms(_uTime);
- memset(WsDat, 0, sizeof(WsDat));
- for (i = 0; i < nWs; i++)
- {
- if(i != 0)
- {
- i = i + 1;
- }
- //_uColor = Color + 0xfffff*i;
- WsDat[i] = _uColor;
- }
- WS_L_SetAll();
- delay_ms(_uTime);
- memset(WsDat, 0, sizeof(WsDat));
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol7(可使用)
- * 功能說明: 從后向前移動(單組)
- * 形 參:_uColor0 顏色1
- * _uColor1 顏色2
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol7(uint32_t _uColor0, uint32_t _uColor1, uint16_t _uTime)
- {
- int8_t i, j, f = 0;
- uint8_t NStep; // 三原色
- unsigned char Red0, Green0, Blue0; // 起始三原色
- unsigned char Red1, Green1, Blue1; // 結果三原色
- int RedMinus, GreenMinus, BlueMinus; // 顏色差(color1 - color0) // 需要幾步
- float RedStep, GreenStep, BlueStep; // 各色步進值
-
- Red0 = _uColor0>>8;
- Green0 = _uColor0>>16;
- Blue0 = _uColor0;
-
- Red1 = _uColor1>>8;
- Green1 = _uColor1>>16;
- Blue1 = _uColor1;
-
- NStep = 3;
- // 計算需要多少步(取差值的最大值)
- RedMinus = Red1 - Red0;
- GreenMinus = Green1 - Green0;
- BlueMinus = Blue1 - Blue0;
- // 計算出各色步進值
- RedStep = (float)RedMinus / NStep;
- GreenStep = (float)GreenMinus / NStep;
- BlueStep = (float)BlueMinus / NStep;
-
- for(j = -(NStep);j < nWs; j++)
- {
- for(i = 0; i < NStep; i++)
- {
- Red1 = Red0 + (int)(RedStep * i);
- Green1 = Green0 + (int)(GreenStep * i);
- Blue1 = Blue0 + (int)(BlueStep * i);
- WsDat[i + j] = Green1<<16 | Red1<<8 | Blue1;
- }
- WS_L_SetAll();
- delay_ms(_uTime);
- memset(WsDat, 0, sizeof(WsDat));
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol8(可用)
- * 功能說明: 從后向前移動(跳一個)
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol8(uint32_t _uColor0, uint16_t _uTime)
- {
- uint8_t i;
-
- for (i = 3; i < nWs/2; i++)
- {
- WsDat[i] = _uColor0;
- }
- for (i = nWs/2; i < nWs - 3; i++)
- {
- WsDat[i] = 0;
- }
- WS_L_SetAll();
- delay_ms(_uTime);
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol9(可用)
- * 功能說明: 從后向前移動(跳一個)
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol9(uint32_t _uColor0, uint16_t _uTime)
- {
- uint8_t i;
-
- for (i = 3; i < nWs/2; i++)
- {
- WsDat[i] = 0;
- }
- for (i = nWs/2; i < nWs - 3; i++)
- {
- WsDat[i] = _uColor0;
- }
- WS_L_SetAll();
- delay_ms(_uTime);
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol10(可用)
- * 功能說明: 從后向前移動(跳一個)
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol10(uint32_t _uColor0,uint32_t _uColor1, uint16_t _uTime)
- {
- int8_t i, j;
-
- WsDat[1] = _uColor0;
- WsDat[0] = _uColor1;
-
- for(i = 0;i < nWs; i++)
- {
- WsDat[i + 2] = WsDat[i + 1];
- WsDat[i + 1] = WsDat[i];
- WsDat[i] = 0;
- WS_L_SetAll();
- delay_ms(_uTime);
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol11(可用)
- * 功能說明: 從后向前移動(跳一個)
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol11(uint32_t _uColor0,uint32_t _uColor1, uint16_t _uTime)
- {
- int8_t i, j;
-
- WsDat[1] = _uColor0;
- WsDat[0] = _uColor1;
- WsDat[nWs - 1] = _uColor0;
- WsDat[nWs - 2] = _uColor1;
- for(i = 0;i < nWs ; i++)
- {
- WsDat[i + 2] = WsDat[i + 1];
- WsDat[i + 1] = WsDat[i];
- WsDat[i] = 0;
- WsDat[nWs - i - 2] =WsDat[nWs - i - 1];
- WsDat[nWs - i - 1] = WsDat[nWs - 1];
- WsDat[nWs - 1] = 0;
- WS_L_SetAll();
- delay_ms(_uTime);
- }
- }
- /*
- *********************************************************************************************************
- * 函 數 名: WaterLampToCol12(可用)
- * 功能說明: 從后向前移動(跳一個)
- * 形 參:_uColor 點亮顏色
- * _uTime 移位速度
- * 返 回 值: 無
- *********************************************************************************************************
- */
- void WaterLampToCol12(uint32_t _uColor0,uint32_t _uColor1, uint16_t _uTime)
- {
- unsigned char Red0, Green0, Blue0; // 起始三原色
- unsigned char Red1, Green1, Blue1; // 結果三原色
- unsigned char Red2, Green2, Blue2; // 結果三原色
- int RedMinus, GreenMinus, BlueMinus; // 顏色差(color1 - color0)
- unsigned char NStep; // 需要幾步
- float RedStep, GreenStep, BlueStep; // 各色步進值
- unsigned long color; // 結果色
- unsigned char i, j;
- int8_t Pack = nWs;
- for(j = 0; j < 20 ;j++)
- {
- // 綠 紅 藍 三原色分解
- Red0 = _uColor0>>8;
- Green0 = _uColor0>>16;
- Blue0 = _uColor0;
- Red1 = _uColor1>>8;
- Green1 = _uColor1>>16;
- Blue1 = _uColor1;
-
- // 計算需要多少步(取差值的最大值)
- RedMinus = Red1 - Red0;
- GreenMinus = Green1 - Green0;
- BlueMinus = Blue1 - Blue0;
- NStep = ( abs0(RedMinus) > abs0(GreenMinus) ) ? abs0(RedMinus):abs0(GreenMinus);
- NStep = ( NStep > abs0(BlueMinus) ) ? NStep:abs0(BlueMinus);
- // 計算出各色步進值
- RedStep = (float)RedMinus / NStep;
- GreenStep = (float)GreenMinus / NStep;
- BlueStep = (float)BlueMinus / NStep;
- WsDat[j-1] = 0 ;
- for(i = 0; i < NStep; i++)
- {
- Red2 = Red0 + (int)(RedStep * i);
- Green2 = Green0 + (int)(GreenStep * i);
- Blue2 = Blue0 + (int)(BlueStep * i);
- color = Green2<<16 | Red2<<8 | Blue2; // 合成 綠紅藍
- WsDat[j+1] = color ;
- WS_L_SetAll();
- delay_ms(_uTime);
- }
- for(i = 0; i < NStep; i++)
- {
- Red2 = Red1 - (int)(RedStep * i);
- Green2 = Green1 - (int)(GreenStep * i);
- Blue2 = Blue1 - (int)(BlueStep * i);
- color = Green2<<16 | Red2<<8 | Blue2; // 合成 綠紅藍
- WsDat[j] = color ;
- WS_L_SetAll();
- delay_ms(_uTime);
- }
- }
- }
復制代碼
|