From d8e312ff0e7a23c1649474d6d71d342385f2168f Mon Sep 17 00:00:00 2001 From: Aladdin-Wang <17630350805@163.com> Date: Thu, 26 Mar 2020 17:15:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=A9=E6=B9=BF=E5=BA=A6?= =?UTF-8?q?=E4=BC=A0=E6=84=9F=E5=99=A8sht30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stm32f767-fire-challenger/.config | 14 +- .../libraries/HAL_Drivers/drv_soft_i2c.c | 5 +- .../stm32f767-fire-challenger/project.uvoptx | 436 ++++++++++-------- .../stm32f767-fire-challenger/project.uvprojx | 17 +- .../stm32f767-fire-challenger/rtconfig.h | 8 + 5 files changed, 272 insertions(+), 208 deletions(-) diff --git a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/.config b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/.config index 9ce20d3..d4570e2 100644 --- a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/.config +++ b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/.config @@ -434,7 +434,11 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999 # CONFIG_PKG_USING_SENSORS_DRIVERS is not set # CONFIG_PKG_USING_REALTEK_AMEBA is not set # CONFIG_PKG_USING_SHT2X is not set -# CONFIG_PKG_USING_SHT3X is not set +CONFIG_PKG_USING_SHT3X=y +CONFIG_PKG_SHT3X_PATH="/packages/peripherals/sht3x" +# CONFIG_PKG_USING_SHT3X_V100 is not set +CONFIG_PKG_USING_SHT3X_LATEST_VERSION=y +CONFIG_PKG_SHT3X_VER="latest" # CONFIG_PKG_USING_STM32_SDIO is not set # CONFIG_PKG_USING_ICM20608 is not set # CONFIG_PKG_USING_U8G2 is not set @@ -535,7 +539,13 @@ CONFIG_BSP_USING_UART3=y # CONFIG_BSP_USING_SPI is not set # CONFIG_BSP_USING_QSPI is not set # CONFIG_BSP_USING_ADC is not set -# CONFIG_BSP_USING_I2C1 is not set +CONFIG_BSP_USING_I2C1=y + +# +# Notice: PB6 --> 22; PB7 --> 23 +# +CONFIG_BSP_I2C1_SCL_PIN=53 +CONFIG_BSP_I2C1_SDA_PIN=54 CONFIG_BSP_USING_ONCHIP_RTC=y CONFIG_BSP_RTC_USING_LSE=y # CONFIG_BSP_RTC_USING_LSI is not set diff --git a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/libraries/HAL_Drivers/drv_soft_i2c.c b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/libraries/HAL_Drivers/drv_soft_i2c.c index 6a13ab0..1ca3586 100644 --- a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/libraries/HAL_Drivers/drv_soft_i2c.c +++ b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/libraries/HAL_Drivers/drv_soft_i2c.c @@ -14,9 +14,8 @@ #ifdef RT_USING_I2C -//#define DRV_DEBUG -#define LOG_TAG "drv.i2c" -#define DBG_LVL DBG_LOG +#define DRV_DEBUG +#define LOG_TAG "drv.i2c" #include #if !defined(BSP_USING_I2C1) && !defined(BSP_USING_I2C2) && !defined(BSP_USING_I2C3) && !defined(BSP_USING_I2C4) diff --git a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/project.uvoptx b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/project.uvoptx index 5188521..00ebb37 100644 --- a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/project.uvoptx +++ b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/project.uvoptx @@ -188,7 +188,7 @@ Kernel - 1 + 0 0 0 0 @@ -503,6 +503,18 @@ 0 0 0 + libraries\HAL_Drivers\drv_soft_i2c.c + drv_soft_i2c.c + 0 + 0 + + + 3 + 26 + 1 + 0 + 0 + 0 libraries\HAL_Drivers\drv_sdram.c drv_sdram.c 0 @@ -510,7 +522,7 @@ 3 - 26 + 27 1 0 0 @@ -522,7 +534,7 @@ 3 - 27 + 28 1 0 0 @@ -536,13 +548,13 @@ TouchGFX_app - 1 + 0 0 0 0 4 - 28 + 29 1 0 0 @@ -554,7 +566,7 @@ 4 - 29 + 30 8 0 0 @@ -566,7 +578,7 @@ 4 - 30 + 31 8 0 0 @@ -578,7 +590,7 @@ 4 - 31 + 32 8 0 0 @@ -590,7 +602,7 @@ 4 - 32 + 33 8 0 0 @@ -602,7 +614,7 @@ 4 - 33 + 34 8 0 0 @@ -614,7 +626,7 @@ 4 - 34 + 35 8 0 0 @@ -626,7 +638,7 @@ 4 - 35 + 36 8 0 0 @@ -638,7 +650,7 @@ 4 - 36 + 37 1 0 0 @@ -650,7 +662,7 @@ 4 - 37 + 38 4 0 0 @@ -670,7 +682,7 @@ 0 5 - 38 + 39 8 0 0 @@ -682,7 +694,7 @@ 5 - 39 + 40 8 0 0 @@ -694,7 +706,7 @@ 5 - 40 + 41 8 0 0 @@ -706,7 +718,7 @@ 5 - 41 + 42 8 0 0 @@ -718,7 +730,7 @@ 5 - 42 + 43 8 0 0 @@ -730,7 +742,7 @@ 5 - 43 + 44 8 0 0 @@ -742,7 +754,7 @@ 5 - 44 + 45 8 0 0 @@ -754,7 +766,7 @@ 5 - 45 + 46 8 0 0 @@ -766,7 +778,7 @@ 5 - 46 + 47 8 0 0 @@ -778,7 +790,7 @@ 5 - 47 + 48 8 0 0 @@ -790,7 +802,7 @@ 5 - 48 + 49 8 0 0 @@ -802,7 +814,7 @@ 5 - 49 + 50 8 0 0 @@ -814,7 +826,7 @@ 5 - 50 + 51 8 0 0 @@ -826,7 +838,7 @@ 5 - 51 + 52 8 0 0 @@ -838,7 +850,7 @@ 5 - 52 + 53 8 0 0 @@ -850,7 +862,7 @@ 5 - 53 + 54 8 0 0 @@ -862,7 +874,7 @@ 5 - 54 + 55 8 0 0 @@ -874,7 +886,7 @@ 5 - 55 + 56 8 0 0 @@ -888,13 +900,13 @@ TouchGFX_gui - 1 + 0 0 0 0 6 - 56 + 57 8 0 0 @@ -906,7 +918,7 @@ 6 - 57 + 58 8 0 0 @@ -918,7 +930,7 @@ 6 - 58 + 59 8 0 0 @@ -930,7 +942,7 @@ 6 - 59 + 60 8 0 0 @@ -950,7 +962,7 @@ 0 7 - 60 + 61 1 0 0 @@ -962,7 +974,7 @@ 7 - 61 + 62 1 0 0 @@ -974,7 +986,7 @@ 7 - 62 + 63 1 0 0 @@ -986,7 +998,7 @@ 7 - 63 + 64 1 0 0 @@ -1006,7 +1018,7 @@ 0 8 - 64 + 65 1 0 0 @@ -1019,14 +1031,34 @@ - cpu + sht3x 1 0 0 0 9 - 65 + 66 + 1 + 0 + 0 + 0 + packages\sht3x-latest\sht3x.c + sht3x.c + 0 + 0 + + + + + cpu + 0 + 0 + 0 + 0 + + 10 + 67 1 0 0 @@ -1037,8 +1069,8 @@ 0 - 9 - 66 + 10 + 68 1 0 0 @@ -1049,8 +1081,8 @@ 0 - 9 - 67 + 10 + 69 1 0 0 @@ -1061,8 +1093,8 @@ 0 - 9 - 68 + 10 + 70 1 0 0 @@ -1073,8 +1105,8 @@ 0 - 9 - 69 + 10 + 71 1 0 0 @@ -1085,8 +1117,8 @@ 0 - 9 - 70 + 10 + 72 2 0 0 @@ -1100,13 +1132,13 @@ CPlusPlus - 1 + 0 0 0 0 - 10 - 71 + 11 + 73 8 0 0 @@ -1117,8 +1149,8 @@ 0 - 10 - 72 + 11 + 74 8 0 0 @@ -1129,8 +1161,8 @@ 0 - 10 - 73 + 11 + 75 8 0 0 @@ -1141,8 +1173,8 @@ 0 - 10 - 74 + 11 + 76 8 0 0 @@ -1153,8 +1185,8 @@ 0 - 10 - 75 + 11 + 77 1 0 0 @@ -1168,13 +1200,13 @@ DeviceDrivers - 1 + 0 0 0 0 - 11 - 76 + 12 + 78 1 0 0 @@ -1185,8 +1217,8 @@ 0 - 11 - 77 + 12 + 79 1 0 0 @@ -1197,8 +1229,8 @@ 0 - 11 - 78 + 12 + 80 1 0 0 @@ -1209,8 +1241,8 @@ 0 - 11 - 79 + 12 + 81 1 0 0 @@ -1221,8 +1253,8 @@ 0 - 11 - 80 + 12 + 82 1 0 0 @@ -1233,8 +1265,8 @@ 0 - 11 - 81 + 12 + 83 1 0 0 @@ -1245,8 +1277,8 @@ 0 - 11 - 82 + 12 + 84 1 0 0 @@ -1257,8 +1289,8 @@ 0 - 11 - 83 + 12 + 85 1 0 0 @@ -1269,8 +1301,8 @@ 0 - 11 - 84 + 12 + 86 1 0 0 @@ -1281,8 +1313,8 @@ 0 - 11 - 85 + 12 + 87 1 0 0 @@ -1293,8 +1325,8 @@ 0 - 11 - 86 + 12 + 88 1 0 0 @@ -1305,8 +1337,8 @@ 0 - 11 - 87 + 12 + 89 1 0 0 @@ -1317,8 +1349,8 @@ 0 - 11 - 88 + 12 + 90 1 0 0 @@ -1329,8 +1361,8 @@ 0 - 11 - 89 + 12 + 91 1 0 0 @@ -1341,8 +1373,8 @@ 0 - 11 - 90 + 12 + 92 1 0 0 @@ -1361,8 +1393,8 @@ 0 0 - 12 - 91 + 13 + 93 1 0 0 @@ -1381,8 +1413,8 @@ 0 0 - 13 - 92 + 14 + 94 1 0 0 @@ -1393,8 +1425,8 @@ 0 - 13 - 93 + 14 + 95 1 0 0 @@ -1405,8 +1437,8 @@ 0 - 13 - 94 + 14 + 96 1 0 0 @@ -1425,8 +1457,8 @@ 0 0 - 14 - 95 + 15 + 97 1 0 0 @@ -1437,8 +1469,8 @@ 0 - 14 - 96 + 15 + 98 1 0 0 @@ -1449,8 +1481,8 @@ 0 - 14 - 97 + 15 + 99 1 0 0 @@ -1461,8 +1493,8 @@ 0 - 14 - 98 + 15 + 100 1 0 0 @@ -1481,8 +1513,8 @@ 0 0 - 15 - 99 + 16 + 101 1 0 0 @@ -1493,8 +1525,8 @@ 0 - 15 - 100 + 16 + 102 1 0 0 @@ -1505,8 +1537,8 @@ 0 - 15 - 101 + 16 + 103 1 0 0 @@ -1517,8 +1549,8 @@ 0 - 15 - 102 + 16 + 104 1 0 0 @@ -1537,8 +1569,8 @@ 0 0 - 16 - 103 + 17 + 105 1 0 0 @@ -1549,8 +1581,8 @@ 0 - 16 - 104 + 17 + 106 1 0 0 @@ -1569,8 +1601,8 @@ 0 0 - 17 - 105 + 18 + 107 1 0 0 @@ -1581,8 +1613,8 @@ 0 - 17 - 106 + 18 + 108 1 0 0 @@ -1593,8 +1625,8 @@ 0 - 17 - 107 + 18 + 109 1 0 0 @@ -1613,8 +1645,8 @@ 0 0 - 18 - 108 + 19 + 110 1 0 0 @@ -1625,8 +1657,8 @@ 0 - 18 - 109 + 19 + 111 1 0 0 @@ -1645,8 +1677,8 @@ 0 0 - 19 - 110 + 20 + 112 1 0 0 @@ -1657,8 +1689,8 @@ 0 - 19 - 111 + 20 + 113 1 0 0 @@ -1669,8 +1701,8 @@ 0 - 19 - 112 + 20 + 114 1 0 0 @@ -1681,8 +1713,8 @@ 0 - 19 - 113 + 20 + 115 1 0 0 @@ -1693,8 +1725,8 @@ 0 - 19 - 114 + 20 + 116 1 0 0 @@ -1705,8 +1737,8 @@ 0 - 19 - 115 + 20 + 117 1 0 0 @@ -1717,8 +1749,8 @@ 0 - 19 - 116 + 20 + 118 1 0 0 @@ -1729,8 +1761,8 @@ 0 - 19 - 117 + 20 + 119 1 0 0 @@ -1741,8 +1773,8 @@ 0 - 19 - 118 + 20 + 120 1 0 0 @@ -1753,8 +1785,8 @@ 0 - 19 - 119 + 20 + 121 1 0 0 @@ -1765,8 +1797,8 @@ 0 - 19 - 120 + 20 + 122 1 0 0 @@ -1777,8 +1809,8 @@ 0 - 19 - 121 + 20 + 123 1 0 0 @@ -1789,8 +1821,8 @@ 0 - 19 - 122 + 20 + 124 1 0 0 @@ -1801,8 +1833,8 @@ 0 - 19 - 123 + 20 + 125 1 0 0 @@ -1813,8 +1845,8 @@ 0 - 19 - 124 + 20 + 126 1 0 0 @@ -1825,8 +1857,8 @@ 0 - 19 - 125 + 20 + 127 1 0 0 @@ -1837,8 +1869,8 @@ 0 - 19 - 126 + 20 + 128 1 0 0 @@ -1849,8 +1881,8 @@ 0 - 19 - 127 + 20 + 129 1 0 0 @@ -1861,8 +1893,8 @@ 0 - 19 - 128 + 20 + 130 1 0 0 @@ -1873,8 +1905,8 @@ 0 - 19 - 129 + 20 + 131 1 0 0 @@ -1885,8 +1917,8 @@ 0 - 19 - 130 + 20 + 132 1 0 0 @@ -1897,8 +1929,8 @@ 0 - 19 - 131 + 20 + 133 1 0 0 @@ -1909,8 +1941,8 @@ 0 - 19 - 132 + 20 + 134 1 0 0 @@ -1921,8 +1953,8 @@ 0 - 19 - 133 + 20 + 135 1 0 0 @@ -1933,8 +1965,8 @@ 0 - 19 - 134 + 20 + 136 1 0 0 @@ -1945,8 +1977,8 @@ 0 - 19 - 135 + 20 + 137 1 0 0 @@ -1957,8 +1989,8 @@ 0 - 19 - 136 + 20 + 138 1 0 0 @@ -1969,8 +2001,8 @@ 0 - 19 - 137 + 20 + 139 1 0 0 @@ -1981,8 +2013,8 @@ 0 - 19 - 138 + 20 + 140 1 0 0 @@ -1993,8 +2025,8 @@ 0 - 19 - 139 + 20 + 141 1 0 0 @@ -2005,8 +2037,8 @@ 0 - 19 - 140 + 20 + 142 1 0 0 @@ -2017,8 +2049,8 @@ 0 - 19 - 141 + 20 + 143 1 0 0 @@ -2029,8 +2061,8 @@ 0 - 19 - 142 + 20 + 144 1 0 0 @@ -2041,8 +2073,8 @@ 0 - 19 - 143 + 20 + 145 1 0 0 diff --git a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/project.uvprojx b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/project.uvprojx index 8e1bb19..96acdc0 100644 --- a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/project.uvprojx +++ b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/project.uvprojx @@ -338,7 +338,7 @@ STM32F767xx, USE_HAL_DRIVER, RT_USING_ARM_LIBC - .;rt-thread\include;applications;.;board;board\CubeMX_Config\Inc;board\ports;libraries\HAL_Drivers;libraries\HAL_Drivers\config;board\CubeMX_Config\Src;board\CubeMX_Config\Middlewares\ST\touchgfx\framework\include;board\CubeMX_Config\Src\generated\fonts\include;board\CubeMX_Config\Src\generated\gui_generated\include;board\CubeMX_Config\Src\generated\images\include;board\CubeMX_Config\Src\generated\texts\include;board\CubeMX_Config\Src\gui\include;packages\at_device-latest\inc;packages\at_device-latest\class\esp8266;packages\netutils-latest\ntp;rt-thread\libcpu\arm\common;rt-thread\libcpu\arm\cortex-m7;rt-thread\components\cplusplus;rt-thread\components\drivers\include;rt-thread\components\drivers\include;rt-thread\components\drivers\include;rt-thread\components\drivers\include;rt-thread\components\drivers\spi;rt-thread\components\drivers\include;rt-thread\components\drivers\include;rt-thread\components\drivers\touch;rt-thread\components\drivers\include;rt-thread\components\finsh;rt-thread\components\libc\compilers\armlibc;rt-thread\components\libc\compilers\common;rt-thread\components\net\at\include;rt-thread\components\net\at\at_socket;rt-thread\components\net\netdev\include;rt-thread\components\net\sal_socket\include;rt-thread\components\net\sal_socket\include\socket;rt-thread\components\net\sal_socket\impl;rt-thread\components\net\sal_socket\include\socket\sys_socket;rt-thread\components\utilities\ulog;libraries\STM32F7xx_HAL\STM32F7xx_HAL_Driver\Inc;libraries\STM32F7xx_HAL\CMSIS\Device\ST\STM32F7xx\Include;libraries\STM32F7xx_HAL\CMSIS\Include + .;rt-thread\include;applications;.;board;board\CubeMX_Config\Inc;board\ports;libraries\HAL_Drivers;libraries\HAL_Drivers\config;board\CubeMX_Config\Src;board\CubeMX_Config\Middlewares\ST\touchgfx\framework\include;board\CubeMX_Config\Src\generated\fonts\include;board\CubeMX_Config\Src\generated\gui_generated\include;board\CubeMX_Config\Src\generated\images\include;board\CubeMX_Config\Src\generated\texts\include;board\CubeMX_Config\Src\gui\include;packages\at_device-latest\inc;packages\at_device-latest\class\esp8266;packages\netutils-latest\ntp;packages\sht3x-latest;rt-thread\libcpu\arm\common;rt-thread\libcpu\arm\cortex-m7;rt-thread\components\cplusplus;rt-thread\components\drivers\include;rt-thread\components\drivers\include;rt-thread\components\drivers\include;rt-thread\components\drivers\include;rt-thread\components\drivers\spi;rt-thread\components\drivers\include;rt-thread\components\drivers\include;rt-thread\components\drivers\touch;rt-thread\components\drivers\include;rt-thread\components\finsh;rt-thread\components\libc\compilers\armlibc;rt-thread\components\libc\compilers\common;rt-thread\components\net\at\include;rt-thread\components\net\at\at_socket;rt-thread\components\net\netdev\include;rt-thread\components\net\sal_socket\include;rt-thread\components\net\sal_socket\include\socket;rt-thread\components\net\sal_socket\impl;rt-thread\components\net\sal_socket\include\socket\sys_socket;rt-thread\components\utilities\ulog;libraries\STM32F7xx_HAL\STM32F7xx_HAL_Driver\Inc;libraries\STM32F7xx_HAL\CMSIS\Device\ST\STM32F7xx\Include;libraries\STM32F7xx_HAL\CMSIS\Include @@ -512,6 +512,11 @@ 1 libraries\HAL_Drivers\drv_spi.c + + drv_soft_i2c.c + 1 + libraries\HAL_Drivers\drv_soft_i2c.c + drv_sdram.c 1 @@ -739,6 +744,16 @@ + + sht3x + + + sht3x.c + 1 + packages\sht3x-latest\sht3x.c + + + cpu diff --git a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/rtconfig.h b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/rtconfig.h index bbc7c99..24778cf 100644 --- a/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/rtconfig.h +++ b/demo/3_STM32F767_RTThread_TouchGFX/4_rtthread_TouchGFX_iot/stm32f767-fire-challenger/rtconfig.h @@ -207,6 +207,8 @@ /* peripheral libraries and drivers */ +#define PKG_USING_SHT3X +#define PKG_USING_SHT3X_LATEST_VERSION /* miscellaneous packages */ @@ -233,6 +235,12 @@ #define BSP_USING_UART #define BSP_USING_UART1 #define BSP_USING_UART3 +#define BSP_USING_I2C1 + +/* Notice: PB6 --> 22; PB7 --> 23 */ + +#define BSP_I2C1_SCL_PIN 53 +#define BSP_I2C1_SDA_PIN 54 #define BSP_USING_ONCHIP_RTC #define BSP_RTC_USING_LSE #define BSP_USING_FMC