📄 sconfig.c
字号:
#include "app_cfg.h"
#include "stdio.h"
#include "platform_config.h"
#include "sconfig.h"
void SConfigCmd(Usb_Package_Header *rxData)
{
//Con_Packet_Header *control;
//control = (Con_Packet_Header *)bData;
if(rxData->bCmd == CON_CMD_RESET){
}else if (rxData->bCmd == CON_CMD_LED){
SetLed(*((unsigned char *)rxData+2) , *((unsigned char *)rxData+3) );
//printf("\r\n Command: System Configure");
}else{
printf("\r\n Command: Unknown Config Command");
}
/*
for (i=0; i<Len; i++)
{
*((unsigned char *)txData+(txData->bLength + i)) = pBuffer[i];
}
memcpy((unsigned char *)txData+(txData->bLength),pBuffer,Len);
*/
}
void SetLed(uint8_t led_num, uint8_t state)
{
BitAction Led_State;
if (state == 0)
{
Led_State = Bit_RESET;
}
else
{
Led_State = Bit_SET;
}
if(Led_State == Bit_RESET)
printf("\r\n Setup: Led%d Off",led_num);
else
printf("\r\n Setup: Led%d ON",led_num);
switch (led_num)
{
case 1: /* Led 1 */
GPIO_WriteBit(GPIO_LED, GPIO_LED1_PIN, Led_State);
break;
case 2: /* Led 2 */
GPIO_WriteBit(GPIO_LED, GPIO_LED2_PIN, Led_State);
break;
case 3: /* Led 3 */
GPIO_WriteBit(GPIO_LED, GPIO_LED3_PIN, Led_State);
break;
case 4: /* Led 4 */
GPIO_WriteBit(GPIO_LED, GPIO_LED4_PIN, Led_State);
break;
default:
GPIO_Write(GPIO_LED, ~(uint16_t)(GPIO_LED1_PIN | GPIO_LED2_PIN | GPIO_LED3_PIN | GPIO_LED4_PIN));
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -