Skip to content

Commit ed5ca1c

Browse files
yuyun1xiaoxiang781216
authored andcommitted
i2c slave: add i2c slave test code
Signed-off-by: yuyun1 <[email protected]>
1 parent 3d8dc5d commit ed5ca1c

File tree

4 files changed

+760
-0
lines changed

4 files changed

+760
-0
lines changed

testing/drivertest/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,36 @@ if(CONFIG_TESTING_DRIVER_TEST)
183183
endif()
184184
endif()
185185

186+
if(CONFIG_I2C_DRIVER AND CONFIG_I2C_SLAVE_DRIVER)
187+
nuttx_add_application(
188+
NAME
189+
cmocka_driver_i2c_write
190+
PRIORITY
191+
${CONFIG_TESTING_DRIVER_TEST_PRIORITY}
192+
STACKSIZE
193+
${CONFIG_TESTING_DRIVER_TEST_STACKSIZE}
194+
MODULE
195+
${CONFIG_TESTING_DRIVER_TEST}
196+
DEPENDS
197+
cmocka
198+
SRCS
199+
drivertest_i2c_write.c)
200+
201+
nuttx_add_application(
202+
NAME
203+
cmocka_driver_i2c_read
204+
PRIORITY
205+
${CONFIG_TESTING_DRIVER_TEST_PRIORITY}
206+
STACKSIZE
207+
${CONFIG_TESTING_DRIVER_TEST_STACKSIZE}
208+
MODULE
209+
${CONFIG_TESTING_DRIVER_TEST}
210+
DEPENDS
211+
cmocka
212+
SRCS
213+
drivertest_i2c_read.c)
214+
endif()
215+
186216
if(CONFIG_DEV_GPIO)
187217
nuttx_add_application(
188218
NAME

testing/drivertest/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ PROGNAME += cmocka_driver_i2c_spi
8888
endif
8989
endif
9090

91+
ifneq ($(CONFIG_I2C_DRIVER)$(CONFIG_I2C_SLAVE_DRIVER),)
92+
MAINSRC += drivertest_i2c_write.c
93+
PROGNAME += cmocka_driver_i2c_write
94+
95+
MAINSRC += drivertest_i2c_read.c
96+
PROGNAME += cmocka_driver_i2c_read
97+
endif
98+
9199
ifneq ($(CONFIG_DEV_GPIO),)
92100
PROGNAME += cmocka_driver_gpio
93101
MAINSRC += drivertest_gpio.c

0 commit comments

Comments
 (0)