Skip to content

Commit 655b2bf

Browse files
kltsengAnas Nashif
authored andcommitted
samples: blink_led: change hard-coded device name
Use the config name defined by the driver Kconfig in device binding calls as that is more portable and safer because device name can change and the app does not need to change. Jira: ZEP-1764 Change-Id: If8c14dd4eb186bace863432d454c9122461f2f9c Signed-off-by: Kuo-Lang Tseng <[email protected]>
1 parent 460ffe7 commit 655b2bf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

samples/basic/blink_led/src/main.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
#include <pwm.h>
1717

1818
#if defined(CONFIG_SOC_STM32F401XE) || defined(CONFIG_SOC_STM32L476XX)
19-
#define PWM_DRIVER "PWM_2"
19+
#define PWM_DRIVER CONFIG_PWM_STM32_2_DEV_NAME
2020
#define PWM_CHANNEL 1
2121
#elif CONFIG_SOC_STM32F103XB
22-
#define PWM_DRIVER "PWM_1"
22+
#define PWM_DRIVER CONFIG_PWM_STM32_1_DEV_NAME
2323
#define PWM_CHANNEL 1
24-
#else
25-
#define PWM_DRIVER "PWM_0"
24+
#elif defined(CONFIG_SOC_QUARK_SE_C1000) || defined(CONFIG_SOC_QUARK_D2000)
25+
#define PWM_DRIVER CONFIG_PWM_QMSI_DEV_NAME
2626
#define PWM_CHANNEL 0
27+
#else
28+
#error "Choose supported PWM driver"
2729
#endif
2830

2931
/* in micro second */

0 commit comments

Comments
 (0)