果云乐鑫原厂参考2c-espressif iot sdk编程手册_第1页
果云乐鑫原厂参考2c-espressif iot sdk编程手册_第2页
果云乐鑫原厂参考2c-espressif iot sdk编程手册_第3页
果云乐鑫原厂参考2c-espressif iot sdk编程手册_第4页
果云乐鑫原厂参考2c-espressif iot sdk编程手册_第5页
已阅读5页,还剩59页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

EspressifISDKFeiJiangang ] ]INTERNAL[]PUBLICJiangangHanJiangangHan JiangangWuHan口JiangangWuHanapiJiangangJiangangheap区大小接Fei4.增加SSL加密称Feimac&ipFei免责申明和本文中的信息,包括供参考的URL地址,变更,恕不另行通知在此未以反言或其他方式授予任何知识使用,不管是明示还是Wi-Fi成员标志归Wi-Fi所有权归©2014所有。 版本信 前 软件框 SDK提供的API接 定时器接 底层用户接 espconn接 通用接 TCP连接接 UDP接 jsonAPI接 数据结构定 定时器结 wifi参 station配置参 softap配置参 scan参 json相关结 json结 json宏定 espconn参 回调 驱动接 GPIO接口 PIN脚功能设置 GPIO输入输出相关 GPIO中断控制相关 GPIO中断处理函 双UART接口 i2cmaster接 无附 ESPCONN编 模 说 步 server模 说 步 需要在ESP8266物联网平台进行软件开发的嵌入式软件开发人员。ESP8266物联网平台的所有网络功能均在库中实现,对用户不透明,用户初始化功能在user_main.c文件中实现。SDKjsonAPI,用户也可以采用自定义数据包格式,自SDKAPI说明:定时器接口接口函数或宏以及所使用的参数结构体定义在(inle.hboolrepeat_flag——该定时是否重复无无无说明:以下所有接口函数或宏以及所使用的参数结构体定义在(工程inlee_eacehvoid无void无uint32id个系统重新跑,程序从user_init开始。uint32time_in_us设置休眠时间,单位:us无uint8无0x00UPGRADE_FW_BIN10x01UPGRADE_FW_BIN2structupgrade_server_info*serverserver相关的参数。 无Uint8onoff/0x000x01代表打开打印功能无注意:1、同时定义USE_US_TIMER;2、system_timer_reinit需放在最开始,user_init第一句。无无Uint32 Uint32——可用heapUint8qlen——消息队列深度#defineSIG_RX#defineTEST_QUEUE_LEN os_event_t*testQueue;voidtest_task(os_event_t{switch(e->sig)case}}void{system_os_task(test_task,USER_TASK_PRIO_0,testQueue,TEST_QUEUE_LEN);}Os_signal_tsig——消息类型无void{}打印输出:sig_rx uint16sec0uint32des_addr-Flash的地址,起始位置。uint32*src_addr-写入Flash的数据指针。Uint32size-写入数据长度SpiFlashOpResultspi_flash_read(uint32src_addr,uint32*des_addr, uint32des_addruint32*src_addrFlashUint32sizeuint8wifi_get_opmodeboolwifi_set_opmode(uint8uint8opmode——wifiTrue,成功;FalseTrue,成功;False不需要调用wifi_station_connect来进行连接。structstation_config*config——wifistation接口参数指针(结构体定义参见4.2.1)True,成功;FalseboolTrue,成功;FalseboolTrue,成功;FalseSTATION_IDLE=0,uint8* uint8 APAPstructscan_config*configAPNULL表示此项不设限。例如,若configNULL,则扫描获取所有AP的信息;scan_done_cb_tscan_done_cb_tcbAPTrue,成功;Falsevoid*arg——获取的AP热点信息参数,arg指针需要转换为bss_infoAP信息,AP4.2.3structbss_info结构体定义(无True,成功;False功能:功能:ESP8266stationAP配置进行连接True,成功;FalseAPidAPESP8266True,成功;False的True,成功;False间void 无structstation_info*next_station;:"MACSTR",ip:"IPSTR"\n",MAC2STR(station- station=next_station;} } stationip0,因此可以使用此函数来True,成功;Falseuint8 –stationipsoftAP#define#definestructip_info*info ip信息structip_infoIP4_ADDR(&info.ip,192,168,3,IP4_ADDR(&info.gw,192,168,3,IP4_ADDR(&mask,255,255,255,0);wifi_set_ip_info(STATION_IF,&info);IP4_ADDR(&info.ip,10,10,10,IP4_ADDR(&info.gw,10,10,10,IP4_ADDR(&mask,255,255,255,0);wifi_set_ip_info(SOFTAP_IF,&info);True,成功;Falseboolwifi_set_macaddr(uint8if_index,uint8uint8 –stationipsoftAP#define#defineuint8 maccharsofap_mac[6]={0x16,0x34,0x56,0x78,0x90,0xab};charsta_mac[6]={0x12,0x34,0x56,0x78,0x90,0xab};True,成功;FalseBoolwifi_get_macaddr(uint8if_index,uint8True,成功;False wifiled状态uint8gpio_id——gpiouint8gpio_name——gpiomux无#define#define0#defineuint8promiscuous——0,disable1,enable无的无Uint8wifi_get_channelboolwifi_set_channel(uint8True,成功;False 通用接口:TCP和UDP均可以调用的接口。ip_addr_t*addr,dns_found_callbackfound)constchar*hostname—ip_addr_t*addr——ipstringip_addr_tLOCALvoid {structespconn*pespconn=(structespconn *((uint8*)&ipaddr->addr),*((uint8*)&ipaddr->addr+*((uint8*)&ipaddr->addr+2),*((uint8*)&ipaddr->addr+}}{ }uint32Sint8espconn_regist_sentcb(structespconn*espconn,espconn_sent_callbackespconn_sent_callbacksent_cb— succeed,#defineESPCONN_OK非0 Sint8espconn_regist_recvcb(structespconn*espconn,espconn_recv_callbackstructespconn*espconn 0succeed,#defineESPCONN_OKvoidespconn_sent_callback(void无voidespconn_recv_callback(void*arg,char*pdata,unsignedshortchar*pdata——接收数 无uint8*psent——sent数据指针 0succeed,#defineESPCONN_OKTCP succeed,#defineESPCONN_OK非非0 succeed,#defineESPCONN_OK非0 Sin8espconn_regist_time(structespconn*espconn,uint32interval,uint8uint32interval7200uint8 0succeed,#defineESPCONN_OK remot_info**pcon_infouint8 0succeed,#defineESPCONN_OK 0succeed,#defineESPCONN_OK无 succeed,#defineESPCONN_OK非0 succeed,#defineESPCONN_OK非0 structespconn*espconn succeed,#defineESPCONN_OK非0 structespconn*espconn succeed,#defineESPCONN_OK非非0 succeed,#defineESPCONN_OK非0 Sint8espconn_secure_sent(structespconn*espconn,uint8*psent,uint16uint8*psent——sent数据指针 0succeed,#defineESPCONN_OK succeed,#defineESPCONN_OK非0 UDP 0succeed,#defineESPCONN_OK succeed,#defineESPCONN_OKjsonAPI说明:jsonparse相关接口函数或宏定义在(工程 \include\jon\jonpae.h \include\json\jsontee.h功能:功能:json解析初始化constchar*json——json无intsize——缓存大小structjsontree_value*root,int(*putchar)(int))int(*putchar)(int)——输入函数无无无voidjsontree_write_int_array(conststructjsontree_context*js_ctx,const*text,uint32无无int——jsonstructjsontree_value*jsontree_find_next(structjsontree_context*js_ctx,inttypedeftypedefvoidETSTimerFunc(voidtypedefstruct_ETSTIMER_struct}wifi{uint8typedeftypedefenum{AUTH_OPEN _}}struct{uint8channel;uint8authmode;uint8u8 u8s8u8json{uint8_t{constcharuint16_tindex[JSONTREE_MAX_DEPTH];uint8_tdepth;uint8_tpath;int{uint8_t{uint8_ttype;uint8_t{uint8_ttype;uint8_t{constchar*json;intpos;intlen;intvstart;intvlen;charchar4.3.2.json\staticstructjsontree_pairjsontree_pair_##name[]=\staticstructjsontree_objectname=\ sizeof(jsontree_pair_##name)/sizeof(structjsontree_pair), jsontree_pair_##name}\staticstructjsontree_value*jsontree_value_##name[]={\staticstructjsontree_arrayname=\ sizeof(jsontree_value_##name)/sizeof(structjsontree_value*), jsontree_value_##name}回调/**callbackprototypetoinformabouteventsforaespconntypedefvoid(*espconn_recv_callback)(void*arg,char*pdata,unsignedshortlen);typedefvoid(*espconn_callback)(void*arg,char*pdata,unsignedshortlen);typedefvoid(*espconn_connect_callback)(void*arg);typedefvoid*espconn_handle;typedefstruct_esp_tcp{int_port;intserver_port;charipaddr[4];espconn_connect_callbackconnect_callback;espconn_connect_callbackreconnect_callback;}{int_port;}/**Protocolfamilyandtypeoftheespconn*/enumespconn_type{ =/*ESPCONN_TCPGroup*/ /*ESPCONN_UDPGroup*/ /**Currentstateoftheespconn.Non-TCPespconnarealwaysinstateESPCONN_NONE!*/enum{ESPCONN_NONE,/**Aespconndescriptor*/structespconn{/**typeoftheespconn(TCP,UDP)*/enumespconn_typetype;/**currentstateoftheespconn*/enumespconn_statestate;unionesp_tcp*tcp;}/**Acallbackfunctionthatisinformedab

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论