Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 0 additions & 100 deletions modules/hal_nordic/nrfx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1106,106 +1106,6 @@ config NRFX_UART0
config NRFX_UARTE
bool

config NRFX_UARTE0
bool "UARTE0 driver instance"
depends on $(dt_nodelabel_exists,uart0)
select NRFX_UARTE

config NRFX_UARTE1
bool "UARTE1 driver instance"
depends on $(dt_nodelabel_exists,uart1)
select NRFX_UARTE

config NRFX_UARTE2
bool "UARTE2 driver instance"
depends on $(dt_nodelabel_exists,uart2)
select NRFX_UARTE

config NRFX_UARTE3
bool "UARTE3 driver instance"
depends on $(dt_nodelabel_exists,uart3)
select NRFX_UARTE

config NRFX_UARTE00
bool "UARTE00 driver instance"
depends on $(dt_nodelabel_exists,uart00)
select NRFX_UARTE

config NRFX_UARTE20
bool "UARTE20 driver instance"
depends on $(dt_nodelabel_exists,uart20)
select NRFX_UARTE

config NRFX_UARTE21
bool "UARTE21 driver instance"
depends on $(dt_nodelabel_exists,uart21)
select NRFX_UARTE

config NRFX_UARTE22
bool "UARTE22 driver instance"
depends on $(dt_nodelabel_exists,uart22)
select NRFX_UARTE

config NRFX_UARTE23
bool "UARTE23 driver instance"
depends on $(dt_nodelabel_exists,uart23)
select NRFX_UARTE

config NRFX_UARTE24
bool "UARTE24 driver instance"
depends on $(dt_nodelabel_exists,uart24)
select NRFX_UARTE

config NRFX_UARTE30
bool "UARTE30 driver instance"
depends on $(dt_nodelabel_exists,uart30)
select NRFX_UARTE

config NRFX_UARTE120
bool "UARTE120 driver instance"
depends on $(dt_nodelabel_exists,uart120)
select NRFX_UARTE

config NRFX_UARTE130
bool "UARTE130 driver instance"
depends on $(dt_nodelabel_exists,uart130)
select NRFX_UARTE

config NRFX_UARTE131
bool "UARTE131 driver instance"
depends on $(dt_nodelabel_exists,uart131)
select NRFX_UARTE

config NRFX_UARTE132
bool "UARTE132 driver instance"
depends on $(dt_nodelabel_exists,uart132)
select NRFX_UARTE

config NRFX_UARTE133
bool "UARTE133 driver instance"
depends on $(dt_nodelabel_exists,uart133)
select NRFX_UARTE

config NRFX_UARTE134
bool "UARTE134 driver instance"
depends on $(dt_nodelabel_exists,uart134)
select NRFX_UARTE

config NRFX_UARTE135
bool "UARTE135 driver instance"
depends on $(dt_nodelabel_exists,uart135)
select NRFX_UARTE

config NRFX_UARTE136
bool "UARTE136 driver instance"
depends on $(dt_nodelabel_exists,uart136)
select NRFX_UARTE

config NRFX_UARTE137
bool "UARTE137 driver instance"
depends on $(dt_nodelabel_exists,uart137)
select NRFX_UARTE

config NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG
bool "UARTE GPIO configuration support"
depends on NRFX_UARTE
Expand Down
22 changes: 22 additions & 0 deletions modules/hal_nordic/nrfx/nrfx_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,25 @@
default: return "unknown";
}
}

char const *nrfx_new_error_string_get(int code)
{
#define NRFX_NEW_ERROR_STRING_CASE(code) case code: return #code

Check warning on line 51 in modules/hal_nordic/nrfx/nrfx_glue.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

MACRO_WITH_FLOW_CONTROL

modules/hal_nordic/nrfx/nrfx_glue.c:51 Macros with flow control statements should be avoided
switch (-code)

Check failure on line 52 in modules/hal_nordic/nrfx/nrfx_glue.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

OPEN_BRACE

modules/hal_nordic/nrfx/nrfx_glue.c:52 that open brace { should be on the previous line
{
NRFX_NEW_ERROR_STRING_CASE(0);
NRFX_NEW_ERROR_STRING_CASE(ECANCELED);
NRFX_NEW_ERROR_STRING_CASE(ENOMEM);
NRFX_NEW_ERROR_STRING_CASE(ENOTSUP);
NRFX_NEW_ERROR_STRING_CASE(EINVAL);
NRFX_NEW_ERROR_STRING_CASE(EINPROGRESS);
NRFX_NEW_ERROR_STRING_CASE(E2BIG);
NRFX_NEW_ERROR_STRING_CASE(ETIMEDOUT);
NRFX_NEW_ERROR_STRING_CASE(EPERM);
NRFX_NEW_ERROR_STRING_CASE(EFAULT);
NRFX_NEW_ERROR_STRING_CASE(EACCES);
NRFX_NEW_ERROR_STRING_CASE(EBUSY);
NRFX_NEW_ERROR_STRING_CASE(EALREADY);
default: return "unknown";
}
}
60 changes: 0 additions & 60 deletions modules/hal_nordic/nrfx/nrfx_kconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -898,66 +898,6 @@
#ifdef CONFIG_NRFX_UARTE_LOG
#define NRFX_UARTE_CONFIG_LOG_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE0
#define NRFX_UARTE0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE1
#define NRFX_UARTE1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE2
#define NRFX_UARTE2_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE3
#define NRFX_UARTE3_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE00
#define NRFX_UARTE00_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE20
#define NRFX_UARTE20_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE21
#define NRFX_UARTE21_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE22
#define NRFX_UARTE22_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE23
#define NRFX_UARTE23_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE24
#define NRFX_UARTE24_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE30
#define NRFX_UARTE30_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE120
#define NRFX_UARTE120_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE130
#define NRFX_UARTE130_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE131
#define NRFX_UARTE131_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE132
#define NRFX_UARTE132_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE133
#define NRFX_UARTE133_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE134
#define NRFX_UARTE134_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE135
#define NRFX_UARTE135_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE136
#define NRFX_UARTE136_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE137
#define NRFX_UARTE137_ENABLED 1
#endif
#ifdef CONFIG_NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG
#define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 1
#endif
Expand Down
10 changes: 10 additions & 0 deletions modules/hal_nordic/nrfx/nrfx_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ LOG_MODULE_REGISTER(NRFX_MODULE_PREFIX, NRFX_MODULE_LOG_LEVEL);
#define NRFX_LOG_ERROR_STRING_GET(error_code) nrfx_error_string_get(error_code)
extern char const *nrfx_error_string_get(nrfx_err_t code);

/**
* @brief Macro for getting the textual representation of a given errno error code.
*
* @param[in] error_code Errno error code.
*
* @return String containing the textual representation of the errno error code.
*/
#define NRFX_NEW_LOG_ERROR_STRING_GET(error_code) nrfx_new_error_string_get(error_code)
extern char const *nrfx_new_error_string_get(int code);

/** @} */

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion samples/boards/nordic/nrfx_prs/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# between those peripherals, as they share the same ID and hence cannot be used
# simultaneously.
CONFIG_NRFX_SPIM2=y
CONFIG_NRFX_UARTE2=y
CONFIG_NRFX_UARTE=y
CONFIG_NRFX_PRS_BOX_2=y

# This is needed for using another SPIM instance via the Zephyr SPI driver.
Expand Down
27 changes: 16 additions & 11 deletions samples/boards/nordic/nrfx_prs/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define SPI_DEV_NODE DT_NODELABEL(spi1)

static nrfx_spim_t spim = NRFX_SPIM_INSTANCE(2);
static nrfx_uarte_t uarte = NRFX_UARTE_INSTANCE(2);
static nrfx_uarte_t uarte = NRFX_UARTE_INSTANCE(NRF_UARTE2);
static bool spim_initialized;
static bool uarte_initialized;
static volatile size_t received;
Expand Down Expand Up @@ -213,7 +213,6 @@ static void uarte_handler(const nrfx_uarte_event_t *p_event, void *p_context)
static bool switch_to_uarte(void)
{
int ret;
nrfx_err_t err;

PINCTRL_DT_DEFINE(UARTE_NODE);

Expand Down Expand Up @@ -244,9 +243,9 @@ static bool switch_to_uarte(void)
return ret;
}

err = nrfx_uarte_init(&uarte, &uarte_config, uarte_handler);
if (err != NRFX_SUCCESS) {
printk("nrfx_uarte_init() failed: 0x%08x\n", err);
ret = nrfx_uarte_init(&uarte, &uarte_config, uarte_handler);
if (err != 0) {
printk("nrfx_uarte_init() failed: %d\n", ret);
return false;
}

Expand All @@ -258,17 +257,23 @@ static bool switch_to_uarte(void)
static bool uarte_transfer(const uint8_t *tx_data, size_t tx_data_len,
uint8_t *rx_buf, size_t rx_buf_size)
{
nrfx_err_t err;
int err;

err = nrfx_uarte_rx(&uarte, rx_buf, rx_buf_size);
if (err != NRFX_SUCCESS) {
printk("nrfx_uarte_rx() failed: 0x%08x\n", err);
err = nrfx_uarte_rx_buffer_set(&uarte, rx_buf, rx_buf_size);
if (err != 0) {
printk("nrfx_uarte_rx_buffer_set() failed: %d\n", err);
return false;
}

err = nrfx_uarte_rx_enable(&uarte, NRFX_UARTE_RX_ENABLE_STOP_ON_END);
if (err != 0) {
printk("nrfx_uarte_rx_enable() failed: %d\n", err);
return false;
}

err = nrfx_uarte_tx(&uarte, tx_data, tx_data_len, 0);
if (err != NRFX_SUCCESS) {
printk("nrfx_uarte_tx() failed: 0x%08x\n", err);
if (err != 0) {
printk("nrfx_uarte_tx() failed: %d\n", err);
return false;
}

Expand Down
Loading