Skip to content

Commit 704554f

Browse files
authored
[sensor-v2]将当前sensor框架revert回v1版本并独立为v2 (#7698)
1 parent 1758de1 commit 704554f

File tree

12 files changed

+1597
-296
lines changed

12 files changed

+1597
-296
lines changed

bsp/nuvoton/libraries/nu_packages/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ menu "Nuvoton Packages Config"
1111
bool "BMX055 9-axis sensor."
1212
select RT_USING_I2C
1313
select RT_USING_SENSOR
14+
select RT_USING_SENSOR_V2
1415
default n
1516

1617
config NU_PKG_USING_MAX31875
1718
bool "MAX31875 Temperature sensor."
1819
select RT_USING_I2C
1920
select RT_USING_SENSOR
21+
select RT_USING_SENSOR_V2
2022
default n
2123

2224
config NU_PKG_USING_NCT7717U
2325
bool "NCT7717U Temperature sensor."
2426
select RT_USING_I2C
2527
select RT_USING_SENSOR
28+
select RT_USING_SENSOR_V2
2629
default n
2730

2831
config NU_PKG_USING_NAU88L25

components/drivers/Kconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,13 @@ config RT_USING_SENSOR
370370
default n
371371

372372
if RT_USING_SENSOR
373+
config RT_USING_SENSOR_V2
374+
bool "Enable Sensor Framework v2"
375+
default n
376+
373377
config RT_USING_SENSOR_CMD
374378
bool "Using Sensor cmd"
375-
select PKG_USING_RT_VSNPRINTF_FULL
379+
select PKG_USING_RT_VSNPRINTF_FULL if RT_USING_SENSOR_V2
376380
default y
377381
endif
378382

components/drivers/include/drivers/sensor.h

Lines changed: 131 additions & 283 deletions
Large diffs are not rendered by default.

components/drivers/include/drivers/sensor_v2.h

Lines changed: 406 additions & 0 deletions
Large diffs are not rendered by default.

components/drivers/include/rtdevice.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ extern "C" {
9494
#endif /* RT_USING_PIN */
9595

9696
#ifdef RT_USING_SENSOR
97+
#ifdef RT_USING_SENSOR_V2
98+
#include "drivers/sensor_v2.h"
99+
#else
97100
#include "drivers/sensor.h"
101+
#endif /* RT_USING_SENSOR_V2 */
98102
#endif /* RT_USING_SENSOR */
99103

100104
#ifdef RT_USING_CAN
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
# SConscript for sensor framework
1+
# RT-Thread building script for bridge
22

3+
import os
34
from building import *
45

56
cwd = GetCurrentDir()
6-
src = ['sensor.c']
7-
CPPPATH = [cwd, cwd + '/../include']
7+
objs = []
8+
list = os.listdir(cwd)
89

9-
if GetDepend('RT_USING_SENSOR_CMD'):
10-
src += ['sensor_cmd.c']
10+
for d in list:
11+
path = os.path.join(cwd, d)
12+
if os.path.isfile(os.path.join(path, 'SConscript')):
13+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
1114

12-
group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SENSOR', 'RT_USING_DEVICE'], CPPPATH = CPPPATH)
13-
14-
Return('group')
15+
Return('objs')
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SConscript for sensor framework
2+
3+
from building import *
4+
5+
src = ['sensor.c']
6+
7+
if GetDepend('RT_USING_SENSOR_CMD'):
8+
src += ['sensor_cmd.c']
9+
10+
group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SENSOR'])
11+
12+
Return('group')

0 commit comments

Comments
 (0)