Skip to content

Commit 2a10fae

Browse files
[nrf fromlist] samples: nordic: nrfx_prs: align to nrfx_uarte rework
Changed error codes, driver instantiation and removed unnecessary symbols. Upstream PR #: 97923 Signed-off-by: Michał Stasiak <[email protected]>
1 parent 3c89355 commit 2a10fae

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

samples/boards/nordic/nrfx_prs/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# between those peripherals, as they share the same ID and hence cannot be used
33
# simultaneously.
44
CONFIG_NRFX_SPIM=y
5-
CONFIG_NRFX_UARTE2=y
5+
CONFIG_NRFX_UARTE=y
66
CONFIG_NRFX_PRS_BOX_2=y
77

88
# This is needed for using another SPIM instance via the Zephyr SPI driver.

samples/boards/nordic/nrfx_prs/src/main.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#define SPI_DEV_NODE DT_NODELABEL(spi1)
3030

3131
static nrfx_spim_t spim = NRFX_SPIM_INSTANCE(NRF_SPIM2);
32-
static nrfx_uarte_t uarte = NRFX_UARTE_INSTANCE(2);
32+
static nrfx_uarte_t uarte = NRFX_UARTE_INSTANCE(NRF_UARTE2);
3333
static bool spim_initialized;
3434
static bool uarte_initialized;
3535
static volatile size_t received;
@@ -212,7 +212,6 @@ static void uarte_handler(const nrfx_uarte_event_t *p_event, void *p_context)
212212
static bool switch_to_uarte(void)
213213
{
214214
int ret;
215-
nrfx_err_t err;
216215

217216
PINCTRL_DT_DEFINE(UARTE_NODE);
218217

@@ -243,9 +242,9 @@ static bool switch_to_uarte(void)
243242
return ret;
244243
}
245244

246-
err = nrfx_uarte_init(&uarte, &uarte_config, uarte_handler);
247-
if (err != NRFX_SUCCESS) {
248-
printk("nrfx_uarte_init() failed: 0x%08x\n", err);
245+
ret = nrfx_uarte_init(&uarte, &uarte_config, uarte_handler);
246+
if (err != 0) {
247+
printk("nrfx_uarte_init() failed: %d\n", ret);
249248
return false;
250249
}
251250

@@ -257,23 +256,23 @@ static bool switch_to_uarte(void)
257256
static bool uarte_transfer(const uint8_t *tx_data, size_t tx_data_len,
258257
uint8_t *rx_buf, size_t rx_buf_size)
259258
{
260-
nrfx_err_t err;
259+
int err;
261260

262261
err = nrfx_uarte_rx_buffer_set(&uarte, rx_buf, rx_buf_size);
263-
if (err != NRFX_SUCCESS) {
264-
printk("nrfx_uarte_rx_buffer_set() failed: 0x%08x\n", err);
262+
if (err != 0) {
263+
printk("nrfx_uarte_rx_buffer_set() failed: %d\n", err);
265264
return false;
266265
}
267266

268267
err = nrfx_uarte_rx_enable(&uarte, NRFX_UARTE_RX_ENABLE_STOP_ON_END);
269-
if (err != NRFX_SUCCESS) {
270-
printk("nrfx_uarte_rx_enable() failed: 0x%08x\n", err);
268+
if (err != 0) {
269+
printk("nrfx_uarte_rx_enable() failed: %d\n", err);
271270
return false;
272271
}
273272

274273
err = nrfx_uarte_tx(&uarte, tx_data, tx_data_len, 0);
275-
if (err != NRFX_SUCCESS) {
276-
printk("nrfx_uarte_tx() failed: 0x%08x\n", err);
274+
if (err != 0) {
275+
printk("nrfx_uarte_tx() failed: %d\n", err);
277276
return false;
278277
}
279278

0 commit comments

Comments
 (0)