久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標題: ESP8266_OTA_LEXIN_學習版源碼(原創) [打印本頁]

作者: lijay910    時間: 2019-12-8 09:19
標題: ESP8266_OTA_LEXIN_學習版源碼(原創)
ESP8266 之OTA升級學習源碼,原創,可以自己學習用也可以改,分享給大家!

單片機源程序如下:
  1. /* main.c -- MQTT client example
  2. *
  3. * Copyright (c) 2014-2015, Tuan PM <tuanpm at live dot com>
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. *
  9. * * Redistributions of source code must retain the above copyright notice,
  10. * this list of conditions and the following disclaimer.
  11. * * Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * * Neither the name of Redis nor the names of its contributors may be used
  15. * to endorse or promote products derived from this software without
  16. * specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  22. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. * POSSIBILITY OF SUCH DAMAGE.
  29. */


  30. #include "ets_sys.h"
  31. #include "driver/uart.h"
  32. #include "osapi.h"
  33. //#include "wifi.h"
  34. #include "config.h"
  35. #include "gpio.h"
  36. #include "user_interface.h"
  37. #include "mem.h"
  38. #include "../iotserver/include/user_net.h"



  39. void wifiConnectCb(uint8_t status)
  40. {
  41.         //tcp服務器
  42.                 if(status == STATION_GOT_IP)
  43.                 {
  44.                         if(mDebug)
  45.                         {
  46.                                 at_port_print("Connect to TCP Server\r\n");
  47.                         }
  48.                         connect_tcp_server();
  49.                 }
  50.                 else
  51.                 {
  52.                         disconnect_tcp_server();
  53.                 }

  54. }


  55. /******************************************************************************
  56. * FunctionName : user_rf_cal_sector_set
  57. * Description  : SDK just reversed 4 sectors, used for rf init data and paramters.
  58. *                We add this function to force users to set rf cal sector, since
  59. *                we don't know which sector is free in user's application.
  60. *                sector map for last several sectors : ABCCC
  61. *                A : rf cal
  62. *                B : rf init data
  63. *                C : sdk parameters
  64. * Parameters   : none
  65. * Returns      : rf cal sector
  66. *******************************************************************************/
  67. uint32 ICACHE_FLASH_ATTR
  68. user_rf_cal_sector_set(void)
  69. {
  70.     enum flash_size_map size_map = system_get_flash_size_map();
  71.     uint32 rf_cal_sec = 0;

  72.     switch (size_map) {
  73.         case FLASH_SIZE_4M_MAP_256_256:
  74.             rf_cal_sec = 128 - 5;
  75.             break;

  76.         case FLASH_SIZE_8M_MAP_512_512:
  77.             rf_cal_sec = 256 - 5;
  78.             break;

  79.         case FLASH_SIZE_16M_MAP_512_512:
  80.         case FLASH_SIZE_16M_MAP_1024_1024:
  81.             rf_cal_sec = 512 - 5;
  82.             break;

  83.         case FLASH_SIZE_32M_MAP_512_512:
  84.         case FLASH_SIZE_32M_MAP_1024_1024:
  85.             rf_cal_sec = 1024 - 5;
  86.             break;

  87.         case FLASH_SIZE_64M_MAP_1024_1024:
  88.             rf_cal_sec = 2048 - 5;
  89.             break;
  90.         case FLASH_SIZE_128M_MAP_1024_1024:
  91.             rf_cal_sec = 4096 - 5;
  92.             break;
  93.         default:
  94.             rf_cal_sec = 0;
  95.             break;
  96.     }

  97.     return rf_cal_sec;
  98. }


  99. void user_init(void)
  100. {
  101.         //此例子完全開源,某些作者還需要打賞,這個完全是根據樂鑫的官方例子的改進的,需要商用版的請聯系
  102.         BOOL bRet = FALSE;
  103.         char buffer[20] = {0};
  104.         uart_init(BIT_RATE_115200, BIT_RATE_115200);//jay lee 20180228 波特率
  105.         os_delay_us(60000);
  106.         user_net_init(wifiConnectCb);
  107. }
復制代碼

所有資料51hei提供下載:
ESP8266_OTA_LEXIN.7z (2.13 MB, 下載次數: 10)







歡迎光臨 (http://www.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 99久久久无码国产精品 | 亚洲福利网 | 欧美在线一区二区三区 | 欧美一级片在线看 | 狠狠干网站 | 日韩在线欧美 | 超碰伊人 | 久久久久久久久久久久久9999 | 国产日韩精品久久 | 91佛爷在线观看 | 人人干在线 | 欧美中文字幕一区二区三区 | 亚洲一区欧美一区 | 美女张开腿露出尿口 | 亚洲一区中文字幕 | 91综合在线视频 | 看av在线 | 亚洲 中文 欧美 日韩 在线观看 | 国产精品美女久久久久aⅴ国产馆 | 国产小视频精品 | 亚洲高清在线 | av激情影院| 免费在线成人网 | 伊人色综合久久天天五月婷 | 有码一区| 91视频观看| 国产日韩欧美在线 | 亚洲精品一区二三区不卡 | 亚洲狠狠爱 | 国产精品av久久久久久久久久 | 国产黄色网址在线观看 | 毛片视频免费观看 | 超碰97人人人人人蜜桃 | 中文字幕国产视频 | 成人精品一区二区 | 黄色毛片免费看 | 成人h电影在线观看 | 中文精品视频 | 日日干日日色 | ririsao久久精品一区 | 日韩精品在线播放 |