#ifndef _JMDRAM_H_
#define _JMDRAM_H_
#include "stm32f10x.h" 

#define __SETWIFICODE_EN 0//配对码可以设置
//读取缓存
#define BUFFER_SIZE					2048
#define BUFFER_LIST_SIZE		50//100
#define INRX_BUFFER_SIZE		200//64
//二次缓存
#define READ_BUF_LIST_SIZE	10//14//13//100//缓存列表组数
#define READ_BUF_LIST_SIZE2	1024//1434//1500//1536//200//一个队列的长度
//全局变量定义
u16 WLRX_BufferListLen[BUFFER_LIST_SIZE];
u8 WLRX_BufferList[BUFFER_LIST_SIZE][64],WLRX_Buffer[READ_BUF_LIST_SIZE2];//,WLRX_Buffer[BUFFER_SIZE];
u8 g_WLUsbRxMode=1;//1 无线模式, 2USB模式

u16 WifiConnectSuccessState=0;//连接成功之后返回数据标志位
//******JMD******
u8 InRx_Buffer[INRX_BUFFER_SIZE];//64
u16 InRx_BufferCnt=0;

u16 EspWifiLockIP=0;//1锁定IP,即不再跳到广播模式

#define __WIFICONNECT255OVERTIM_EN 1
#if __WIFICONNECT255OVERTIM_EN>0
u16 WIFICONNECT_OVERTIME=15000;//广播超时时间20s,超过这个时间依然没有连接，则进入
u32 WifiConnect255OverTime;//跳出广播之后一直没有连接情况下，超时进入指定IP连接
void SetWifiConnect255OverTimeArr(u32 time){WIFICONNECT_OVERTIME=time;}
u32 GetWifiConnect255OverTimeArr(void){return WIFICONNECT_OVERTIME;}
void SetConnect255Overtime(void)	{WifiConnect255OverTime=GetSystemTime()+WIFICONNECT_OVERTIME;}//设置广播超时时间
u8 GetConnect255OverTime(void) 		{return (WifiConnect255OverTime<GetSystemTime()?1:0);}
#endif//__WIFICONNECT255OVERTIM_EN
//****************
 u16 RxBuf_idx = 0;
 u16 Rx_CurLen = 0;
 u16 WL_CurPos = 0,WL_ListPos = 0;
//遥控手柄
 u8 g_WifiRMFlag=0;
//#define _WIFIRX_CLEARTIME		100//100ms
u16 _WIFIRX_CLEARTIME=150;//150ms
u32 WifiRxTimeTick=0;//用于超时清WIFI模式2下的缓存
extern u16 lenght_cnt;
//语音识别
u8 InRx_Srting[64]={0};//接收字符串
s16 NewInRxSrting=0;
u32 WifiRxStrTimeTick=0;//用于超时清WIFI模式2下的缓存
u32 ReadWifiRxTimeTick(void){return WifiRxTimeTick;}
void SetWifiRxTimeMax(u32 tick){_WIFIRX_CLEARTIME=tick;}
void SetWifiRxTimeTick(u32 tick){WifiRxTimeTick=tick;}
void SetWifiRxTimeNextTick(u32 tick){WifiRxTimeTick=xTaskGetTickCount()+tick;}
u8 ReadWifiRxTimeTickState(void){if(WifiRxTimeTick>xTaskGetTickCount())return 1;else return 0;}
void ClearWifiRxPacketBuffer(void)//清缓存
{
	u16 n;
	InRx_BufferCnt=0;
	for(n=0;n<INRX_BUFFER_SIZE;n++)InRx_Buffer[n]=0;
}
#endif//_JMDRAM_H_
