Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuttx: Register PWM device only if device file is not present #1886

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/modules/nuttx/iotjs_module_pwm-nuttx.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ bool iotjs_pwm_open(iotjs_pwm_t* pwm) {
return false;
}

struct pwm_lowerhalf_s* pwm_lowerhalf =
iotjs_pwm_config_nuttx(timer, pwm->pin);
if (access(path, F_OK) != 0) {
struct pwm_lowerhalf_s* pwm_lowerhalf =
iotjs_pwm_config_nuttx(timer, pwm->pin);

DDDLOG("%s - path: %s, timer: %d\n", __func__, path, timer);
DDDLOG("%s - path: %s, timer: %d\n", __func__, path, timer);

if (pwm_register(path, pwm_lowerhalf) != 0) {
return false;
if (pwm_register(path, pwm_lowerhalf) != 0) {
return false;
}
}

// File open
Expand Down