We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6ffcdb commit e8224c3Copy full SHA for e8224c3
samples/basic/servo_motor/src/main.c
@@ -17,9 +17,6 @@
17
18
#if !DT_NODE_HAS_STATUS(PWM_NODE, okay)
19
#error "Unsupported board: pwm-servo devicetree alias is not defined or enabled"
20
-#define PWM_LABEL ""
21
-#else
22
-#define PWM_LABEL DT_LABEL(PWM_NODE)
23
#endif
24
25
/*
@@ -45,9 +42,9 @@ void main(void)
45
42
46
43
printk("Servomotor control\n");
47
44
48
- pwm = device_get_binding(PWM_LABEL);
49
- if (!pwm) {
50
- printk("Error: didn't find %s device\n", PWM_LABEL);
+ pwm = DEVICE_DT_GET(PWM_NODE);
+ if (!device_is_ready(pwm)) {
+ printk("Error: PWM device %s is not ready\n", pwm->name);
51
return;
52
}
53
0 commit comments