温湿度上传

This commit is contained in:
james 2024-07-29 11:17:10 +08:00
parent b5093f2a50
commit de3a8210c7
11 changed files with 1182 additions and 91 deletions

243
.config
View File

@ -102,7 +102,7 @@ CONFIG_RT_USING_COMPONENTS_INIT=y
CONFIG_RT_USING_USER_MAIN=y
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
CONFIG_RT_MAIN_THREAD_PRIORITY=10
# CONFIG_RT_USING_LEGACY is not set
CONFIG_RT_USING_LEGACY=y
CONFIG_RT_USING_MSH=y
CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_USING_MSH=y
@ -123,10 +123,57 @@ CONFIG_FINSH_USING_OPTION_COMPLETION=y
#
# DFS: device virtual file system
#
# CONFIG_RT_USING_DFS is not set
CONFIG_RT_USING_DFS=y
CONFIG_DFS_USING_POSIX=y
CONFIG_DFS_USING_WORKDIR=y
# CONFIG_RT_USING_DFS_MNTTABLE is not set
CONFIG_DFS_FD_MAX=16
CONFIG_RT_USING_DFS_V1=y
# CONFIG_RT_USING_DFS_V2 is not set
CONFIG_DFS_FILESYSTEMS_MAX=4
CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
CONFIG_RT_USING_DFS_ELMFAT=y
#
# elm-chan's FatFs, Generic FAT Filesystem Module
#
CONFIG_RT_DFS_ELM_CODE_PAGE=437
CONFIG_RT_DFS_ELM_WORD_ACCESS=y
# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
CONFIG_RT_DFS_ELM_USE_LFN_3=y
CONFIG_RT_DFS_ELM_USE_LFN=3
CONFIG_RT_DFS_ELM_LFN_UNICODE_0=y
# CONFIG_RT_DFS_ELM_LFN_UNICODE_1 is not set
# CONFIG_RT_DFS_ELM_LFN_UNICODE_2 is not set
# CONFIG_RT_DFS_ELM_LFN_UNICODE_3 is not set
CONFIG_RT_DFS_ELM_LFN_UNICODE=0
CONFIG_RT_DFS_ELM_MAX_LFN=255
CONFIG_RT_DFS_ELM_DRIVES=2
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=4096
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
CONFIG_RT_DFS_ELM_REENTRANT=y
CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000
# CONFIG_RT_DFS_ELM_USE_EXFAT is not set
# end of elm-chan's FatFs, Generic FAT Filesystem Module
CONFIG_RT_USING_DFS_DEVFS=y
CONFIG_RT_USING_DFS_ROMFS=y
# CONFIG_RT_USING_DFS_ROMFS_USER_ROOT is not set
# CONFIG_RT_USING_DFS_CROMFS is not set
# CONFIG_RT_USING_DFS_RAMFS is not set
# CONFIG_RT_USING_DFS_TMPFS is not set
# CONFIG_RT_USING_DFS_MQUEUE is not set
# CONFIG_RT_USING_DFS_NFS is not set
# end of DFS: device virtual file system
# CONFIG_RT_USING_FAL is not set
CONFIG_RT_USING_FAL=y
CONFIG_FAL_DEBUG_CONFIG=y
CONFIG_FAL_DEBUG=1
CONFIG_FAL_PART_HAS_TABLE_CFG=y
CONFIG_FAL_USING_SFUD_PORT=y
CONFIG_FAL_USING_NOR_FLASH_DEV_NAME="norflash0"
#
# Device Drivers
@ -178,7 +225,9 @@ CONFIG_RT_SFUD_SPI_MAX_HZ=50000000
# CONFIG_RT_USING_SPI_WIFI is not set
# CONFIG_RT_USING_WDT is not set
# CONFIG_RT_USING_AUDIO is not set
# CONFIG_RT_USING_SENSOR is not set
CONFIG_RT_USING_SENSOR=y
# CONFIG_RT_USING_SENSOR_V2 is not set
CONFIG_RT_USING_SENSOR_CMD=y
# CONFIG_RT_USING_TOUCH is not set
# CONFIG_RT_USING_LCD is not set
# CONFIG_RT_USING_HWCRYPTO is not set
@ -239,7 +288,17 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# POSIX (Portable Operating System Interface) layer
#
# CONFIG_RT_USING_POSIX_FS is not set
CONFIG_RT_USING_POSIX_FS=y
# CONFIG_RT_USING_POSIX_DEVIO is not set
# CONFIG_RT_USING_POSIX_STDIO is not set
CONFIG_RT_USING_POSIX_POLL=y
CONFIG_RT_USING_POSIX_SELECT=y
# CONFIG_RT_USING_POSIX_EVENTFD is not set
# CONFIG_RT_USING_POSIX_TIMERFD is not set
CONFIG_RT_USING_POSIX_SOCKET=y
# CONFIG_RT_USING_POSIX_TERMIOS is not set
# CONFIG_RT_USING_POSIX_AIO is not set
# CONFIG_RT_USING_POSIX_MMAN is not set
# CONFIG_RT_USING_POSIX_DELAY is not set
# CONFIG_RT_USING_POSIX_CLOCK is not set
# CONFIG_RT_USING_POSIX_TIMER is not set
@ -276,7 +335,7 @@ CONFIG_SAL_USING_LWIP=y
# CONFIG_SAL_USING_TLS is not set
# end of Docking with protocol stacks
CONFIG_SAL_SOCKETS_NUM=16
CONFIG_SAL_USING_POSIX=y
CONFIG_RT_USING_NETDEV=y
CONFIG_NETDEV_USING_IFCONFIG=y
CONFIG_NETDEV_USING_PING=y
@ -456,13 +515,16 @@ CONFIG_PKG_USING_RW007_V210=y
CONFIG_PKG_RW007_VER="v2.1.0"
# CONFIG_RW007_NOT_USE_EXAMPLE_DRIVERS is not set
CONFIG_RW007_USING_STM32_DRIVERS=y
# CONFIG_RW007_USING_BLE is not set
# CONFIG_RW007_USING_POWERSWITCH_EXAMPLE is not set
# CONFIG_RW007_USING_SPI_TEST is not set
CONFIG_RW007_SPI_MAX_HZ=30000000
CONFIG_RW007_SPI_BUS_NAME="spi2"
CONFIG_RW007_CS_PIN=102
CONFIG_RW007_BOOT0_PIN=175
CONFIG_RW007_BOOT1_PIN=102
CONFIG_RW007_INT_BUSY_PIN=62
CONFIG_RW007_RST_PIN=187
CONFIG_RW007_CS_PIN=90
CONFIG_RW007_BOOT0_PIN=29
CONFIG_RW007_BOOT1_PIN=90
CONFIG_RW007_INT_BUSY_PIN=107
CONFIG_RW007_RST_PIN=111
#
# CYW43012 WiFi
@ -498,7 +560,85 @@ CONFIG_RW007_RST_PIN=187
#
# CONFIG_PKG_USING_ONENET is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
# CONFIG_PKG_USING_ALI_IOTKIT is not set
CONFIG_PKG_USING_ALI_IOTKIT=y
CONFIG_PKG_ALI_IOTKIT_PATH="/packages/iot/iot_cloud/ali-iotkit"
CONFIG_PKG_USING_ALI_IOTKIT_PRODUCT_KEY="k1lyriw1yGj"
CONFIG_PKG_USING_ALI_IOTKIT_PRODUCT_SECRET="2QQeHVbu4dSN0SG7"
CONFIG_PKG_USING_ALI_IOTKIT_DEVICE_NAME="RT-Spark"
CONFIG_PKG_USING_ALI_IOTKIT_DEVICE_SECRET="1df4aa4834df32314612168e3135e206"
CONFIG_PKG_ALI_IOTKIT_SELECT_ITEM=y
CONFIG_PLATFORM_HAS_STDINT=y
CONFIG_PLATFORM_HAS_DYNMEM=y
CONFIG_PLATFORM_HAS_OS=y
CONFIG_INFRA_STRING=y
CONFIG_INFRA_NET=y
CONFIG_INFRA_LIST=y
CONFIG_INFRA_LOG_NETWORK_PAYLOAD=y
CONFIG_INFRA_LOG=y
#
# Log Configurations
#
CONFIG_INFRA_LOG_MUTE_FLW=y
CONFIG_INFRA_LOG_MUTE_DBG=y
CONFIG_INFRA_LOG_MUTE_INF=y
CONFIG_INFRA_LOG_MUTE_WRN=y
# CONFIG_INFRA_LOG_MUTE_ERR is not set
CONFIG_INFRA_LOG_MUTE_CRT=y
# end of Log Configurations
CONFIG_INFRA_TIMER=y
CONFIG_INFRA_CJSON=y
CONFIG_INFRA_SHA256=y
CONFIG_INFRA_REPORT=y
CONFIG_INFRA_COMPAT=y
CONFIG_INFRA_CLASSIC=y
CONFIG_DEV_SIGN=y
CONFIG_MQTT_COMM_ENABLED=y
#
# MQTT Configurations
#
CONFIG_MQTT_DEFAULT_IMPL=y
CONFIG_MQTT_DIRECT=y
# CONFIG_ASYNC_PROTOCOL_STACK is not set
# end of MQTT Configurations
# CONFIG_DYNAMIC_REGISTER is not set
CONFIG_DEVICE_MODEL_CLASSIC=y
CONFIG_LOG_REPORT_TO_CLOUD=y
CONFIG_DEVICE_MODEL_ENABLED=y
#
# Device Model Configurations
#
# CONFIG_DEVICE_MODEL_GATEWAY is not set
# CONFIG_DEPRECATED_LINKKIT is not set
# CONFIG_DEVICE_MODEL_RAWDATA_SOLO is not set
# CONFIG_ALCS_ENABLED is not set
# CONFIG_SUB_PERSISTENCE_ENABLED is not set
# CONFIG_DEVICE_MODEL_SHADOW is not set
# end of Device Model Configurations
# CONFIG_SUPPORT_TLS is not set
# CONFIG_ATM_ENABLED is not set
# CONFIG_OTA_ENABLED is not set
# CONFIG_COAP_COMM_ENABLED is not set
# CONFIG_DEV_RESET is not set
# CONFIG_HTTP_COMM_ENABLED is not set
# CONFIG_HTTP2_COMM_ENABLED is not set
# CONFIG_WIFI_PROVISION_ENABLED is not set
# CONFIG_DEV_BIND_ENABLED is not set
CONFIG_PKG_USING_ALI_IOTKIT_SAMPLES=y
CONFIG_PKG_USING_ALI_IOTKIT_MQTT_SAMPLE=y
# CONFIG_PKG_USING_ALI_IOTKIT_DEV_MODEL_SAMPLE is not set
# CONFIG_PKG_USING_ALI_IOTKIT_V20003 is not set
# CONFIG_PKG_USING_ALI_IOTKIT_V20004 is not set
# CONFIG_PKG_USING_ALI_IOTKIT_V30001 is not set
CONFIG_PKG_USING_ALI_IOTKIT_V30002=y
# CONFIG_PKG_USING_ALI_IOTKIT_LATEST_VERSION is not set
CONFIG_PKG_ALI_IOTKIT_VER="v3.0.2"
CONFIG_PKG_ALI_IOTKIT_VER_NUM=0x30002
# CONFIG_PKG_USING_AZURE is not set
# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set
# CONFIG_PKG_USING_JIOT-C-SDK is not set
@ -570,7 +710,16 @@ CONFIG_RW007_RST_PIN=187
#
# JSON: JavaScript Object Notation, a lightweight data-interchange format
#
# CONFIG_PKG_USING_CJSON is not set
CONFIG_PKG_USING_CJSON=y
CONFIG_PKG_CJSON_PATH="/packages/language/JSON/cJSON"
CONFIG_PKG_USING_CJSON_V1717=y
# CONFIG_PKG_USING_CJSON_V1716 is not set
# CONFIG_PKG_USING_CJSON_V1715 is not set
# CONFIG_PKG_USING_CJSON_V1714 is not set
# CONFIG_PKG_USING_CJSON_V159 is not set
# CONFIG_PKG_USING_CJSON_V102 is not set
# CONFIG_PKG_USING_CJSON_LATEST_VERSION is not set
CONFIG_PKG_CJSON_VER="v1.7.17"
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
# CONFIG_PKG_USING_RAPIDJSON is not set
@ -695,7 +844,26 @@ CONFIG_RW007_RST_PIN=187
#
# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
CONFIG_PKG_USING_RT_VSNPRINTF_FULL=y
CONFIG_PKG_RT_VSNPRINTF_FULL_PATH="/packages/system/enhanced-kservice/rt_vsnprintf_full"
CONFIG_PKG_VSNPRINTF_SUPPORT_DECIMAL_SPECIFIERS=y
CONFIG_PKG_VSNPRINTF_SUPPORT_EXPONENTIAL_SPECIFIERS=y
CONFIG_PKG_VSNPRINTF_SUPPORT_WRITEBACK_SPECIFIER=y
CONFIG_PKG_VSNPRINTF_SUPPORT_LONG_LONG=y
CONFIG_PKG_VSNPRINTF_CHECK_FOR_NUL_IN_FORMAT_SPECIFIER=y
# CONFIG_PKG_VSNPRINTF_SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS is not set
CONFIG_PKG_VSNPRINTF_INTEGER_BUFFER_SIZE=32
CONFIG_PKG_VSNPRINTF_DECIMAL_BUFFER_SIZE=32
CONFIG_PKG_VSNPRINTF_DEFAULT_FLOAT_PRECISION=6
CONFIG_PKG_VSNPRINTF_MAX_INTEGRAL_DIGITS_FOR_DECIMAL=9
CONFIG_PKG_VSNPRINTF_LOG10_TAYLOR_TERMS=4
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_SPRINTF is not set
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_SNPRINTF is not set
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_PRINTF is not set
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_VSPRINTF is not set
# CONFIG_RT_VSNPRINTF_FULL_REPLACING_VSNPRINTF is not set
CONFIG_PKG_USING_RT_VSNPRINTF_FULL_LATEST_VERSION=y
CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
# end of enhanced kernel services
# CONFIG_PKG_USING_AUNITY is not set
@ -848,7 +1016,15 @@ CONFIG_RW007_RST_PIN=187
# CONFIG_PKG_USING_HSHCAL001 is not set
# CONFIG_PKG_USING_BH1750 is not set
# CONFIG_PKG_USING_MPU6XXX is not set
# CONFIG_PKG_USING_AHT10 is not set
CONFIG_PKG_USING_AHT10=y
CONFIG_PKG_AHT10_PATH="/packages/peripherals/sensors/aht10"
# CONFIG_PKG_AHT10_USING_SOFT_FILTER is not set
# CONFIG_PKG_AHT10_USING_SENSOR_V2 is not set
# CONFIG_PKG_USING_AHT10_SAMPLE is not set
CONFIG_PKG_USING_AHT10_LATEST_VERSION=y
# CONFIG_PKG_USING_AHT10_V300 is not set
# CONFIG_PKG_USING_AHT10_V210 is not set
CONFIG_PKG_AHT10_VER="latest"
# CONFIG_PKG_USING_AP3216C is not set
# CONFIG_PKG_USING_TSL4531 is not set
# CONFIG_PKG_USING_DS18B20 is not set
@ -1363,21 +1539,25 @@ CONFIG_SOC_SERIES_STM32F4=y
#
# CONFIG_BSP_USING_ARDUINO is not set
CONFIG_BSP_USING_USB_TO_USART=y
# CONFIG_BSP_USING_COM2 is not set
# CONFIG_BSP_USING_COM3 is not set
# CONFIG_BSP_USING_RS485 is not set
# CONFIG_BSP_USING_SRAM is not set
# CONFIG_BSP_USING_ONBOARD_LCD is not set
CONFIG_BSP_USING_SRAM=y
CONFIG_BSP_USING_ONBOARD_LCD=y
CONFIG_BSP_USING_ONBOARD_LCD_PWM_BL=y
# CONFIG_BSP_USING_ONBOARD_LED_MATRIX is not set
# CONFIG_BSP_USING_LVGL is not set
CONFIG_BSP_USING_SPI_FLASH=y
# CONFIG_BSP_USING_EEPROM is not set
# CONFIG_BSP_USING_ENC28j60 is not set
# CONFIG_BSP_USING_FS is not set
# CONFIG_BSP_USING_FAL is not set
CONFIG_BSP_USING_FS=y
# CONFIG_BSP_USING_SDCARD_FATFS is not set
CONFIG_BSP_USING_FLASH_FATFS=y
CONFIG_BSP_USING_FLASH_FS_AUTO_MOUNT=y
CONFIG_BSP_USING_FAL=y
# CONFIG_BSP_USING_BOOTLOADER is not set
# CONFIG_BSP_USING_EASYFLASH is not set
CONFIG_BSP_USING_RW007_WLAN=y
# CONFIG_BSP_USING_AHT21 is not set
CONFIG_BSP_USING_AHT21=y
# CONFIG_BSP_USING_AP3216C is not set
# CONFIG_BSP_USING_ICM20608 is not set
# CONFIG_BSP_USING_USB_MOUSE is not set
@ -1399,8 +1579,14 @@ CONFIG_BSP_USING_UART1=y
# CONFIG_BSP_USING_UART5 is not set
# CONFIG_BSP_USING_UART6 is not set
# CONFIG_BSP_USING_TIM is not set
# CONFIG_BSP_USING_PWM is not set
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
CONFIG_BSP_USING_PWM=y
# CONFIG_BSP_USING_PWM1 is not set
# CONFIG_BSP_USING_PWM2 is not set
# CONFIG_BSP_USING_PWM3 is not set
# CONFIG_BSP_USING_PWM4 is not set
CONFIG_BSP_USING_PWM14=y
CONFIG_BSP_USING_PWM14_CH1=y
CONFIG_BSP_USING_ON_CHIP_FLASH=y
# CONFIG_BSP_USING_SOFT_SPI is not set
CONFIG_BSP_USING_SPI=y
# CONFIG_BSP_USING_SPI1 is not set
@ -1408,7 +1594,14 @@ CONFIG_BSP_USING_SPI2=y
# CONFIG_BSP_SPI2_TX_USING_DMA is not set
# CONFIG_BSP_SPI2_RX_USING_DMA is not set
# CONFIG_BSP_USING_ADC is not set
# CONFIG_BSP_USING_I2C is not set
CONFIG_BSP_USING_I2C=y
# CONFIG_BSP_USING_I2C1 is not set
# CONFIG_BSP_USING_I2C2 is not set
CONFIG_BSP_USING_I2C3=y
CONFIG_BSP_I2C3_SCL_PIN=64
CONFIG_BSP_I2C3_SDA_PIN=65
# CONFIG_BSP_USING_I2C4 is not set
# CONFIG_BSP_USING_I2C5 is not set
# CONFIG_BSP_USING_ONBOARD_PM is not set
# CONFIG_BSP_USING_DAC is not set
# CONFIG_BSP_USING_ONCHIP_RTC is not set
@ -1417,6 +1610,8 @@ CONFIG_BSP_USING_SPI2=y
# CONFIG_BSP_USING_USBD is not set
# CONFIG_BSP_USING_USBH is not set
# CONFIG_BSP_USING_PULSE_ENCODER is not set
CONFIG_BSP_USING_EXT_FMC_IO=y
CONFIG_BSP_USING_FMC=y
# CONFIG_BSP_USING_RNG is not set
# CONFIG_BSP_USING_UDID is not set
# end of On-chip Peripheral Drivers

66
Day4/day4.c Normal file
View File

@ -0,0 +1,66 @@
#include <rtthread.h>
#include <rtdevice.h>
#if defined(BSP_USING_TEST)
#define DRV_DEBUG
#define LOG_TAG "drv.test"
#include <drv_log.h>
static rt_err_t dev_test_init(rt_device_t dev)
{
LOG_I("test dev init");
return RT_EOK;
}
static rt_err_t dev_test_open(rt_device_t dev,rt_uint16_t oflag)
{
LOG_I("test dev open flag = %d",oflag);
return RT_EOK;
}
static rt_err_t dev_test_close(rt_device_t dev)
{
LOG_I("test dev close");
return RT_EOK;
}
static rt_ssize_t dev_test_read(rt_device_t dev,rt_off_t pos,void *buffer,rt_size_t size)
{
LOG_I("test dev read pos = %d,size = %d",pos,size);
return RT_EOK;
}
static rt_ssize_t dev_test_write(rt_device_t dev,rt_off_t pos,const void *buffer,rt_size_t size)
{
LOG_I("test dev write pos = %d,size = %d",pos,size);
return RT_EOK;
}
static rt_err_t dev_test_control(rt_device_t dev,int cmd,void *args)
{
LOG_I("test dev control cmd %d",cmd);
return RT_EOK;
}
int rt_drv_test_init(void)
{
rt_device_t test_dev = rt_device_create(RT_Device_Class_Char,0);
if(!test_dev)
{
LOG_E("test dev create failed");
return -RT_ERROR;
}
test_dev->init = dev_test_init;
test_dev->open = dev_test_open;
test_dev->close = dev_test_close;
test_dev->read = dev_test_read;
test_dev->write = dev_test_write;
test_dev->control = dev_test_control;
if(rt_device_register(test_dev,"test_dev",RT_DEVICE_FLAG_RDWR) != RT_EOK)
{
LOG_E("test dev register failed");
return -RT_ERROR;
}
return RT_EOK;
}
INIT_BOARD_EXPORT(rt_drv_test_init);
#endif

66
Day5/AHT10.c Normal file
View File

@ -0,0 +1,66 @@
#include <board.h>
#include <rtthread.h>
#include <drv_gpio.h>
#include "aht10.h"
// AHT挂载的总线名字
#define AHT10_I2C_BUS "i2c3"
// 创建AHT线程时待用
#define THREAD_PRIORITY 25
#define THREAD_STACK_SIZE 2048
#define THREAD_TIMESLICE 5
// AHT线程指针
rt_thread_t AHT10 = RT_NULL;
// AHT测试样例
void AHT10_Test(void *parameter)
{
// AHT设备指针
aht10_device_t Dev = RT_NULL;
// Humi:湿度值,Temp:温度值
float Humi, Temp;
// 初始化设备
Dev = aht10_init(AHT10_I2C_BUS);
if (Dev == RT_NULL)
{
rt_kprintf("AHT10_init Fail");
return;
}
while (1)
{
// 读取温湿度值
Humi = aht10_read_humidity(Dev);
Temp = aht10_read_temperature(Dev);
// 没有下载rt_vsprintf_full软件包的时候
rt_kprintf("Humi: %d.%d\n", (int)Humi, (int)(Humi * 10) % 10);
rt_kprintf("Temp: %d.%d\n", (int)Temp, (int)(Temp * 10) % 10);
// 配合rt_vsnprintf_full软件包使用
// rt_kprintf("Humi: %f, Temp: %f\n", Humi, Temp);
rt_thread_mdelay(1000);
}
}
void AHT10_Creat_Thread(void)
{
// 创建线程
AHT10 = rt_thread_create("AHT10", AHT10_Test, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
// 创建成功就启动
if (AHT10 != RT_NULL)
{
rt_thread_startup(AHT10);
}
else
{
rt_kprintf("AHT10_Thread Create Fail");
}
}
// 导出Shell命令
MSH_CMD_EXPORT(AHT10_Creat_Thread, This Function will creat a AHT10 thread.);

4
Day5/README.md Normal file
View File

@ -0,0 +1,4 @@
## 软件包
wifi join Dong abcd07691234

19
Day5/SConscript Normal file
View File

@ -0,0 +1,19 @@
from building import *
import os
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
src += ['arduino_main.cpp']
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')

604
Day5/mqtt.c Normal file
View File

@ -0,0 +1,604 @@
// #include "rtthread.h"
// #include "dev_sign_api.h"
// #include "mqtt_api.h"
// char DEMO_PRODUCT_KEY[IOTX_PRODUCT_KEY_LEN + 1] = {0};
// char DEMO_DEVICE_NAME[IOTX_DEVICE_NAME_LEN + 1] = {0};
// char DEMO_DEVICE_SECRET[IOTX_DEVICE_SECRET_LEN + 1] = {0};
// void *HAL_Malloc(uint32_t size);
// void HAL_Free(void *ptr);
// void HAL_Printf(const char *fmt, ...);
// int HAL_GetProductKey(char product_key[IOTX_PRODUCT_KEY_LEN + 1]);
// int HAL_GetDeviceName(char device_name[IOTX_DEVICE_NAME_LEN + 1]);
// int HAL_GetDeviceSecret(char device_secret[IOTX_DEVICE_SECRET_LEN]);
// uint64_t HAL_UptimeMs(void);
// int HAL_Snprintf(char *str, const int len, const char *fmt, ...);
// #define EXAMPLE_TRACE(fmt, ...) \
// do \
// { \
// HAL_Printf("%s|%03d :: ", __func__, __LINE__); \
// HAL_Printf(fmt, ##__VA_ARGS__); \
// HAL_Printf("%s", "\r\n"); \
// } while (0)
// static void example_message_arrive(void *pcontext, void *pclient, iotx_mqtt_event_msg_pt msg)
// {
// iotx_mqtt_topic_info_t *topic_info = (iotx_mqtt_topic_info_pt)msg->msg;
// switch (msg->event_type)
// {
// case IOTX_MQTT_EVENT_PUBLISH_RECEIVED:
// /* print topic name and topic message */
// EXAMPLE_TRACE("Message Arrived:");
// EXAMPLE_TRACE("Topic : %.*s", topic_info->topic_len, topic_info->ptopic);
// EXAMPLE_TRACE("Payload: %.*s", topic_info->payload_len, topic_info->payload);
// EXAMPLE_TRACE("\n");
// break;
// default:
// break;
// }
// }
// static int example_subscribe(void *handle)
// {
// int res = 0;
// const char *fmt = "/%s/%s/user/get";
// char *topic = NULL;
// int topic_len = 0;
// topic_len = strlen(fmt) + strlen(DEMO_PRODUCT_KEY) + strlen(DEMO_DEVICE_NAME) + 1;
// topic = HAL_Malloc(topic_len);
// if (topic == NULL)
// {
// EXAMPLE_TRACE("memory not enough");
// return -1;
// }
// memset(topic, 0, topic_len);
// HAL_Snprintf(topic, topic_len, fmt, DEMO_PRODUCT_KEY, DEMO_DEVICE_NAME);
// res = IOT_MQTT_Subscribe(handle, topic, IOTX_MQTT_QOS0, example_message_arrive, NULL);
// if (res < 0)
// {
// EXAMPLE_TRACE("subscribe failed");
// HAL_Free(topic);
// return -1;
// }
// HAL_Free(topic);
// return 0;
// }
// static int example_publish(void *handle)
// {
// int res = 0;
// const char *fmt = "/sys/%s/%s/thing/event/property/post";
// char *topic = NULL;
// int topic_len = 0;
// char *payload = "{\"message\":\"hello!\"}";
// topic_len = strlen(fmt) + strlen(DEMO_PRODUCT_KEY) + strlen(DEMO_DEVICE_NAME) + 1;
// topic = HAL_Malloc(topic_len);
// if (topic == NULL)
// {
// EXAMPLE_TRACE("memory not enough");
// return -1;
// }
// memset(topic, 0, topic_len);
// HAL_Snprintf(topic, topic_len, fmt, DEMO_PRODUCT_KEY, DEMO_DEVICE_NAME);
// res = IOT_MQTT_Publish_Simple(0, topic, IOTX_MQTT_QOS0, payload, strlen(payload));
// if (res < 0)
// {
// EXAMPLE_TRACE("publish failed, res = %d", res);
// HAL_Free(topic);
// return -1;
// }
// HAL_Free(topic);
// return 0;
// }
// static void example_event_handle(void *pcontext, void *pclient, iotx_mqtt_event_msg_pt msg)
// {
// EXAMPLE_TRACE("msg->event_type : %d", msg->event_type);
// }
// /*
// * NOTE: About demo topic of /${productKey}/${deviceName}/user/get
// *
// * The demo device has been configured in IoT console (https://iot.console.aliyun.com)
// * so that its /${productKey}/${deviceName}/user/get can both be subscribed and published
// *
// * We design this to completely demonstrate publish & subscribe process, in this way
// * MQTT client can receive original packet sent by itself
// *
// * For new devices created by yourself, pub/sub privilege also requires being granted
// * to its /${productKey}/${deviceName}/user/get for successfully running whole example
// */
// void mqtt_example_main(void *parameter)
// {
// void *pclient = NULL;
// int res = 0;
// int loop_cnt = 0;
// iotx_mqtt_param_t mqtt_params;
// HAL_GetProductKey(DEMO_PRODUCT_KEY);
// HAL_GetDeviceName(DEMO_DEVICE_NAME);
// HAL_GetDeviceSecret(DEMO_DEVICE_SECRET);
// EXAMPLE_TRACE("mqtt example");
// /* Initialize MQTT parameter */
// /*
// * Note:
// *
// * If you did NOT set value for members of mqtt_params, SDK will use their default values
// * If you wish to customize some parameter, just un-comment value assigning expressions below
// *
// **/
// memset(&mqtt_params, 0x0, sizeof(mqtt_params));
// /**
// *
// * MQTT connect hostname string
// *
// * MQTT server's hostname can be customized here
// *
// * default value is ${productKey}.iot-as-mqtt.cn-shanghai.aliyuncs.com
// */
// /* mqtt_params.host = "something.iot-as-mqtt.cn-shanghai.aliyuncs.com"; */
// /**
// *
// * MQTT connect port number
// *
// * TCP/TLS port which can be 443 or 1883 or 80 or etc, you can customize it here
// *
// * default value is 1883 in TCP case, and 443 in TLS case
// */
// /* mqtt_params.port = 1883; */
// /**
// *
// * MQTT request timeout interval
// *
// * MQTT message request timeout for waiting ACK in MQTT Protocol
// *
// * default value is 2000ms.
// */
// /* mqtt_params.request_timeout_ms = 2000; */
// /**
// *
// * MQTT clean session flag
// *
// * If CleanSession is set to 0, the Server MUST resume communications with the Client based on state from
// * the current Session (as identified by the Client identifier).
// *
// * If CleanSession is set to 1, the Client and Server MUST discard any previous Session and Start a new one.
// *
// * default value is 0.
// */
// /* mqtt_params.clean_session = 0; */
// /**
// *
// * MQTT keepAlive interval
// *
// * KeepAlive is the maximum time interval that is permitted to elapse between the point at which
// * the Client finishes transmitting one Control Packet and the point it starts sending the next.
// *
// * default value is 60000.
// */
// /* mqtt_params.keepalive_interval_ms = 60000; */
// /**
// *
// * MQTT write buffer size
// *
// * Write buffer is allocated to place upstream MQTT messages, MQTT client will be limitted
// * to send packet no longer than this to Cloud
// *
// * default value is 1024.
// *
// */
// /* mqtt_params.write_buf_size = 1024; */
// /**
// *
// * MQTT read buffer size
// *
// * Write buffer is allocated to place downstream MQTT messages, MQTT client will be limitted
// * to recv packet no longer than this from Cloud
// *
// * default value is 1024.
// *
// */
// /* mqtt_params.read_buf_size = 1024; */
// /**
// *
// * MQTT event callback function
// *
// * Event callback function will be called by SDK when it want to notify user what is happening inside itself
// *
// * default value is NULL, which means PUB/SUB event won't be exposed.
// *
// */
// mqtt_params.handle_event.h_fp = example_event_handle;
// pclient = IOT_MQTT_Construct(&mqtt_params);
// if (NULL == pclient)
// {
// EXAMPLE_TRACE("MQTT construct failed");
// return;
// }
// res = example_subscribe(pclient);
// if (res < 0)
// {
// IOT_MQTT_Destroy(&pclient);
// return;
// }
// while (1)
// {
// if (0 == loop_cnt % 20)
// {
// example_publish(pclient);
// }
// IOT_MQTT_Yield(pclient, 200);
// loop_cnt += 1;
// }
// }
// #define THREAD_PRIORITY 25
// #define THREAD_STACK_SIZE 4096
// #define THREAD_TIMESLICE 5
// rt_thread_t MQTT_Thread;
// void MQTT_Creat_Thread(void)
// {
// // 创建线程
// MQTT_Thread = rt_thread_create("MQTT_Thread", mqtt_example_main, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
// // 创建成功就启动
// if (MQTT_Thread != RT_NULL)
// {
// rt_thread_startup(MQTT_Thread);
// }
// else
// {
// rt_kprintf("MQTT_Thread_Thread Create Fail");
// }
// }
// // 导出Shell命令
// MSH_CMD_EXPORT(MQTT_Creat_Thread, This Function will creat a MQTT thread.);
/*
* Copyright (C) 2015-2018 Alibaba Group Holding Limited
*
* Again edit by rt-thread group
* Change Logs:
* Date Author Notes
* 2019-07-21 MurphyZhao first edit
*/
#include "rtthread.h"
#include "dev_sign_api.h"
#include "mqtt_api.h"
#include <board.h>
#include <drv_gpio.h>
#include <stdio.h>
#include <string.h>
#include "aht10.h"
char DEMO_PRODUCT_KEY[IOTX_PRODUCT_KEY_LEN + 1] = {0};
char DEMO_DEVICE_NAME[IOTX_DEVICE_NAME_LEN + 1] = {0};
char DEMO_DEVICE_SECRET[IOTX_DEVICE_SECRET_LEN + 1] = {0};
void *HAL_Malloc(uint32_t size);
void HAL_Free(void *ptr);
void HAL_Printf(const char *fmt, ...);
int HAL_GetProductKey(char product_key[IOTX_PRODUCT_KEY_LEN + 1]);
int HAL_GetDeviceName(char device_name[IOTX_DEVICE_NAME_LEN + 1]);
int HAL_GetDeviceSecret(char device_secret[IOTX_DEVICE_SECRET_LEN]);
uint64_t HAL_UptimeMs(void);
int HAL_Snprintf(char *str, const int len, const char *fmt, ...);
// AHT挂载的总线名字
#define AHT10_I2C_BUS "i2c3"
// AHT设备指针
aht10_device_t Dev = RT_NULL;
// Humi:湿度值,Temp:温度值
float Humi, Temp;
#define EXAMPLE_TRACE(fmt, ...) \
do { \
HAL_Printf("%s|%03d :: ", __func__, __LINE__); \
HAL_Printf(fmt, ##__VA_ARGS__); \
HAL_Printf("%s", "\r\n"); \
} while(0)
static void example_message_arrive(void *pcontext, void *pclient, iotx_mqtt_event_msg_pt msg)
{
iotx_mqtt_topic_info_t *topic_info = (iotx_mqtt_topic_info_pt) msg->msg;
switch (msg->event_type) {
case IOTX_MQTT_EVENT_PUBLISH_RECEIVED:
/* print topic name and topic message */
EXAMPLE_TRACE("Message Arrived:");
EXAMPLE_TRACE("Topic : %.*s", topic_info->topic_len, topic_info->ptopic);
EXAMPLE_TRACE("Payload: %.*s", topic_info->payload_len, topic_info->payload);
EXAMPLE_TRACE("\n");
break;
default:
break;
}
}
static int example_subscribe(void *handle)
{
int res = 0;
const char *fmt = "/%s/%s/user/get";
char *topic = NULL;
int topic_len = 0;
topic_len = strlen(fmt) + strlen(DEMO_PRODUCT_KEY) + strlen(DEMO_DEVICE_NAME) + 1;
topic = HAL_Malloc(topic_len);
if (topic == NULL) {
EXAMPLE_TRACE("memory not enough");
return -1;
}
memset(topic, 0, topic_len);
HAL_Snprintf(topic, topic_len, fmt, DEMO_PRODUCT_KEY, DEMO_DEVICE_NAME);
res = IOT_MQTT_Subscribe(handle, topic, IOTX_MQTT_QOS0, example_message_arrive, NULL);
if (res < 0) {
EXAMPLE_TRACE("subscribe failed");
HAL_Free(topic);
return -1;
}
HAL_Free(topic);
return 0;
}
char tmp[256];
void tmp_payload(void)
{
// 读取温湿度值
Humi = aht10_read_humidity(Dev);
Temp = aht10_read_temperature(Dev);
sprintf(tmp, "{\"params\":{\"temperature\":%.2f,\"humidity\":%.2f}}", Temp, Humi);
rt_kprintf("\n%f %f tmp:%s\n",Humi,Temp,tmp);
return;
}
static int example_publish(void *handle)
{
tmp_payload();
int res = 0;
const char *fmt = "/sys/%s/%s/thing/event/property/post";
// /k1lyriw1yGj/${deviceName}/user/get
char *topic = NULL;
int topic_len = 0;
char *payload = tmp;
// strcpy(payload,tmp_payload());
rt_kprintf("payload:%s\n",payload);
topic_len = strlen(fmt) + strlen(DEMO_PRODUCT_KEY) + strlen(DEMO_DEVICE_NAME) + 1;
topic = HAL_Malloc(topic_len);
if (topic == NULL) {
EXAMPLE_TRACE("memory not enough");
return -1;
}
memset(topic, 0, topic_len);
HAL_Snprintf(topic, topic_len, fmt, DEMO_PRODUCT_KEY, DEMO_DEVICE_NAME);
res = IOT_MQTT_Publish_Simple(0, topic, IOTX_MQTT_QOS0, payload, strlen(payload));
if (res < 0) {
EXAMPLE_TRACE("publish failed, res = %d", res);
HAL_Free(topic);
return -1;
}
HAL_Free(topic);
return 0;
}
static void example_event_handle(void *pcontext, void *pclient, iotx_mqtt_event_msg_pt msg)
{
EXAMPLE_TRACE("msg->event_type : %d", msg->event_type);
}
/*
* NOTE: About demo topic of /${productKey}/${deviceName}/user/get
*
* The demo device has been configured in IoT console (https://iot.console.aliyun.com)
* so that its /${productKey}/${deviceName}/user/get can both be subscribed and published
*
* We design this to completely demonstrate publish & subscribe process, in this way
* MQTT client can receive original packet sent by itself
*
* For new devices created by yourself, pub/sub privilege also requires being granted
* to its /${productKey}/${deviceName}/user/get for successfully running whole example
*/
static void mqtt_example_main(void *parameter)
{
void *pclient = NULL;
int res = 0;
int loop_cnt = 0;
iotx_mqtt_param_t mqtt_params;
HAL_GetProductKey(DEMO_PRODUCT_KEY);
HAL_GetDeviceName(DEMO_DEVICE_NAME);
HAL_GetDeviceSecret(DEMO_DEVICE_SECRET);
EXAMPLE_TRACE("mqtt example");
/* Initialize MQTT parameter */
/*
* Note:
*
* If you did NOT set value for members of mqtt_params, SDK will use their default values
* If you wish to customize some parameter, just un-comment value assigning expressions below
*
**/
memset(&mqtt_params, 0x0, sizeof(mqtt_params));
/**
*
* MQTT connect hostname string
*
* MQTT server's hostname can be customized here
*
* default value is ${productKey}.iot-as-mqtt.cn-shanghai.aliyuncs.com
*/
/* mqtt_params.host = "something.iot-as-mqtt.cn-shanghai.aliyuncs.com"; */
/**
*
* MQTT connect port number
*
* TCP/TLS port which can be 443 or 1883 or 80 or etc, you can customize it here
*
* default value is 1883 in TCP case, and 443 in TLS case
*/
/* mqtt_params.port = 1883; */
/**
*
* MQTT request timeout interval
*
* MQTT message request timeout for waiting ACK in MQTT Protocol
*
* default value is 2000ms.
*/
/* mqtt_params.request_timeout_ms = 2000; */
/**
*
* MQTT clean session flag
*
* If CleanSession is set to 0, the Server MUST resume communications with the Client based on state from
* the current Session (as identified by the Client identifier).
*
* If CleanSession is set to 1, the Client and Server MUST discard any previous Session and Start a new one.
*
* default value is 0.
*/
/* mqtt_params.clean_session = 0; */
/**
*
* MQTT keepAlive interval
*
* KeepAlive is the maximum time interval that is permitted to elapse between the point at which
* the Client finishes transmitting one Control Packet and the point it starts sending the next.
*
* default value is 60000.
*/
/* mqtt_params.keepalive_interval_ms = 60000; */
/**
*
* MQTT write buffer size
*
* Write buffer is allocated to place upstream MQTT messages, MQTT client will be limitted
* to send packet no longer than this to Cloud
*
* default value is 1024.
*
*/
/* mqtt_params.write_buf_size = 1024; */
/**
*
* MQTT read buffer size
*
* Write buffer is allocated to place downstream MQTT messages, MQTT client will be limitted
* to recv packet no longer than this from Cloud
*
* default value is 1024.
*
*/
/* mqtt_params.read_buf_size = 1024; */
/**
*
* MQTT event callback function
*
* Event callback function will be called by SDK when it want to notify user what is happening inside itself
*
* default value is NULL, which means PUB/SUB event won't be exposed.
*
*/
mqtt_params.handle_event.h_fp = example_event_handle;
pclient = IOT_MQTT_Construct(&mqtt_params);
if (NULL == pclient) {
EXAMPLE_TRACE("MQTT construct failed");
return ;
}
res = example_subscribe(pclient);
if (res < 0) {
IOT_MQTT_Destroy(&pclient);
return ;
}
while (1) {
if (0 == loop_cnt % 20) {
example_publish(pclient);
}
IOT_MQTT_Yield(pclient, 200);
loop_cnt += 1;
}
return ;
}
#define THREAD_PRIORITY 25
#define THREAD_STACK_SIZE 4096
#define THREAD_TIMESLICE 5
rt_thread_t MQTT_Thread = RT_NULL;
void MQTT_Creat_Thread(void)
{
// 初始化设备
Dev = aht10_init(AHT10_I2C_BUS);
if (Dev == RT_NULL)
{
rt_kprintf("AHT10_init Fail");
return;
}
MQTT_Thread = rt_thread_create("MTQQ_Thread", mqtt_example_main, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
if (MQTT_Thread != RT_NULL)
{
rt_thread_startup(MQTT_Thread);
}
else
{
rt_kprintf("MQTT Thread Create Failed!\n");
}
}
MSH_CMD_EXPORT(MQTT_Creat_Thread, create a MQTT_Thread);

View File

View File

@ -1,7 +1,24 @@
#include <rtthread.h>
#include<board.h>
#ifndef RT_USING_NANO
#include <rtdevice.h>
#endif // !RT_USING_NANO
#define GPIO_LED_B GET_PIN(F,11)
#define GPIO_LED_B GET_PIN(F,11)
int main(void)
{
return 0;
return 0;
}
// #define WIFI_CS GET_PIN(F,10)
// void WIFICS_PULL_DOWN(void)
// {
// rt_pin_mode(WIFI_CS, PIN_MODE_OUTPUT);
// rt_pin_write(WIFI_CS, PIN_LOW);
// }
// INIT_BOARD_EXPORT(WIFI_CS_PULL_DOWN);

View File

@ -55,7 +55,7 @@ static int onboard_fal_mount(void)
extern struct rt_device *fal_blk_device_create(const char *parition_name);
fal_init();
/* 在 spi flash 中名为 "filesystem" 的分区上创建一个块设备 */
struct rt_device *flash_dev = fal_blk_device_create(FS_PARTITION_NAME);
struct rt_device *flash_dev = fal_blk_device_create("font");
if (flash_dev == NULL)
{
LOG_E("Can't create a block device on '%s' partition.", FS_PARTITION_NAME);

View File

@ -1,66 +1,66 @@
#include <rtthread.h>
#include <rtdevice.h>
// #include <rtthread.h>
// #include <rtdevice.h>
#if defined(BSP_USING_TEST)
// #if defined(BSP_USING_TEST)
#define DRV_DEBUG
#define LOG_TAG "drv.test"
#include <drv_log.h>
// #define DRV_DEBUG
// #define LOG_TAG "drv.test"
// #include <drv_log.h>
static rt_err_t dev_test_init(rt_device_t dev)
{
LOG_I("test dev init");
return RT_EOK;
}
static rt_err_t dev_test_open(rt_device_t dev,rt_uint16_t oflag)
{
LOG_I("test dev open flag = %d",oflag);
return RT_EOK;
}
static rt_err_t dev_test_close(rt_device_t dev)
{
LOG_I("test dev close");
return RT_EOK;
}
static rt_ssize_t dev_test_read(rt_device_t dev,rt_off_t pos,void *buffer,rt_size_t size)
{
LOG_I("test dev read pos = %d,size = %d",pos,size);
return RT_EOK;
}
// static rt_err_t dev_test_init(rt_device_t dev)
// {
// LOG_I("test dev init");
// return RT_EOK;
// }
// static rt_err_t dev_test_open(rt_device_t dev,rt_uint16_t oflag)
// {
// LOG_I("test dev open flag = %d",oflag);
// return RT_EOK;
// }
// static rt_err_t dev_test_close(rt_device_t dev)
// {
// LOG_I("test dev close");
// return RT_EOK;
// }
// static rt_ssize_t dev_test_read(rt_device_t dev,rt_off_t pos,void *buffer,rt_size_t size)
// {
// LOG_I("test dev read pos = %d,size = %d",pos,size);
// return RT_EOK;
// }
static rt_ssize_t dev_test_write(rt_device_t dev,rt_off_t pos,const void *buffer,rt_size_t size)
{
LOG_I("test dev write pos = %d,size = %d",pos,size);
return RT_EOK;
}
static rt_err_t dev_test_control(rt_device_t dev,int cmd,void *args)
{
LOG_I("test dev control cmd %d",cmd);
return RT_EOK;
}
int rt_drv_test_init(void)
{
rt_device_t test_dev = rt_device_create(RT_Device_Class_Char,0);
if(!test_dev)
{
LOG_E("test dev create failed");
return -RT_ERROR;
}
// static rt_ssize_t dev_test_write(rt_device_t dev,rt_off_t pos,const void *buffer,rt_size_t size)
// {
// LOG_I("test dev write pos = %d,size = %d",pos,size);
// return RT_EOK;
// }
// static rt_err_t dev_test_control(rt_device_t dev,int cmd,void *args)
// {
// LOG_I("test dev control cmd %d",cmd);
// return RT_EOK;
// }
// int rt_drv_test_init(void)
// {
// rt_device_t test_dev = rt_device_create(RT_Device_Class_Char,0);
// if(!test_dev)
// {
// LOG_E("test dev create failed");
// return -RT_ERROR;
// }
test_dev->init = dev_test_init;
test_dev->open = dev_test_open;
test_dev->close = dev_test_close;
test_dev->read = dev_test_read;
test_dev->write = dev_test_write;
test_dev->control = dev_test_control;
// test_dev->init = dev_test_init;
// test_dev->open = dev_test_open;
// test_dev->close = dev_test_close;
// test_dev->read = dev_test_read;
// test_dev->write = dev_test_write;
// test_dev->control = dev_test_control;
if(rt_device_register(test_dev,"test_dev",RT_DEVICE_FLAG_RDWR) != RT_EOK)
{
LOG_E("test dev register failed");
return -RT_ERROR;
}
// if(rt_device_register(test_dev,"test_dev",RT_DEVICE_FLAG_RDWR) != RT_EOK)
// {
// LOG_E("test dev register failed");
// return -RT_ERROR;
// }
return RT_EOK;
}
INIT_BOARD_EXPORT(rt_drv_test_init);
#endif
// return RT_EOK;
// }
// INIT_BOARD_EXPORT(rt_drv_test_init);
// #endif

View File

@ -66,6 +66,7 @@
#define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
#define RT_MAIN_THREAD_PRIORITY 10
#define RT_USING_LEGACY
#define RT_USING_MSH
#define RT_USING_FINSH
#define FINSH_USING_MSH
@ -83,7 +84,38 @@
/* DFS: device virtual file system */
#define RT_USING_DFS
#define DFS_USING_POSIX
#define DFS_USING_WORKDIR
#define DFS_FD_MAX 16
#define RT_USING_DFS_V1
#define DFS_FILESYSTEMS_MAX 4
#define DFS_FILESYSTEM_TYPES_MAX 4
#define RT_USING_DFS_ELMFAT
/* elm-chan's FatFs, Generic FAT Filesystem Module */
#define RT_DFS_ELM_CODE_PAGE 437
#define RT_DFS_ELM_WORD_ACCESS
#define RT_DFS_ELM_USE_LFN_3
#define RT_DFS_ELM_USE_LFN 3
#define RT_DFS_ELM_LFN_UNICODE_0
#define RT_DFS_ELM_LFN_UNICODE 0
#define RT_DFS_ELM_MAX_LFN 255
#define RT_DFS_ELM_DRIVES 2
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
#define RT_DFS_ELM_REENTRANT
#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
/* end of elm-chan's FatFs, Generic FAT Filesystem Module */
#define RT_USING_DFS_DEVFS
#define RT_USING_DFS_ROMFS
/* end of DFS: device virtual file system */
#define RT_USING_FAL
#define FAL_DEBUG_CONFIG
#define FAL_DEBUG 1
#define FAL_PART_HAS_TABLE_CFG
#define FAL_USING_SFUD_PORT
#define FAL_USING_NOR_FLASH_DEV_NAME "norflash0"
/* Device Drivers */
@ -104,6 +136,8 @@
#define RT_SFUD_USING_SFDP
#define RT_SFUD_USING_FLASH_INFO_TABLE
#define RT_SFUD_SPI_MAX_HZ 50000000
#define RT_USING_SENSOR
#define RT_USING_SENSOR_CMD
#define RT_USING_WIFI
#define RT_WLAN_DEVICE_STA_NAME "wlan0"
#define RT_WLAN_DEVICE_AP_NAME "wlan1"
@ -148,6 +182,10 @@
/* POSIX (Portable Operating System Interface) layer */
#define RT_USING_POSIX_FS
#define RT_USING_POSIX_POLL
#define RT_USING_POSIX_SELECT
#define RT_USING_POSIX_SOCKET
/* Interprocess Communication (IPC) */
@ -167,7 +205,7 @@
#define SAL_USING_LWIP
/* end of Docking with protocol stacks */
#define SAL_SOCKETS_NUM 16
#define SAL_USING_POSIX
#define RT_USING_NETDEV
#define NETDEV_USING_IFCONFIG
#define NETDEV_USING_PING
@ -267,11 +305,11 @@
#define RW007_USING_STM32_DRIVERS
#define RW007_SPI_MAX_HZ 30000000
#define RW007_SPI_BUS_NAME "spi2"
#define RW007_CS_PIN 102
#define RW007_BOOT0_PIN 175
#define RW007_BOOT1_PIN 102
#define RW007_INT_BUSY_PIN 62
#define RW007_RST_PIN 187
#define RW007_CS_PIN 90
#define RW007_BOOT0_PIN 29
#define RW007_BOOT1_PIN 90
#define RW007_INT_BUSY_PIN 107
#define RW007_RST_PIN 111
/* CYW43012 WiFi */
@ -288,6 +326,54 @@
/* IoT Cloud */
#define PKG_USING_ALI_IOTKIT
#define PKG_USING_ALI_IOTKIT_PRODUCT_KEY "k1lyriw1yGj"
#define PKG_USING_ALI_IOTKIT_PRODUCT_SECRET "2QQeHVbu4dSN0SG7"
#define PKG_USING_ALI_IOTKIT_DEVICE_NAME "RT-Spark"
#define PKG_USING_ALI_IOTKIT_DEVICE_SECRET "1df4aa4834df32314612168e3135e206"
#define PKG_ALI_IOTKIT_SELECT_ITEM
#define PLATFORM_HAS_STDINT
#define PLATFORM_HAS_DYNMEM
#define PLATFORM_HAS_OS
#define INFRA_STRING
#define INFRA_NET
#define INFRA_LIST
#define INFRA_LOG_NETWORK_PAYLOAD
#define INFRA_LOG
/* Log Configurations */
#define INFRA_LOG_MUTE_FLW
#define INFRA_LOG_MUTE_DBG
#define INFRA_LOG_MUTE_INF
#define INFRA_LOG_MUTE_WRN
#define INFRA_LOG_MUTE_CRT
/* end of Log Configurations */
#define INFRA_TIMER
#define INFRA_CJSON
#define INFRA_SHA256
#define INFRA_REPORT
#define INFRA_COMPAT
#define INFRA_CLASSIC
#define DEV_SIGN
#define MQTT_COMM_ENABLED
/* MQTT Configurations */
#define MQTT_DEFAULT_IMPL
#define MQTT_DIRECT
/* end of MQTT Configurations */
#define DEVICE_MODEL_CLASSIC
#define LOG_REPORT_TO_CLOUD
#define DEVICE_MODEL_ENABLED
/* Device Model Configurations */
/* end of Device Model Configurations */
#define PKG_USING_ALI_IOTKIT_SAMPLES
#define PKG_USING_ALI_IOTKIT_MQTT_SAMPLE
#define PKG_USING_ALI_IOTKIT_V30002
#define PKG_ALI_IOTKIT_VER_NUM 0x30002
/* end of IoT Cloud */
/* end of IoT - internet of things */
@ -299,6 +385,8 @@
/* JSON: JavaScript Object Notation, a lightweight data-interchange format */
#define PKG_USING_CJSON
#define PKG_USING_CJSON_V1717
/* end of JSON: JavaScript Object Notation, a lightweight data-interchange format */
/* XML: Extensible Markup Language */
@ -325,6 +413,18 @@
/* enhanced kernel services */
#define PKG_USING_RT_VSNPRINTF_FULL
#define PKG_VSNPRINTF_SUPPORT_DECIMAL_SPECIFIERS
#define PKG_VSNPRINTF_SUPPORT_EXPONENTIAL_SPECIFIERS
#define PKG_VSNPRINTF_SUPPORT_WRITEBACK_SPECIFIER
#define PKG_VSNPRINTF_SUPPORT_LONG_LONG
#define PKG_VSNPRINTF_CHECK_FOR_NUL_IN_FORMAT_SPECIFIER
#define PKG_VSNPRINTF_INTEGER_BUFFER_SIZE 32
#define PKG_VSNPRINTF_DECIMAL_BUFFER_SIZE 32
#define PKG_VSNPRINTF_DEFAULT_FLOAT_PRECISION 6
#define PKG_VSNPRINTF_MAX_INTEGRAL_DIGITS_FOR_DECIMAL 9
#define PKG_VSNPRINTF_LOG10_TAYLOR_TERMS 4
#define PKG_USING_RT_VSNPRINTF_FULL_LATEST_VERSION
/* end of enhanced kernel services */
/* acceleration: Assembly language or algorithmic acceleration packages */
@ -359,6 +459,8 @@
/* sensors drivers */
#define PKG_USING_AHT10
#define PKG_USING_AHT10_LATEST_VERSION
/* end of sensors drivers */
/* touch drivers */
@ -453,8 +555,16 @@
/* Onboard Peripheral Drivers */
#define BSP_USING_USB_TO_USART
#define BSP_USING_SRAM
#define BSP_USING_ONBOARD_LCD
#define BSP_USING_ONBOARD_LCD_PWM_BL
#define BSP_USING_SPI_FLASH
#define BSP_USING_FS
#define BSP_USING_FLASH_FATFS
#define BSP_USING_FLASH_FS_AUTO_MOUNT
#define BSP_USING_FAL
#define BSP_USING_RW007_WLAN
#define BSP_USING_AHT21
/* end of Onboard Peripheral Drivers */
/* On-chip Peripheral Drivers */
@ -462,8 +572,18 @@
#define BSP_USING_GPIO
#define BSP_USING_UART
#define BSP_USING_UART1
#define BSP_USING_PWM
#define BSP_USING_PWM14
#define BSP_USING_PWM14_CH1
#define BSP_USING_ON_CHIP_FLASH
#define BSP_USING_SPI
#define BSP_USING_SPI2
#define BSP_USING_I2C
#define BSP_USING_I2C3
#define BSP_I2C3_SCL_PIN 64
#define BSP_I2C3_SDA_PIN 65
#define BSP_USING_EXT_FMC_IO
#define BSP_USING_FMC
/* end of On-chip Peripheral Drivers */
/* Board extended module Drivers */