Skip to content

Commit 88ab153

Browse files
ananglcarlescufi
authored andcommitted
drivers: pwm_nrf5_sw: Rename to pwm_nrf_sw
Since the driver can now be also used on nRF91 Series, its name need to be updated to not cause confusion. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 8c1c666 commit 88ab153

File tree

8 files changed

+43
-42
lines changed

8 files changed

+43
-42
lines changed

drivers/pwm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ zephyr_library_sources_ifdef(CONFIG_PWM_TELINK_B91 pwm_b91.c)
88
zephyr_library_sources_ifdef(CONFIG_PWM_CC13XX_CC26XX_TIMER pwm_cc13xx_cc26xx_timer.c)
99
zephyr_library_sources_ifdef(CONFIG_PWM_STM32 pwm_stm32.c)
1010
zephyr_library_sources_ifdef(CONFIG_PWM_SIFIVE pwm_sifive.c)
11-
zephyr_library_sources_ifdef(CONFIG_PWM_NRF5_SW pwm_nrf5_sw.c)
11+
zephyr_library_sources_ifdef(CONFIG_PWM_NRF_SW pwm_nrf_sw.c)
1212
zephyr_library_sources_ifdef(CONFIG_PWM_NRFX pwm_nrfx.c)
1313
zephyr_library_sources_ifdef(CONFIG_PWM_MCUX_FTM pwm_mcux_ftm.c)
1414
zephyr_library_sources_ifdef(CONFIG_PWM_IMX pwm_imx.c)

drivers/pwm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ source "drivers/pwm/Kconfig.stm32"
4141

4242
source "drivers/pwm/Kconfig.sifive"
4343

44-
source "drivers/pwm/Kconfig.nrf5_sw"
44+
source "drivers/pwm/Kconfig.nrf_sw"
4545

4646
source "drivers/pwm/Kconfig.nrfx"
4747

drivers/pwm/Kconfig.nrf5_sw

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

drivers/pwm/Kconfig.nrf_sw

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Nordic Semiconductor nRF5x s/w PWM configuration options
2+
3+
# Copyright (c) 2017 Nordic Semiconductor ASA
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config PWM_NRF_SW
7+
bool "Nordic Semiconductor nRF family S/W PWM"
8+
default y if !PWM_NRFX
9+
depends on DT_HAS_NORDIC_NRF_SW_PWM_ENABLED
10+
select NRFX_GPIOTE
11+
select NRFX_PPI if HAS_HW_NRF_PPI
12+
select NRFX_DPPI if HAS_HW_NRF_DPPIC
13+
help
14+
Enable driver to utilize PWM on the Nordic Semiconductor nRF SoCs.
15+
16+
When used with HF timer, it provides up to 5 pins, utilizing one
17+
GPIOTE channel and two PPI/DPPI channels and per pin.
18+
19+
When used with RTC, it provides up to 3 pins, utilizing one GPIOTE
20+
channel and two or three (when the fork feature is not available)
21+
PPI/DPPI channels per pin.

drivers/pwm/pwm_nrf5_sw.c renamed to drivers/pwm/pwm_nrf_sw.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include <zephyr/logging/log.h>
1919

20-
LOG_MODULE_REGISTER(pwm_nrf5_sw, CONFIG_PWM_LOG_LEVEL);
20+
LOG_MODULE_REGISTER(pwm_nrf_sw, CONFIG_PWM_LOG_LEVEL);
2121

2222
#define GENERATOR_NODE DT_INST_PHANDLE(0, generator)
2323
#define GENERATOR_CC_NUM DT_PROP(GENERATOR_NODE, cc_num)
@@ -116,9 +116,9 @@ static uint32_t pwm_period_check(struct pwm_data *data, uint8_t map_size,
116116
return 0;
117117
}
118118

119-
static int pwm_nrf5_sw_set_cycles(const struct device *dev, uint32_t channel,
120-
uint32_t period_cycles, uint32_t pulse_cycles,
121-
pwm_flags_t flags)
119+
static int pwm_nrf_sw_set_cycles(const struct device *dev, uint32_t channel,
120+
uint32_t period_cycles, uint32_t pulse_cycles,
121+
pwm_flags_t flags)
122122
{
123123
const struct pwm_config *config = dev->config;
124124
NRF_TIMER_Type *timer = pwm_config_timer(config);
@@ -273,7 +273,7 @@ static int pwm_nrf5_sw_set_cycles(const struct device *dev, uint32_t channel,
273273

274274
#if PPI_FORK_AVAILABLE
275275
nrfx_gppi_fork_endpoint_setup(ppi_chs[1],
276-
clear_task_addr);
276+
clear_task_address);
277277
#else
278278
nrfx_gppi_channel_endpoints_setup(ppi_chs[2],
279279
period_end_event_address,
@@ -310,8 +310,8 @@ static int pwm_nrf5_sw_set_cycles(const struct device *dev, uint32_t channel,
310310
return 0;
311311
}
312312

313-
static int pwm_nrf5_sw_get_cycles_per_sec(const struct device *dev,
314-
uint32_t channel, uint64_t *cycles)
313+
static int pwm_nrf_sw_get_cycles_per_sec(const struct device *dev,
314+
uint32_t channel, uint64_t *cycles)
315315
{
316316
const struct pwm_config *config = dev->config;
317317

@@ -332,12 +332,12 @@ static int pwm_nrf5_sw_get_cycles_per_sec(const struct device *dev,
332332
return 0;
333333
}
334334

335-
static const struct pwm_driver_api pwm_nrf5_sw_drv_api_funcs = {
336-
.set_cycles = pwm_nrf5_sw_set_cycles,
337-
.get_cycles_per_sec = pwm_nrf5_sw_get_cycles_per_sec,
335+
static const struct pwm_driver_api pwm_nrf_sw_drv_api_funcs = {
336+
.set_cycles = pwm_nrf_sw_set_cycles,
337+
.get_cycles_per_sec = pwm_nrf_sw_get_cycles_per_sec,
338338
};
339339

340-
static int pwm_nrf5_sw_init(const struct device *dev)
340+
static int pwm_nrf_sw_init(const struct device *dev)
341341
{
342342
const struct pwm_config *config = dev->config;
343343
struct pwm_data *data = dev->data;
@@ -402,7 +402,7 @@ static int pwm_nrf5_sw_init(const struct device *dev)
402402
((DT_GPIO_FLAGS_BY_IDX(_node_id, _prop, _idx) & GPIO_ACTIVE_LOW) \
403403
? BIT(_idx) : 0) |
404404

405-
static const struct pwm_config pwm_nrf5_sw_0_config = {
405+
static const struct pwm_config pwm_nrf_sw_0_config = {
406406
COND_CODE_1(USE_RTC, (.rtc), (.timer)) = GENERATOR_ADDR,
407407
.psel_ch = {
408408
DT_INST_FOREACH_PROP_ELEM(0, channel_gpios, PSEL_AND_COMMA)
@@ -413,13 +413,13 @@ static const struct pwm_config pwm_nrf5_sw_0_config = {
413413
.prescaler = DT_INST_PROP(0, clock_prescaler),
414414
};
415415

416-
static struct pwm_data pwm_nrf5_sw_0_data;
416+
static struct pwm_data pwm_nrf_sw_0_data;
417417

418418
DEVICE_DT_INST_DEFINE(0,
419-
pwm_nrf5_sw_init,
419+
pwm_nrf_sw_init,
420420
NULL,
421-
&pwm_nrf5_sw_0_data,
422-
&pwm_nrf5_sw_0_config,
421+
&pwm_nrf_sw_0_data,
422+
&pwm_nrf_sw_0_config,
423423
POST_KERNEL,
424424
CONFIG_PWM_INIT_PRIORITY,
425-
&pwm_nrf5_sw_drv_api_funcs);
425+
&pwm_nrf_sw_drv_api_funcs);

samples/bluetooth/mesh_demo/boards/bbc_microbit.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CONFIG_GPIO=y
55
CONFIG_DISPLAY=y
66
CONFIG_MICROBIT_DISPLAY=y
77
CONFIG_PWM=y
8-
CONFIG_PWM_NRF5_SW=y
8+
CONFIG_PWM_NRF_SW=y
99

1010
CONFIG_BT_RX_STACK_SIZE=1280
1111
CONFIG_BT_CTLR_DUP_FILTER_LEN=0

samples/boards/bbc_microbit/pong/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CONFIG_GPIO=y
88
CONFIG_DISPLAY=y
99
CONFIG_MICROBIT_DISPLAY=y
1010
CONFIG_PWM=y
11-
CONFIG_PWM_NRF5_SW=y
11+
CONFIG_PWM_NRF_SW=y
1212

1313
# This feature isn't needed as this sample is intended to be used
1414
# between zephyr devices only.

samples/boards/bbc_microbit/sound/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ CONFIG_GPIO=y
22
CONFIG_DISPLAY=y
33
CONFIG_MICROBIT_DISPLAY=y
44
CONFIG_PWM=y
5-
CONFIG_PWM_NRF5_SW=y
5+
CONFIG_PWM_NRF_SW=y

0 commit comments

Comments
 (0)