File tree Expand file tree Collapse file tree
ports/raspberrypi/common-hal/pwmio Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,12 +123,6 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self,
123123 uint16_t duty ,
124124 uint32_t frequency ,
125125 bool variable_frequency ) {
126- self -> pin = pin ;
127- self -> variable_frequency = variable_frequency ;
128- self -> duty_cycle = duty ;
129-
130- claim_pin (pin );
131-
132126 if (frequency == 0 || frequency > (common_hal_mcu_processor_get_frequency () / 2 )) {
133127 return PWMOUT_INVALID_FREQUENCY ;
134128 }
@@ -141,6 +135,11 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self,
141135 return r ;
142136 }
143137
138+ claim_pin (pin );
139+
140+ self -> pin = pin ;
141+ self -> variable_frequency = variable_frequency ;
142+ self -> duty_cycle = duty ;
144143 self -> slice = slice ;
145144 self -> ab_channel = ab_channel ;
146145
You can’t perform that action at this time.
0 commit comments