drivers: pwm: use pwm_is_ready_dt helper function
Update `struct pwm_dt_spec` use with pwm_is_ready_dt() Signed-off-by: Nick Ward <nix.ward@gmail.com>
This commit is contained in:
parent
2bd76dc648
commit
82e8b0e826
7 changed files with 9 additions and 9 deletions
|
@ -28,7 +28,7 @@ int main(void)
|
|||
|
||||
printk("PWM-based blinky\n");
|
||||
|
||||
if (!device_is_ready(pwm_led0.dev)) {
|
||||
if (!pwm_is_ready_dt(&pwm_led0)) {
|
||||
printk("Error: PWM device %s is not ready\n",
|
||||
pwm_led0.dev->name);
|
||||
return 0;
|
||||
|
|
|
@ -28,7 +28,7 @@ int main(void)
|
|||
|
||||
printk("PWM-based LED fade\n");
|
||||
|
||||
if (!device_is_ready(pwm_led0.dev)) {
|
||||
if (!pwm_is_ready_dt(&pwm_led0)) {
|
||||
printk("Error: PWM device %s is not ready\n",
|
||||
pwm_led0.dev->name);
|
||||
return 0;
|
||||
|
|
|
@ -29,9 +29,9 @@ int main(void)
|
|||
|
||||
printk("PWM-based RGB LED control\n");
|
||||
|
||||
if (!device_is_ready(red_pwm_led.dev) ||
|
||||
!device_is_ready(green_pwm_led.dev) ||
|
||||
!device_is_ready(blue_pwm_led.dev)) {
|
||||
if (!pwm_is_ready_dt(&red_pwm_led) ||
|
||||
!pwm_is_ready_dt(&green_pwm_led) ||
|
||||
!pwm_is_ready_dt(&blue_pwm_led)) {
|
||||
printk("Error: one or more PWM devices not ready\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ int main(void)
|
|||
|
||||
printk("Servomotor control\n");
|
||||
|
||||
if (!device_is_ready(servo.dev)) {
|
||||
if (!pwm_is_ready_dt(&servo)) {
|
||||
printk("Error: PWM device %s is not ready\n", servo.dev->name);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -521,7 +521,7 @@ int main(void)
|
|||
|
||||
k_work_init_delayable(&refresh, game_refresh);
|
||||
|
||||
if (!device_is_ready(pwm.dev)) {
|
||||
if (!pwm_is_ready_dt(&pwm)) {
|
||||
printk("%s: device not ready.\n", pwm.dev->name);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ int main(void)
|
|||
{
|
||||
static struct gpio_callback button_cb_data;
|
||||
|
||||
if (!device_is_ready(pwm.dev)) {
|
||||
if (!pwm_is_ready_dt(&pwm)) {
|
||||
printk("%s: device not ready.\n", pwm.dev->name);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ static int power_ctrl_init(void)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
if (!device_is_ready(pwm_ctl.dev)) {
|
||||
if (!pwm_is_ready_dt(&pwm_ctl)) {
|
||||
LOG_ERR("Error: PWM CTL device is not ready\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue