@@ -58,7 +58,7 @@ struct pwm_exp
5858};
5959struct pwm_exp * exported_pwms = NULL ;
6060
61- struct pwm_exp * lookup_exported_pwm (const char * key )
61+ struct pwm_exp * lookup_exported_pwm (const char * key )
6262{
6363 struct pwm_exp * pwm = exported_pwms ;
6464
@@ -77,7 +77,7 @@ struct pwm_exp *lookup_exported_pwm(const char *key)
7777void export_pwm (struct pwm_exp * new_pwm )
7878{
7979 struct pwm_exp * pwm ;
80-
80+
8181 if (exported_pwms == NULL )
8282 {
8383 // create new list
@@ -129,7 +129,6 @@ BBIO_err pwm_set_frequency(const char *key, float freq) {
129129
130130 period_ns = (unsigned long )(1e9 / freq );
131131
132-
133132 // If we're going to a shorter period, update the
134133 // duty cycle first, in order to avoid ever setting
135134 // the period < duty cycle (which would throw error)
@@ -258,7 +257,7 @@ BBIO_err pwm_set_duty_cycle(const char *key, float duty) {
258257
259258 if (pwm == NULL ) {
260259 return BBIO_GEN ;
261- }
260+ }
262261
263262 pwm -> duty = duty ;
264263 pwm -> duty_ns = (unsigned long )(pwm -> period_ns * (duty / 100.0 ));
@@ -356,7 +355,7 @@ BBIO_err pwm_setup(const char *key, float duty, float freq, int polarity)
356355 } else {
357356 perror ("stat" );
358357 return BBIO_GEN ;
359- }
358+ }
360359 } else {
361360 if (S_ISDIR (s .st_mode )) {
362361 /* It is a directory. Already exported */
@@ -423,7 +422,7 @@ BBIO_err pwm_setup(const char *key, float duty, float freq, int polarity)
423422 snprintf (period_path , sizeof (period_path ), "%s/period" , pwm_path );
424423 snprintf (polarity_path , sizeof (polarity_path ), "%s/polarity" , pwm_path );
425424
426- //add period and duty fd to pwm list
425+ //add period and duty fd to pwm list
427426 if ((period_fd = open (period_path , O_RDWR )) < 0 )
428427 return BBIO_SYSFS ;
429428
@@ -570,7 +569,7 @@ BBIO_err pwm_disable(const char *key)
570569 char buffer [2 ];
571570 size_t len ;
572571 pwm = lookup_exported_pwm (key );
573-
572+
574573 // Disable the PWM
575574 lseek (pwm -> enable_fd , 0 , SEEK_SET );
576575 len = snprintf (buffer , sizeof (buffer ), "0" );
0 commit comments