• How to get the RSSI (Received Signal Strength Indicator) of an AP
•
How to read and write information from sectors on a flash memory
• Examples of RTC
• How to port apps from non-OS SDK to RTOS SDK
3.2.1. Initialization
1. The initialization of application programs can be implemented in user_main.c. The
function voiduser_init(void), which is the entry-point function, can be used by users
to implement the initialization process. It is suggested that the SDK’s version information
be printed, and the Wi-Fi working mode be set.
voiduser_init(void)
{
printf("SDKversion:%s\n",system_get_sdk_version());
/*station+soft-APmode*/
Wi-Fi_set_opmode(STATIONAP_MODE);
……
}
2. ESP8266_RTOS_SDK adopts UART0 to print debugging information by default, and the
baud rate is 74880 by default. UART initialization can be defined by users themselves in
user_init. Please refer to uart_init_new on how to implement this.
Sample of UART driver: \ESP8266_RTOS_SDK\driver_lib\driver\uart.c
Take the initialization of UART0 as an example. Configure the parameters of UART:
UART_ConfigTypeDefuart_config;
uart_config.baud_rate=BIT_RATE_74880;
uart_config.data_bits=UART_WordLength_8b;
uart_config.parity=USART_Parity_None;
uart_config.stop_bits=USART_StopBits_1;
uart_config.flow_ctrl=USART_HardwareFlowControl_None;
uart_config.UART_RxFlowThresh=120;
uart_config.UART_InverseMask=UART_None_Inverse;
UART_ParamConfig(UART0,&uart_config);
Register the UART interrupt function and enable the UART interrupt:
UART_IntrConfTypeDefuart_intr;
uart_intr.UART_IntrEnMask=UART_RXFIFO_TOUT_INT_ENA|UART_FRM_ERR_INT_ENA|
UART_RXFIFO_FULL_INT_ENA|UART_TXFIFO_EMPTY_INT_ENA;
uart_intr.UART_RX_FifoFullIntrThresh=10;
uart_intr.UART_RX_TimeOutIntrThresh=2;
uart_intr.UART_TX_FifoEmptyIntrThresh=20;
UART_IntrConfig(UART0,&uart_intr);