File tree Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -566,22 +566,7 @@ BBIO_err pwm_disable(const char *key)
566566 struct pwm_exp * pwm , * temp , * prev_pwm = NULL ;
567567 BBIO_err err ;
568568
569- #ifdef BBBVERSION41
570- char buffer [2 ];
571- size_t len ;
572- pwm = lookup_exported_pwm (key );
573-
574- // Disable the PWM
575- lseek (pwm -> enable_fd , 0 , SEEK_SET );
576- len = snprintf (buffer , sizeof (buffer ), "0" );
577- if (write (pwm -> enable_fd , buffer , len ) < 0 ) {
578- return BBIO_SYSFS ;
579- }
580-
581- // Unexport the PWM
582- // TODO later
583-
584- #else
569+ #ifndef BBBVERSION41
585570 char fragment [18 ];
586571 snprintf (fragment , sizeof (fragment ), "bone_pwm_%s" , key );
587572 err = unload_device_tree (fragment );
@@ -595,6 +580,22 @@ BBIO_err pwm_disable(const char *key)
595580 {
596581 if (strcmp (pwm -> key , key ) == 0 )
597582 {
583+
584+ #ifdef BBBVERSION41
585+ char buffer [2 ];
586+ size_t len ;
587+
588+ // Disable the PWM
589+ lseek (pwm -> enable_fd , 0 , SEEK_SET );
590+ len = snprintf (buffer , sizeof (buffer ), "0" );
591+ if (write (pwm -> enable_fd , buffer , len ) < 0 ) {
592+ return BBIO_SYSFS ;
593+ }
594+
595+ // Unexport the PWM
596+ // TODO later
597+ #endif
598+
598599 //close the fd
599600 close (pwm -> period_fd );
600601 close (pwm -> duty_fd );
You can’t perform that action at this time.
0 commit comments