drivers: pwm: nrf: Use HW PWM by default when available
Enable HW PWM driver instead of the SW one on nRF SoCs where the PWM peripheral is present. Default PWM instances are also enabled on Nordic DK boards so that it is possible to build the basic fade_led sample for them without extra adjustments. After the above changes are applied, some configuration alterations in basic samples blink_led and fade_led become no longer needed. These are removed. And the blink_led sample is corrected so that it works with the nRF HW PWM driver as well. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
2e8cdc1e7f
commit
e2b38e02bf
|
@ -23,6 +23,13 @@ config I2C_0
|
|||
|
||||
endif # I2C
|
||||
|
||||
if PWM
|
||||
|
||||
config PWM_0
|
||||
default y
|
||||
|
||||
endif # PWM
|
||||
|
||||
if SPI
|
||||
|
||||
config SPI_1
|
||||
|
|
|
@ -112,6 +112,12 @@
|
|||
scl-pin = <31>;
|
||||
};
|
||||
|
||||
&pwm0 {
|
||||
status = "ok";
|
||||
ch0-pin = <13>;
|
||||
ch0-inverted;
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "ok";
|
||||
sck-pin = <27>;
|
||||
|
|
|
@ -23,6 +23,13 @@ config I2C_0
|
|||
|
||||
endif # I2C
|
||||
|
||||
if PWM
|
||||
|
||||
config PWM_0
|
||||
default y
|
||||
|
||||
endif # PWM
|
||||
|
||||
if SPI
|
||||
|
||||
config SPI_1
|
||||
|
|
|
@ -109,6 +109,12 @@
|
|||
scl-pin = <31>;
|
||||
};
|
||||
|
||||
&pwm0 {
|
||||
status = "ok";
|
||||
ch0-pin = <17>;
|
||||
ch0-inverted;
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "ok";
|
||||
sck-pin = <27>;
|
||||
|
|
|
@ -23,6 +23,13 @@ config I2C_2
|
|||
|
||||
endif # I2C
|
||||
|
||||
if PWM
|
||||
|
||||
config PWM_0
|
||||
default y
|
||||
|
||||
endif # PWM
|
||||
|
||||
if SPI
|
||||
|
||||
config SPI_3
|
||||
|
|
|
@ -103,6 +103,12 @@
|
|||
scl-pin = <31>;
|
||||
};
|
||||
|
||||
&pwm0 {
|
||||
status = "ok";
|
||||
ch0-pin = <2>;
|
||||
ch0-inverted;
|
||||
};
|
||||
|
||||
&spi3 {
|
||||
status = "ok";
|
||||
sck-pin = <19>;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
menuconfig PWM_NRF5_SW
|
||||
bool "Nordic Semiconductor nRF5x series S/W PWM"
|
||||
default y if !PWM_NRFX
|
||||
depends on PWM && SOC_FAMILY_NRF
|
||||
default y
|
||||
help
|
||||
Enable driver to utilize PWM on the Nordic Semiconductor nRF5x series.
|
||||
This implementation provides up to 3 pins using one HF timer, two PPI
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
menuconfig PWM_NRFX
|
||||
bool "nRF PWM nrfx driver"
|
||||
default y
|
||||
depends on HAS_HW_NRF_PWM0 || HAS_HW_NRF_PWM1 || \
|
||||
HAS_HW_NRF_PWM2 || HAS_HW_NRF_PWM3
|
||||
select NRFX_PWM
|
||||
|
@ -32,7 +33,6 @@ config PWM_1_NAME
|
|||
PWM module 1.
|
||||
endif # PWM_1
|
||||
|
||||
|
||||
if PWM_2
|
||||
config PWM_2_NAME
|
||||
string "PWM module 2 device name"
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_PRINTK=y
|
||||
CONFIG_PWM=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_PWM_LOG_LEVEL_DBG=y
|
||||
CONFIG_PWM_NRF5_SW_0_CLOCK_PRESCALER=9
|
|
@ -1,6 +0,0 @@
|
|||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_PRINTK=y
|
||||
CONFIG_PWM=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_PWM_LOG_LEVEL_DBG=y
|
||||
CONFIG_PWM_NRF5_SW_0_CLOCK_PRESCALER=9
|
|
@ -1,6 +0,0 @@
|
|||
CONFIG_PRINTK=y
|
||||
CONFIG_LOG=y
|
||||
CONFIG_PWM_LOG_LEVEL_DBG=y
|
||||
|
||||
CONFIG_PWM=y
|
||||
CONFIG_PWM_NRF5_SW_0_CLOCK_PRESCALER=9
|
|
@ -27,14 +27,15 @@
|
|||
#define PWM_DRIVER CONFIG_PWM_QMSI_DEV_NAME
|
||||
#define PWM_CHANNEL 0
|
||||
#elif defined(CONFIG_SOC_FAMILY_NRF)
|
||||
#if defined(CONFIG_PWM_NRF5_SW)
|
||||
#define PWM_DRIVER CONFIG_PWM_NRF5_SW_0_DEV_NAME
|
||||
#else
|
||||
#define PWM_DRIVER CONFIG_PWM_0_NAME
|
||||
#endif /* CONFIG_PWM_NRF5_SW */
|
||||
#define PWM_CHANNEL LED0_GPIO_PIN
|
||||
#elif defined(CONFIG_BOARD_COLIBRI_IMX7D_M4)
|
||||
#define PWM_DRIVER PWM_1_LABEL
|
||||
#define PWM_CHANNEL 0
|
||||
#elif defined(CONFIG_SOC_FAMILY_NRF)
|
||||
#define PWM_DRIVER CONFIG_PWM_NRF5_SW_0_DEV_NAME
|
||||
#define PWM_CHANNEL LED0_GPIO_PIN
|
||||
#elif defined(PWM_LED0_PWM_CONTROLLER) && defined(PWM_LED0_PWM_CHANNEL)
|
||||
/* get the defines from dt (based on alias 'pwm-led0') */
|
||||
#define PWM_DRIVER PWM_LED0_PWM_CONTROLLER
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
&pwm0 {
|
||||
status = "ok";
|
||||
ch0-pin = <17>;
|
||||
ch0-inverted;
|
||||
ch1-pin = <18>;
|
||||
};
|
Loading…
Reference in a new issue