void AT_CmdProcessInit(void) { uint32_t i; RINGBUF_Init(&smsUnreadRingBuff,smsUnreadBuff,sizeof(smsUnreadBuff)); for(i = 0;i < SOCKET_NUM; i++) { RINGBUF_Init(&gprsRingLengthBuff[i],gprsLengthBuff[i],GPRS_KEEP_DATA_INFO_LENGTH); } }
/** * @brief Config UART for Camera Communication * @param * @param * @retval */ void UART_CAM_Config(void) { UART_Config(CAM_COMM, 115200); /* Ring Buff */ RINGBUF_Init(&uartCAM_RxRingBuff, uartCAM_RxBuff, sizeof(uartCAM_RxBuff)); }
void ICACHE_FLASH_ATTR CMD_Init() { INFO("CMD: INIT\r\n"); RINGBUF_Init(&rxRb, rxBuf, sizeof(rxBuf)); PROTO_Init(&rxProto, protoCompletedCb, protoRxBuf, sizeof(protoRxBuf)); system_os_task(CMD_Task, CMD_TASK_PRIO, cmdRecvQueue, CMD_TASK_QUEUE_SIZE); system_os_post(CMD_TASK_PRIO, 0, 0); }
void Long_Uart2_Init(void) { uint32_t ui32_SystemClock; RINGBUF_Init(&long_Uart2_TxRingBuf, long_Uart2_TxBuf, sizeof(long_Uart2_TxBuf)); RINGBUF_Init(&long_Uart2_RxRingBuf, long_Uart2_RxBuf, sizeof(long_Uart2_RxBuf)); ui32_SystemClock = u32_UsrSystemClockGet(); SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); GPIOPinConfigure(GPIO_PD6_U2RX); GPIOPinConfigure(GPIO_PD7_U2TX); IntDisable(INT_UART2); GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7); UARTConfigSetExpClk(UART2_BASE, ui32_SystemClock, 19200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); UARTIntRegister(UART2_BASE, &UART2_RxTxHandler); UARTIntClear(UART2_BASE, UART_INT_RX | UART_INT_TX); UARTIntEnable(UART2_BASE, UART_INT_RX | UART_INT_RT); UARTTxIntModeSet(UART2_BASE, UART_TXINT_MODE_EOT); IntEnable(INT_UART2); }
/******************************************************************************* Function name: Decription: Input: None Output: None *******************************************************************************/ void SIM900_Init(uint32_t baud) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE); #ifdef SIM_USE_KEY RCC_APB2PeriphClockCmd(SIM_KEY_RCC, ENABLE); GPIO_InitStructure.GPIO_Pin = SIM_KEY_Pin; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(SIM_KEY_Port, &GPIO_InitStructure); #endif #ifdef SIM_USE_RST RCC_APB2PeriphClockCmd(SIM_RST_RCC, ENABLE); GPIO_InitStructure.GPIO_Pin = SIM_RST_Pin; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(SIM_RST_Port, &GPIO_InitStructure); #endif #ifdef SIM_USE_RI RCC_APB2PeriphClockCmd(SIM_RI_RCC, ENABLE); GPIO_InitStructure.GPIO_Pin = SIM_RI_Pin; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(SIM_RI_Port, &GPIO_InitStructure); #endif #ifdef SIM_USE_STT RCC_APB2PeriphClockCmd(SIM_STT_RCC, ENABLE); GPIO_InitStructure.GPIO_Pin = SIM_STT_Pin; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(SIM_STT_Port, &GPIO_InitStructure); #endif SIM_RST_HIGH; // Config UART UART_Config(SIM_COMM, baud); /*Ring Buff*/ RINGBUF_Init(&UART1_RxRingBuff, UART1_RxBuff, sizeof(UART1_RxBuff)); }
void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue) { os_memset((void *)&queue_buf, 0, sizeof(uint8_t)*OTB_MQTT_QUEUE_BUFFER_SIZE); queue->buf = (uint8_t*)&queue_buf; RINGBUF_Init(&queue->rb, queue->buf, OTB_MQTT_QUEUE_BUFFER_SIZE); }
void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize) { queue->buf = (uint8_t*)os_zalloc(bufferSize); RINGBUF_Init(&queue->rb, queue->buf, bufferSize); }
void ICACHE_FLASH_ATTR QUEUE_Init_Ptr(QUEUE *queue, uint8* pBuffer,int bufferSize) { queue->buf = pBuffer; RINGBUF_Init(&queue->rb, queue->buf, bufferSize); }