此笔记由个人整理
华为IOT LiteOS开发实战营
第七天
一、WiFi模块
-
ESP8266
- 内置32位CPU,可以兼作应用处理器
- 内置TCP/IP协议栈
- 深度睡眠低功耗
- 2ms内唤醒
- 工作温度:-40~125
二、相关配置
NB-IoT
- .config
#
# LiteOS for STM32L431_BearPi Project configuration For IoT Link
#
#
# This is a demo project and hope you enjoy it
#
CONFIG_ARCH_CPU_TYPE="armv7-m"
CONFIG_UARTAT_RCVMAX=2048
CONFIG_UARTAT_BAUDRATE=9600
CONFIG_UARTAT_DEVNAME="atdev"
#
# IoT link SDK configuration
#
#
# you should choose a os kernel first!
#
#
# OS configuration
#
CONFIG_LITEOS_ENABLE=y
# CONFIG_NOVAOS_ENABLE is not set
# CONFIG_LINUXOS_ENABLE is not set
# CONFIG_MACOS_ENABLE is not set
# CONFIG_NEW_OS is not set
# end of OS configuration
#
# At configuration
#
CONFIG_AT_ENABLE=y
CONFIG_AT_DEVNAME="atdev"
CONFIG_AT_OOBTABLEN=6
CONFIG_AT_RECVMAXLEN=1024
CONFIG_AT_TASKPRIOR=10
# end of At configuration
CONFIG_CJSON_ENABLE=y
CONFIG_DRIVER_ENABLE=y
#
# LinkLog configuration
#
CONFIG_LINKLOG_ENABLE=y
# end of LinkLog configuration
CONFIG_LINKQUEUE_ENABLE=y
CONFIG_LINKDEMO_ENABLE=y
#
# Stimer configuration
#
CONFIG_STIMER_ENABLE=y
CONFIG_STIMER_STACKSIZE=2048
CONFIG_STIMER_TASKPRIOR=10
# CONFIG_STIMER_DEMO_ENABLE is not set
# end of Stimer configuration
#
# Network configuration
#
#
# Tcpip configuration
#
# CONFIG_TCIP_AL_ENABLE is not set
# end of Tcpip configuration
#
# Dtls configuration
#
# CONFIG_DTLS_AL_ENABLE is not set
# end of Dtls configuration
#
# Coap configuration
#
# CONFIG_COAP_AL_ENABLE is not set
# end of Coap configuration
#
# Lwm2m configuration
#
# CONFIG_LWM2M_AL_ENABLE is not set
# end of Lwm2m configuration
#
# Mqtt configuration
#
# CONFIG_MQTT_AL_ENABLE is not set
# end of Mqtt configuration
# end of Network configuration
#
# OceanConnect SERVICE configuration
#
CONFIG_OCSERVICES_ENABLE=y
#
# OceanConnect Coap configuration
#
# CONFIG_OCCOAP_ENABLE is not set
# end of OceanConnect Coap configuration
#
# OceanConnect Lwm2m configuration
#
CONFIG_OCLWM2M_ENABLE=y
# CONFIG_OCLWM2MTINY_ENABLE is not set
CONFIG_BOUDICA150_ENABLE=y
# CONFIG_OCLWM2MNULL is not set
# CONFIG_OCLWM2M_DEMO_ENABLE is not set
# end of OceanConnect Lwm2m configuration
#
# OceanConnect Mqtt configuration
#
# CONFIG_OCMQTT_ENABLE is not set
# end of OceanConnect Mqtt configuration
# end of OceanConnect SERVICE configuration
#
# Shell configuration
#
CONFIG_SHELL_ENABLE=y
CONFIG_SHELL_TASK_STACKSIZE=2048
CONFIG_SHELL_TASK_PRIOR=10
# end of Shell configuration
CONFIG_IOT_LINK_CONFIGFILE="iot_config.h"
# end of IoT link SDK configuration
# CONFIG_Demo_None is not set
CONFIG_Demo_Helloworld=y
# CONFIG_Demo_Streetlight is not set
# CONFIG_Demo_Agriculture is not set
# CONFIG_Demo_Track is not set
# CONFIG_Demo_Smoke is not set
# CONFIG_Demo_Cover is not set
# CONFIG_Demo_Infrared is not set
# CONFIG_Demo_OC_Cloud_Map is not set
CONFIG_USER_DEMO="hello_world_demo"
# end of LiteOS for STM32L431_BearPi Project configuration For IoT Link
- iot_config.h
#define CONFIG_ARCH_CPU_TYPE "armv7-m"
#define CONFIG_UARTAT_RCVMAX 2048
#define CONFIG_UARTAT_BAUDRATE 9600
#define CONFIG_UARTAT_DEVNAME "atdev"
#define CONFIG_LITEOS_ENABLE 1
#define CONFIG_AT_ENABLE 1
#define CONFIG_AT_DEVNAME "atdev"
#define CONFIG_AT_OOBTABLEN 6
#define CONFIG_AT_RECVMAXLEN 1024
#define CONFIG_AT_TASKPRIOR 10
#define CONFIG_CJSON_ENABLE 1
#define CONFIG_DRIVER_ENABLE 1
#define CONFIG_LINKLOG_ENABLE 1
#define CONFIG_LINKQUEUE_ENABLE 1
#define CONFIG_LINKDEMO_ENABLE 1
#define CONFIG_STIMER_ENABLE 1
#define CONFIG_STIMER_STACKSIZE 2048
#define CONFIG_STIMER_TASKPRIOR 10
#define CONFIG_OCSERVICES_ENABLE 1
#define CONFIG_OCLWM2M_ENABLE 1
#define CONFIG_BOUDICA150_ENABLE 1
#define CONFIG_SHELL_ENABLE 1
#define CONFIG_SHELL_TASK_STACKSIZE 2048
#define CONFIG_SHELL_TASK_PRIOR 10
#define CONFIG_IOT_LINK_CONFIGFILE "iot_config.h"
#define CONFIG_Demo_Cover 1
#define CONFIG_USER_DEMO "oc_manhole_cover_template"
WiFi
- .config
CONFIG_ARCH_CPU_TYPE="armv7-m"
CONFIG_UARTAT_RCVMAX=2048
CONFIG_UARTAT_BAUDRATE=115200
CONFIG_UARTAT_DEVNAME="atdev"
CONFIG_LITEOS_ENABLE=y
CONFIG_AT_ENABLE=y
CONFIG_AT_DEVNAME="atdev"
CONFIG_AT_OOBTABLEN=6
CONFIG_AT_RECVMAXLEN=1024
CONFIG_AT_TASKPRIOR=10
CONFIG_CJSON_ENABLE=y
CONFIG_DRIVER_ENABLE=y
CONFIG_LINKLOG_ENABLE=y
CONFIG_LINKQUEUE_ENABLE=y
CONFIG_LINKDEMO_ENABLE=y
CONFIG_STIMER_ENABLE=y
CONFIG_STIMER_STACKSIZE=2048
CONFIG_STIMER_TASKPRIOR=10
CONFIG_TCIP_AL_ENABLE=y
CONFIG_ESP8266_ENABLE=y
CONFIG_ESP8266_SSID="Huawei"//wifi名
CONFIG_ESP8266_PWD="12345678"//wifi密码
CONFIG_LWM2M_AL_ENABLE=y
CONFIG_WAKAAMALWM2M_ENABLE=y
CONFIG_OCSERVICES_ENABLE=y
CONFIG_OCLWM2M_ENABLE=y
CONFIG_OCLWM2MTINY_ENABLE=y
CONFIG_SHELL_ENABLE=y
CONFIG_SHELL_TASK_STACKSIZE=2048
CONFIG_SHELL_TASK_PRIOR=10
CONFIG_IOT_LINK_CONFIGFILE="iot_config.h"
CONFIG_Demo_Helloworld=y
CONFIG_USER_DEMO="hello_world_demo"
- iot_config.h
#define CONFIG_ARCH_CPU_TYPE "armv7-m"
#define CONFIG_UARTAT_RCVMAX 2048
#define CONFIG_UARTAT_BAUDRATE 115200
#define CONFIG_UARTAT_DEVNAME "atdev"
#define CONFIG_LITEOS_ENABLE 1
#define CONFIG_AT_ENABLE 1
#define CONFIG_AT_DEVNAME "atdev"
#define CONFIG_AT_OOBTABLEN 6
#define CONFIG_AT_RECVMAXLEN 1024
#define CONFIG_AT_TASKPRIOR 10
#define CONFIG_CJSON_ENABLE 1
#define CONFIG_DRIVER_ENABLE 1
#define CONFIG_LINKLOG_ENABLE 1
#define CONFIG_LINKQUEUE_ENABLE 1
#define CONFIG_LINKDEMO_ENABLE 1
#define CONFIG_STIMER_ENABLE 1
#define CONFIG_STIMER_STACKSIZE 2048
#define CONFIG_STIMER_TASKPRIOR 10
#define CONFIG_TCIP_AL_ENABLE 1
#define CONFIG_ESP8266_ENABLE 1
#define CONFIG_ESP8266_SSID "Huawei"//wifi名
#define CONFIG_ESP8266_PWD "12345678"//wifi密码
#define CONFIG_LWM2M_AL_ENABLE 1
#define CONFIG_WAKAAMALWM2M_ENABLE 1
#define CONFIG_OCSERVICES_ENABLE 1
#define CONFIG_OCLWM2M_ENABLE 1
#define CONFIG_OCLWM2MTINY_ENABLE 1
#define CONFIG_SHELL_ENABLE 1
#define CONFIG_SHELL_TASK_STACKSIZE 2048
#define CONFIG_SHELL_TASK_PRIOR 10
#define CONFIG_IOT_LINK_CONFIGFILE "iot_config.h"
#define CONFIG_Demo_Helloworld 1
#define CONFIG_USER_DEMO "hello_world_demo"
- 注释掉图片显示,因为wifi用到的组件十分多,内存不够用
static int lcd_task_entry()
{
// LCD_Show_Image(0, 0, 240, 240, gImage_xianshi);
LCD_Clear(BLACK);
LCD_ShowString(175, 198, 210, 32, 32, "OFF");
LCD_ShowString(83, 198, 210, 32, 32, "OFF");
while (1)
{
// 传感器数据对应图片位置:
LCD_ShowNum(90, 62, (uint32_t)E53_IA1_Data.Temperature, 5, 32);
LCD_ShowNum(90, 105, (uint32_t)E53_IA1_Data.Humidity, 5, 32);
LCD_ShowNum(90, 152, (uint32_t)E53_IA1_Data.Lux, 5, 32);
osal_task_sleep(2 * 1000);
}
}
版权声明:本文为qq_44772822原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。