Skip to content

Commit 46afafe

Browse files
adamkondraciukmasz-nordic
authored andcommitted
[nrf fromlist] tests: i2c: Align tests to I2C API changes
Align TWIM and TWIS tests to standard instanation changes in I2C API. Upstream PR #: 98569 Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
1 parent b3e636e commit 46afafe

10 files changed

+6
-37
lines changed

tests/boards/nrf/i2c/i2c_slave/boards/bl54l15_dvk_nrf54l15_cpuapp.conf

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/boards/nrf/i2c/i2c_slave/boards/bl54l15u_dvk_nrf54l15_cpuapp.conf

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/boards/nrf/i2c/i2c_slave/boards/nrf5340dk_nrf5340_cpuapp.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuapp.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/boards/nrf/i2c/i2c_slave/boards/nrf54h20dk_nrf54h20_cpuppr.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/boards/nrf/i2c/i2c_slave/boards/nrf54l15dk_nrf54l15_cpuapp.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/boards/nrf/i2c/i2c_slave/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
CONFIG_I2C=y
22
CONFIG_ZTEST=y
3+
CONFIG_NRFX_TWIS=y

tests/boards/nrf/i2c/i2c_slave/src/main.c

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,6 @@
1717

1818
#include <zephyr/ztest.h>
1919

20-
#if CONFIG_NRFX_TWIS1
21-
#define I2C_S_INSTANCE 1
22-
#elif CONFIG_NRFX_TWIS2
23-
#define I2C_S_INSTANCE 2
24-
#elif CONFIG_NRFX_TWIS20
25-
#define I2C_S_INSTANCE 20
26-
#elif CONFIG_NRFX_TWIS21
27-
#define I2C_S_INSTANCE 21
28-
#elif CONFIG_NRFX_TWIS22
29-
#define I2C_S_INSTANCE 22
30-
#elif CONFIG_NRFX_TWIS30
31-
#define I2C_S_INSTANCE 30
32-
#elif CONFIG_NRFX_TWIS131
33-
#define I2C_S_INSTANCE 131
34-
#else
35-
#error "TWIS instance not enabled or not supported"
36-
#endif
37-
3820
#define NODE_SENSOR DT_NODELABEL(sensor)
3921
#define NODE_TWIS DT_ALIAS(i2c_slave)
4022

@@ -46,7 +28,9 @@
4628

4729
#define TEST_DATA_SIZE 6
4830
static const uint8_t msg[TEST_DATA_SIZE] = "Nordic";
49-
static const nrfx_twis_t twis = NRFX_TWIS_INSTANCE(I2C_S_INSTANCE);
31+
static nrfx_twis_t twis = {
32+
.p_reg = (NRF_TWIS_Type *)DT_REG_ADDR(NODE_TWIS)
33+
};
5034

5135
static uint8_t i2c_slave_buffer[TEST_DATA_SIZE] TWIS_MEMORY_SECTION;
5236
static uint8_t i2c_master_buffer[TEST_DATA_SIZE];
@@ -57,7 +41,7 @@ struct i2c_api_twis_fixture {
5741
uint8_t *const slave_buffer;
5842
};
5943

60-
void i2s_slave_handler(nrfx_twis_evt_t const *p_event)
44+
void i2s_slave_handler(nrfx_twis_event_t const *p_event)
6145
{
6246
switch (p_event->type) {
6347
case NRFX_TWIS_EVT_READ_REQ:
@@ -104,7 +88,7 @@ static void *test_setup(void)
10488
zassert_ok(ret);
10589

10690
IRQ_CONNECT(DT_IRQN(NODE_TWIS), DT_IRQ(NODE_TWIS, priority),
107-
NRFX_TWIS_INST_HANDLER_GET(I2C_S_INSTANCE), NULL, 0);
91+
nrfx_twis_irq_handler, &twis, 0);
10892

10993
nrfx_twis_enable(&twis);
11094

0 commit comments

Comments
 (0)