void user_init(void) { ETS_UART_INTR_DISABLE(); UART_SetBaudrate(UART0, BIT_RATE_9600); UART_ResetFifo(UART0); UART_SetBaudrate(UART1, BIT_RATE_115200); UART_ResetFifo(UART1); flash_param_init(); flash_param = flash_param_get(); emsRxBuf = allocateRcvMsgBuff(); uart_init(BIT_RATE_9600, BIT_RATE_115200); rtc_clock_calibration = system_rtc_clock_cali_proc(); // get RTC clock period os_printf("rtc_clock_calibration: %0x\n", rtc_clock_calibration >>12 ); os_printf("system_get_rtc_time: %d\n", system_get_rtc_time()); os_printf("system_get_time: %d\n", system_get_time()); serverInit(flash_param->port); wifi_set_sleep_type(LIGHT_SLEEP_T); system_os_task(recvTask, recvTaskPrio, recvTaskQueue, recvTaskQueueLen); ETS_UART_INTR_ENABLE(); }
/****************************************************************************** * FunctionName : user_init * Description : entry of user application, init user function here * Parameters : none * Returns : none *******************************************************************************/ void ICACHE_FLASH_ATTR user_init(void) { UART_SetBaudrate(0,115200); printf("SDK version:%s\n", system_get_sdk_version()); /* need to set opmode before you set config */ wifi_set_opmode(STATION_MODE); xTaskCreate(smartconfig_task, "smartconfig_task", 256, NULL, 2, NULL); }
//////////////////////////////////////////// // user_init - Entry point of application // //////////////////////////////////////////// void user_init(void) { // Set the LED as an output, turn it off: GPIO_AS_OUTPUT(LED_PIN); GPIO_OUTPUT_SET(LED_PIN, 0); // Configure the UART, print a message: UART_SetBaudrate(UART0, BIT_RATE_115200); printf("SDK version:%s\n", system_get_sdk_version()); // Connect to WiFi: connectWiFi(); }
/****************************************************************************** * FunctionName : user_init * Description : entry of user application, init user function here * Parameters : none * Returns : none *******************************************************************************/ void ICACHE_FLASH_ATTR user_init(void) { UART_SetBaudrate(0,115200); printf("SDK version:%s\n", system_get_sdk_version()); xTaskHandle xHandle = NULL; // Create Timer (Trigger a measurement every second) timerHandle = xTimerCreate((signed char *)"BMP180 Trigger", 1000/portTICK_RATE_MS, pdTRUE, NULL, task); if (timerHandle != NULL) { if (xTimerStart(timerHandle, 0) != pdPASS) { printf("%s: Unable to start Timer ...\n", __FUNCTION__); } } else { printf("%s: Unable to create Timer ...\n", __FUNCTION__); } }
void UART_ParamConfig(UART_Port uart_no, UART_ConfigTypeDef *pUARTConfig) { if (uart_no == UART1) { PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK); } else { PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U); PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD); PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD); } UART_SetFlowCtrl(uart_no, pUARTConfig->flow_ctrl, pUARTConfig->UART_RxFlowThresh); UART_SetBaudrate(uart_no, pUARTConfig->baud_rate); WRITE_PERI_REG(UART_CONF0(uart_no), ((pUARTConfig->parity == USART_Parity_None) ? 0x0 : (UART_PARITY_EN | pUARTConfig->parity)) | (pUARTConfig->stop_bits << UART_STOP_BIT_NUM_S) | (pUARTConfig->data_bits << UART_BIT_NUM_S) | ((pUARTConfig->flow_ctrl & USART_HardwareFlowControl_CTS) ? UART_TX_FLOW_EN : 0x0) | pUARTConfig->UART_InverseMask); UART_ResetFifo(uart_no); }
void HardwareSerial::begin(const uint32_t baud/* = 9600*/) { UART_SetBaudrate(UART0,baud); UART_intr_handler_register((void *) &uartReceiveInterruptHandler,NULL); ETS_UART_INTR_ENABLE(); }