Skip to content

Commit dba515f

Browse files
kltsengAnas Nashif
authored andcommitted
samples: fade_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: I3287da5c5a9df24507efa84bbf7bbb051726bc2c Signed-off-by: Kuo-Lang Tseng <[email protected]>
1 parent 655b2bf commit dba515f

File tree

1 file changed

+6
-4
lines changed
  • samples/basic/fade_led/src

1 file changed

+6
-4
lines changed

samples/basic/fade_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
/*

0 commit comments

Comments
 (0)