Commit 62b011ae authored by 时昊's avatar 时昊

feat:加注释

parent dd48d7df
......@@ -209,9 +209,9 @@ static Protocol_uint32_t Protocol_UartSend(const Protocol_uint8_t *pData, Protoc
return 0;
}
static void Protocol_UartHandle(const Protocol_Data_t *pData)
static void Protocol_UartHandle(const Protocol_Data_t *pData)//esp接收底板数据
{
if ( pData->CmdID == 0x20 )
if ( pData->CmdID == 0x20 )//收到底板发送的数据后,传状态
{
//printf("0x20 is get\r\n");
if(Prot_User.State < Prot_Start)
......@@ -220,7 +220,7 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
printf("Prot_Start \r\n");
}
}
else if(pData->CmdID == 0x03 )
else if(pData->CmdID == 0x03 )//收到底板发送的电话状态,来控制esp32蓝牙电话
{
//printf("0x03 is get\r\n");
if(Prot_User.State < Prot_Normal)
......@@ -234,9 +234,9 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
{
// if(pData->DataLen == 33)
{
if(BT_User.HF_Ctrl != pData->Data[0])
if(BT_User.HF_Ctrl != pData->Data[0])//和上次数据不同
{
BT_User.HF_Ctrl = pData->Data[0];
BT_User.HF_Ctrl = pData->Data[0];//esp32接收到的数据
}
if(strncmp((const char *) ble_uerid, (const char *)&(pData->Data[1]), 32) != 0)
......@@ -309,18 +309,18 @@ void Protocol_User_Ctrl_Init(void )
Prot_User.TimeDelay = 0;
}
void Uart_Send_Id10_Pro(void )
void Uart_Send_Id10_Pro(void )//esp32发送启动完成给底板
{
uint8_t wtemp[1] = {0};
wtemp[0] = 1;
Protocol_Send(0x10, wtemp, 1);
}
void Uart_Send_Id12_Pro(void )
void Uart_Send_Id12_Pro(void )//收到底板回复的0x20后,发送蓝牙类型 ID12[0]是判断蓝牙是否连接 不等于0是连接
{
uint8_t ID12[15] = {0};
ID12[0] |= (uint8_t)(BT_User.BT_Sts << 4);
ID12[0] |= Ble_User.Ble_Sts;
ID12[0] |= (uint8_t)(BT_User.BT_Sts << 4);//经典
ID12[0] |= Ble_User.Ble_Sts;//ble
unsigned int i = 0;
for(i = 0;i < 14;i++)
{
......@@ -351,7 +351,7 @@ void Uart_Send_Id02_Pro(void)
{
uint8_t ID02[1] = {0x00};
ID02[0] = BT_User.Call_Sts;
Protocol_Send(0x02, ID02, 1);
Protocol_Send(0x02, ID02, 1);//给底板发送电话状态,用这个标志位显示电话号
}
......
......@@ -43,29 +43,29 @@ void BT_DisConnect_Event_Pro(void )
void BT_User_Process(void )
{
switch(BT_User.Call_Sts)
switch(BT_User.Call_Sts)//电话状态
{
case Call_OutCalling:
case Call_OutCalling://打电话中
{
if(BT_User.HF_Ctrl == HF_Reject)
{
hf_reject_handler();
hf_reject_handler();//挂断
}
break;
}
case Call_IncomeCalling:
case Call_IncomeCalling://响铃时
{
if(BT_User.HF_Ctrl == HF_Reject)
{
hf_reject_handler();
hf_reject_handler();//挂断
}
else if(BT_User.HF_Ctrl == HF_Answer)
{
hf_answer_handler();
hf_answer_handler();//接听
}
break;
}
case Call_InProcess:
case Call_InProcess://接电话中
{
if(BT_User.HF_Ctrl == HF_Reject)
{
......
......@@ -333,13 +333,13 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
if(param->call.status == 0)
{
BT_User.Call_Sts = Call_Idle;
BT_User.Call_Sts = Call_Idle;//电话空闲
printf("call idle\r\n");
}
else if(param->call.status == 1)
{
BT_User.Call_Sts = Call_InProcess;
BT_User.Call_Sts = Call_InProcess;//正在接电话
printf("call Call_InProcess\r\n");
}
break;
......
......@@ -56,13 +56,13 @@ static const int RX_BUF_SIZE = 1024;
#define TXD_PIN (GPIO_NUM_22)
#define RXD_PIN (GPIO_NUM_26)
typedef struct
{
uint16_t Rxlen;
uint8_t Rxbuff[255];
} _QJ_UART_Ctrl;
// typedef struct
// {
// uint16_t Rxlen;
// uint8_t Rxbuff[255];
// } _QJ_UART_Ctrl;
_QJ_UART_Ctrl QJ_UARTRX;
// _QJ_UART_Ctrl QJ_UARTRX;
void init_Uart(void) {
const uart_config_t uart_config = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment