資源簡介
F103C8T6+SIM800C 模組連接阿里云物聯(lián)網(wǎng)平臺套件,實(shí)現(xiàn)的功能:1、STM32上PC13控制LED翻轉(zhuǎn)作為運(yùn)行指示燈2、串口2(PA2)用來打印運(yùn)行數(shù)據(jù)(包括MQTT連接網(wǎng)發(fā)布消息訂閱主題)3、阿里物聯(lián)網(wǎng)平臺在線調(diào)試下發(fā)一個led開關(guān)命令通過串口2打印信息驗(yàn)證4、平臺能收到溫度值并顯示(僅32上電的時候publish溫度值,官網(wǎng)是2S發(fā)布一次)5、也可以用AIR208S模組全指令共用都是sim800的AT指令6、調(diào)試助手:PC端可以用mqtt.fx模擬設(shè)備,手機(jī)端可以用微信搜索小程序“MQTT模擬器”進(jìn)行模擬測試

代碼片段和文件信息
/**
?*?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?????????if(g_mem_debug_info[i].addr?==?addr){
????????????printf(“error?>>??%d??addr?alloc?error?0x%08x\n“iaddr);
????????????return;
????????}
????}
????for(i?=?0;?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?????????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個文件信息
評論
共有 條評論