MSH测试、LED闪烁成功
This commit is contained in:
parent
827d08456c
commit
ecb8ff9d6a
@ -168,6 +168,7 @@ void Set_LEDColor(uint16_t LedId, RGBColor_TypeDef Color)
|
||||
}
|
||||
void LED_Set(uint16_t LedId, RGBColor_TypeDef Color)
|
||||
{
|
||||
LED_Blink_Staue[LedId]=0;
|
||||
RGB_Data[LedId].G = Color.G;
|
||||
RGB_Data[LedId].R = Color.R;
|
||||
RGB_Data[LedId].B = Color.B;
|
||||
@ -204,6 +205,7 @@ void LED_LITTLE_TEST(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
LED_Blink_ON=!LED_Blink_ON;
|
||||
RGB_Reflash();
|
||||
rt_thread_mdelay(500);
|
||||
}
|
||||
|
54
my_pro/mytest.c
Normal file
54
my_pro/mytest.c
Normal file
@ -0,0 +1,54 @@
|
||||
#include "drv_matrix_led.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void ledblink(int argc, char **argv){//设置/查询设备名称
|
||||
// if(argc < 2){
|
||||
// const rt_uint8_t Buffer[] = "AT+NAME\r\n";
|
||||
// rt_uint8_t len = rt_strlen((const char*)Buffer);
|
||||
// rt_device_write(Project_uart_Device,0,Buffer,len);
|
||||
// }else if(argc > 2){
|
||||
// rt_kprintf("Only one parameter can be entered\r\n");
|
||||
// }else{
|
||||
// char Buffer[] = "AT+NAME";
|
||||
// char* NewBuf = strcat(Buffer,argv[1]);
|
||||
// NewBuf = strcat(NewBuf,"\r\n");
|
||||
// rt_uint8_t len = rt_strlen((const char*)NewBuf);
|
||||
// rt_device_write(Project_uart_Device,0,NewBuf,len);
|
||||
// }
|
||||
int LedId = atoi(argv[1]);
|
||||
if(!rt_strcmp(argv[2],"RED"))
|
||||
{
|
||||
LED_Blink(LedId,LED_RED);
|
||||
}
|
||||
else if(!rt_strcmp(argv[2],"BLUE"))
|
||||
{
|
||||
LED_Blink(LedId,LED_BLUE);
|
||||
}
|
||||
}
|
||||
MSH_CMD_EXPORT_ALIAS(ledblink,LED0, "BLINK LedId Color");
|
||||
|
||||
void ledset(int argc, char **argv){//设置/查询设备名称
|
||||
// if(argc < 2){
|
||||
// const rt_uint8_t Buffer[] = "AT+NAME\r\n";
|
||||
// rt_uint8_t len = rt_strlen((const char*)Buffer);
|
||||
// rt_device_write(Project_uart_Device,0,Buffer,len);
|
||||
// }else if(argc > 2){
|
||||
// rt_kprintf("Only one parameter can be entered\r\n");
|
||||
// }else{
|
||||
// char Buffer[] = "AT+NAME";
|
||||
// char* NewBuf = strcat(Buffer,argv[1]);
|
||||
// NewBuf = strcat(NewBuf,"\r\n");
|
||||
// rt_uint8_t len = rt_strlen((const char*)NewBuf);
|
||||
// rt_device_write(Project_uart_Device,0,NewBuf,len);
|
||||
// }
|
||||
int LedId = atoi(argv[1]);
|
||||
if(!rt_strcmp(argv[2],"RED"))
|
||||
{
|
||||
LED_Set(LedId,LED_RED);
|
||||
}
|
||||
else if(!rt_strcmp(argv[2],"BLUE"))
|
||||
{
|
||||
LED_Set(LedId,LED_BLUE);
|
||||
}
|
||||
}
|
||||
MSH_CMD_EXPORT_ALIAS(ledset,LED1, "BLINK LedId Color");
|
Loading…
x
Reference in New Issue
Block a user