• 大小: 5.25MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-22
  • 语言: 其他
  • 标签: MQTT  SIM800  AIR208S  stm32  

资源简介

F103C8T6+SIM800C 模组连接阿里云物联网平台套件,实现的功能:1、STM32上PC13控制LED翻转作为运行指示灯2、串口2(PA2)用来打印运行数据(包括MQTT连接网发布消息订阅主题)3、阿里物联网平台在线调试下发一个led开关命令通过串口2打印信息验证4、平台能收到温度值并显示(仅32上电的时候publish温度值,官网是2S发布一次)5、也可以用AIR208S模组全指令共用都是sim800的AT指令6、调试助手:PC端可以用mqtt.fx模拟设备,手机端可以用微信搜索小程序“MQTT模拟器”进行模拟测试

资源截图

代码片段和文件信息

/**
 * NOTE:
 *
 * HAL_TCP_xxx API reference implementation: wrappers/os/ubuntu/HAL_TCP_linux.c
 *
 */
#include 
#include 
#include 
#include “stm32f1xx_hal.h“
#include “infra_types.h“
#include “infra_defs.h“
#include “wrappers_defs.h“
#include “at_wrapper.h“

#define EXAMPLE_PRODUCT_KEY         “a1OX6aa5gk8“
#define EXAMPLE_PRODUCT_SECRET      “4R9HZPK22uyWog2E“
#define EXAMPLE_DEVICE_NAME         “example“
#define EXAMPLE_DEVICE_SECRET       “NROjb5mS14K36DJsYU1mlqcijoOXs2Rj“

#define EXAMPLE_FIRMWARE_VERSION    “app-1.0.0-20190118.1000“
#define RING_BUFFER_SIZE            (128)
typedef struct
{
  uint8_t  data[RING_BUFFER_SIZE];
  uint16_t tail; 
  uint16_t head;
}uart_ring_buffer_t;

extern UART_HandleTypeDef huart1;

static uint8_t  g_uart_tx_flag;
static uart_ring_buffer_t   g_uart_rx_buf;
static UART_HandleTypeDef* p_at_uart = &huart1;

#ifdef  STM32_MEM_DEBUG
#define MEM_DEBUG_INFO_NUM    (40)
typedef struct {
    void* addr;
    uint32_t len;
}mem_debug_info_t;

volatile uint32_t g_mem_alloc_num = 0;
volatile uint32_t g_mem_alloc_maxnum = 0;
volatile uint32_t g_mem_alloc_len = 0;
volatile uint32_t g_mem_alloc_maxlen = 0;
mem_debug_info_t g_mem_debug_info[MEM_DEBUG_INFO_NUM] = {0};

void mem_alloc_debug(void* addr uint32_t len)
{
    int i;
    if(NULL == addr){
        return;
    }

    if(0 == len){
        return;
    }

    for(i = 0; i < MEM_DEBUG_INFO_NUM; i++){
        if(g_mem_debug_info[i].addr == addr){
            printf(“error >>  %d  addr alloc error 0x%08x\n“iaddr);
            return;
        }
    }

    for(i = 0; i < MEM_DEBUG_INFO_NUM; i++){
        if(g_mem_debug_info[i].addr == NULL){
            g_mem_debug_info[i].addr = addr;
            g_mem_debug_info[i].len = len;
            g_mem_alloc_len += len;
            g_mem_alloc_maxlen = g_mem_alloc_len > g_mem_alloc_maxlen ? g_mem_alloc_len : g_mem_alloc_maxlen;
            g_mem_alloc_num++;
            g_mem_alloc_maxnum = g_mem_alloc_num > g_mem_alloc_maxnum ? g_mem_alloc_num : g_mem_alloc_maxnum;
            return;
        }
    }

    printf(“error >> g_mem_debug_info id empty\n“);
}

void mem_free_debug(void* addr)
{
    int i;
    if(NULL == addr){
        return;
    }

    for(i = 0; i < MEM_DEBUG_INFO_NUM; i++){
        if(g_mem_debug_info[i].addr == addr){
            if(g_mem_alloc_len >= g_mem_debug_info[i].len){
                g_mem_alloc_len -= g_mem_debug_info[i].len;
            }
            else{
                printf(“error >> g_mem_alloc_len calc error 0x%08x   0x%08x\n“g_mem_alloc_leng_mem_debug_info[i].len);
                return;
            }
            g_mem_debug_info[i].addr = NULL;
            g_mem_debug_info[i].len = 0;
            g_mem_alloc_num--;
            return;
        }
    }

    printf(“error >> mem_free_debug not find 0x%08x\n“addr);
}
void mem_debug_show(void){
    printf(“\n

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5797  2019-06-20 16:29  SIM800C_TCP_Basic\.mxproject

     文件     499462  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f100xb.h

     文件     544671  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f100xe.h

     文件     450133  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f101x6.h

     文件     460506  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f101xb.h

     文件     538320  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f101xe.h

     文件     553362  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f101xg.h

     文件     542861  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f102x6.h

     文件     552467  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f102xb.h

     文件     874522  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103x6.h

     文件     884899  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xb.h

     文件     971936  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xe.h

     文件     986030  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xg.h

     文件    1261567  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f105xc.h

     文件    1342402  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f107xc.h

     文件       8788  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h

     文件       3337  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h

     文件      15127  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f100xb.s

     文件      16715  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f100xe.s

     文件      12564  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f101x6.s

     文件      12937  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f101xb.s

     文件      15049  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f101xe.s

     文件      15808  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f101xg.s

     文件      12886  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f102x6.s

     文件      13271  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f102xb.s

     文件      13449  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f103x6.s

     文件      13834  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f103xb.s

     文件      16391  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f103xe.s

     文件      16845  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f103xg.s

     文件      16653  2019-06-18 09:25  SIM800C_TCP_Basic\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f105xc.s

............此处省略608个文件信息

评论

共有 条评论