| | |
| | | #define AIR780E_UART_TX_QUEUE_MEMBER_CNT 16 /* 串口未使用DMA模式,不需要 */ |
| | | |
| | | /* AT相关 */ |
| | | #define AIR780E_AT_SEND_BUF_SIZE (1024 + 512) /* 发送的单条AT指令的最大长度 */ |
| | | #define AIR780E_AT_RECV_BUF_SIZE (1024 + 512) /* 单挑AT指令 */ |
| | | #define AIR780E_AT_SEND_BUF_SIZE ((5 * 1024) + 512) /* 发送的单条AT指令的最大长度 */ |
| | | #define AIR780E_AT_RECV_BUF_SIZE ((5 * 1024) + 512) /* 单挑AT指令 */ |
| | | |
| | | /******************************************************************************* |
| | | * Type Definition * |
| | |
| | | * Author : 杜键 |
| | | * Modified Date: : 2018年5月22日 |
| | | *******************************************************************************/ |
| | | //#ifdef _UWB_4G |
| | | //#else |
| | | //#endif |
| | | #ifdef _GPS_115200 |
| | | void AIR780EUartInit(void) |
| | | { |
| | | ST_UartInit stUartInit; |
| | |
| | | stUartInit.m_pu8TxBuf = l_au8AIR780EUartTxBuf; |
| | | stUartInit.m_u32TxBufSize = AIR780E_UART_TX_BUF_SIZE; |
| | | stUartInit.m_u32TxQueueMemberCnt = AIR780E_UART_TX_QUEUE_MEMBER_CNT; |
| | | stUartInit.m_u32BaudRate = 9600; |
| | | stUartInit.m_u32BaudRate = 115200; |
| | | if(Uart_Init(UART_ID_4G, &stUartInit) != HIDO_OK) |
| | | { |
| | | |
| | |
| | | |
| | | return HIDO_OK; |
| | | } |
| | | #else |
| | | void AIR780EUartInit(void) |
| | | { |
| | | ST_UartInit stUartInit; |
| | | |
| | | /* 串口初始化 */ |
| | | stUartInit.m_eRxMode = UART_RX_MODE_INT; |
| | | stUartInit.m_eTxMode = UART_TX_MODE_POLL; |
| | | stUartInit.m_pu8RxBuf = l_au8AIR780EUartRxBuf; |
| | | stUartInit.m_u32RxBufSize = AIR780E_UART_RX_BUF_SIZE; |
| | | stUartInit.m_pu8TxBuf = l_au8AIR780EUartTxBuf; |
| | | stUartInit.m_u32TxBufSize = AIR780E_UART_TX_BUF_SIZE; |
| | | stUartInit.m_u32TxQueueMemberCnt = AIR780E_UART_TX_QUEUE_MEMBER_CNT; |
| | | stUartInit.m_u32BaudRate = 9600; |
| | | if(Uart_Init(UART_ID_4G, &stUartInit) != HIDO_OK) |
| | | { |
| | | |
| | | } |
| | | } |
| | | HIDO_INT32 AIR780EDriver_Init(void) |
| | | { |
| | | ST_UartInit stUartInit; |
| | | |
| | | /* 串口初始化 */ |
| | | stUartInit.m_eRxMode = UART_RX_MODE_INT; |
| | | stUartInit.m_eTxMode = UART_TX_MODE_POLL; |
| | | stUartInit.m_pu8RxBuf = l_au8AIR780EUartRxBuf; |
| | | stUartInit.m_u32RxBufSize = AIR780E_UART_RX_BUF_SIZE; |
| | | stUartInit.m_pu8TxBuf = l_au8AIR780EUartTxBuf; |
| | | stUartInit.m_u32TxBufSize = AIR780E_UART_TX_BUF_SIZE; |
| | | stUartInit.m_u32TxQueueMemberCnt = AIR780E_UART_TX_QUEUE_MEMBER_CNT; |
| | | stUartInit.m_u32BaudRate = 9600; |
| | | if(Uart_Init(UART_ID_4G, &stUartInit) != HIDO_OK) |
| | | { |
| | | return HIDO_ERR; |
| | | } |
| | | |
| | | /* 定时器初始化 */ |
| | | if (HIDO_TimerCreate(&l_stDriverData.m_u32FSMTimerID) != HIDO_OK) |
| | | { |
| | | return HIDO_ERR; |
| | | } |
| | | |
| | | /* AT驱动初始化 */ |
| | | HIDO_ATLiteDeviceInitStruct stATInit; |
| | | |
| | | stATInit.m_pstFSM = HIDO_FSM(AIR780E); |
| | | stATInit.m_pstAtSets = l_astATCmdSetList; |
| | | stATInit.m_u32AtSetsCount = HIDO_ARRARY_COUNT(l_astATCmdSetList); |
| | | stATInit.m_fnGetc = AIR780E_GetChar; |
| | | stATInit.m_fnReadLine = AIR780E_ReadLine; |
| | | stATInit.m_fnOutput = AIR780E_Output; |
| | | stATInit.m_pcSendBuf = (HIDO_CHAR *) l_au8ATSendBuf; |
| | | stATInit.m_u32SendBufSize = HIDO_ARRARY_COUNT(l_au8ATSendBuf); |
| | | stATInit.m_pcLineBuf = (HIDO_CHAR *) l_au8ATRecvBuf; |
| | | stATInit.m_u32LineBufSize = HIDO_ARRARY_COUNT(l_au8ATRecvBuf); |
| | | stATInit.m_pUserData = &l_stDriverData; |
| | | |
| | | /* AT设备初始化 */ |
| | | if (HIDO_ATLiteDeviceInit(&l_stAIR780EDevice, &stATInit) != HIDO_OK) |
| | | { |
| | | return HIDO_ERR; |
| | | } |
| | | |
| | | /* 状态机初始化 */ |
| | | HIDO_FSMRegister(HIDO_FSM(AIR780E), HIDO_FSM_STATE(AIR780E), "AIR780E", l_apcEventName, &l_stAIR780EDevice, |
| | | HIDO_FSM_DBG_FLAG_ON); |
| | | |
| | | HIDO_FSMRegisterDebugFunc(HIDO_FSM(AIR780E), AIR780EDriver_FSMDebug); |
| | | |
| | | return HIDO_OK; |
| | | } |
| | | #endif |