File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -87,15 +87,18 @@ void export_pwm(struct pwm_exp *new_pwm)
8787
8888BBIO_err initialize_pwm (void )
8989{
90+ BBIO_err err ;
9091#ifdef BBBVERSION41 // don't load overlay in 4.1+
9192 if (!pwm_initialized ) {
93+ strncpy (ocp_dir , "/sys/devices/platform/ocp" , sizeof (ocp_dir ));
9294#else
9395 if (!pwm_initialized && load_device_tree ("am33xx_pwm" )) {
94- #endif
95- if (! build_path ( "/sys/devices" , "ocp" , ocp_dir , sizeof ( ocp_dir )) )
96+ err = build_path ( "/sys/devices" , "ocp" , ocp_dir , sizeof ( ocp_dir ));
97+ if (err != BBIO_OK )
9698 {
9799 return BBIO_SYSFS ;
98100 }
101+ #endif
99102 pwm_initialized = 1 ;
100103 return BBIO_OK ;
101104 }
@@ -398,7 +401,7 @@ BBIO_err pwm_disable(const char *key)
398401 pwm = pwm -> next ;
399402 }
400403 }
401- return BBIO_OK ;
404+ return BBIO_OK ;
402405}
403406
404407void pwm_cleanup (void )
Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ SOFTWARE.
2323#ifndef C_PWM_H
2424#define C_PWM_H
2525
26- int pwm_start (const char * key , float duty , float freq , int polarity );
27- int pwm_disable (const char * key );
28- int pwm_set_frequency (const char * key , float freq );
29- int pwm_set_duty_cycle (const char * key , float duty );
26+ BBIO_err pwm_start (const char * key , float duty , float freq , int polarity );
27+ BBIO_err pwm_disable (const char * key );
28+ BBIO_err pwm_set_frequency (const char * key , float freq );
29+ BBIO_err pwm_set_duty_cycle (const char * key , float duty );
30+ BBIO_err pwm_set_polarity (const char * key , int polarity );
3031void pwm_cleanup (void );
3132#endif
You can’t perform that action at this time.
0 commit comments