28
28
#include <stdint.h>
29
29
30
30
#include "py/runtime.h"
31
- #include "common-hal/pulseio /PWMOut.h"
32
- #include "shared-bindings/pulseio /PWMOut.h"
31
+ #include "common-hal/pwmio /PWMOut.h"
32
+ #include "shared-bindings/pwmio /PWMOut.h"
33
33
#include "shared-bindings/microcontroller/Processor.h"
34
34
#include "timer_handler.h"
35
35
@@ -78,13 +78,13 @@ void timer_reset_ok(int index, bool is_tc) {
78
78
}
79
79
80
80
81
- void common_hal_pulseio_pwmout_never_reset ( pulseio_pwmout_obj_t * self ) {
81
+ void common_hal_pwmio_pwmout_never_reset ( pwmio_pwmout_obj_t * self ) {
82
82
timer_never_reset (self -> timer -> index , self -> timer -> is_tc );
83
83
84
84
never_reset_pin_number (self -> pin -> number );
85
85
}
86
86
87
- void common_hal_pulseio_pwmout_reset_ok ( pulseio_pwmout_obj_t * self ) {
87
+ void common_hal_pwmio_pwmout_reset_ok ( pwmio_pwmout_obj_t * self ) {
88
88
timer_reset_ok (self -> timer -> index , self -> timer -> is_tc );
89
89
}
90
90
@@ -137,7 +137,7 @@ bool channel_ok(const pin_timer_t* t) {
137
137
t -> is_tc ;
138
138
}
139
139
140
- pwmout_result_t common_hal_pulseio_pwmout_construct ( pulseio_pwmout_obj_t * self ,
140
+ pwmout_result_t common_hal_pwmio_pwmout_construct ( pwmio_pwmout_obj_t * self ,
141
141
const mcu_pin_obj_t * pin ,
142
142
uint16_t duty ,
143
143
uint32_t frequency ,
@@ -296,16 +296,16 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
296
296
297
297
gpio_set_pin_function (pin -> number , GPIO_PIN_FUNCTION_E + mux_position );
298
298
299
- common_hal_pulseio_pwmout_set_duty_cycle (self , duty );
299
+ common_hal_pwmio_pwmout_set_duty_cycle (self , duty );
300
300
return PWMOUT_OK ;
301
301
}
302
302
303
- bool common_hal_pulseio_pwmout_deinited ( pulseio_pwmout_obj_t * self ) {
303
+ bool common_hal_pwmio_pwmout_deinited ( pwmio_pwmout_obj_t * self ) {
304
304
return self -> pin == NULL ;
305
305
}
306
306
307
- void common_hal_pulseio_pwmout_deinit ( pulseio_pwmout_obj_t * self ) {
308
- if (common_hal_pulseio_pwmout_deinited (self )) {
307
+ void common_hal_pwmio_pwmout_deinit ( pwmio_pwmout_obj_t * self ) {
308
+ if (common_hal_pwmio_pwmout_deinited (self )) {
309
309
return ;
310
310
}
311
311
const pin_timer_t * t = self -> timer ;
@@ -331,7 +331,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
331
331
self -> pin = NULL ;
332
332
}
333
333
334
- extern void common_hal_pulseio_pwmout_set_duty_cycle ( pulseio_pwmout_obj_t * self , uint16_t duty ) {
334
+ extern void common_hal_pwmio_pwmout_set_duty_cycle ( pwmio_pwmout_obj_t * self , uint16_t duty ) {
335
335
// Store the unadjusted duty cycle. It turns out the the process of adjusting and calculating
336
336
// the duty cycle here and reading it back is lossy - the value will decay over time.
337
337
// Track it here so that if frequency is changed we can use this value to recalculate the
@@ -373,7 +373,7 @@ extern void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self,
373
373
}
374
374
}
375
375
376
- uint16_t common_hal_pulseio_pwmout_get_duty_cycle ( pulseio_pwmout_obj_t * self ) {
376
+ uint16_t common_hal_pwmio_pwmout_get_duty_cycle ( pwmio_pwmout_obj_t * self ) {
377
377
const pin_timer_t * t = self -> timer ;
378
378
if (t -> is_tc ) {
379
379
Tc * tc = tc_insts [t -> index ];
@@ -411,7 +411,7 @@ uint16_t common_hal_pulseio_pwmout_get_duty_cycle(pulseio_pwmout_obj_t* self) {
411
411
}
412
412
413
413
414
- void common_hal_pulseio_pwmout_set_frequency ( pulseio_pwmout_obj_t * self ,
414
+ void common_hal_pwmio_pwmout_set_frequency ( pwmio_pwmout_obj_t * self ,
415
415
uint32_t frequency ) {
416
416
if (frequency == 0 || frequency > 6000000 ) {
417
417
mp_raise_ValueError (translate ("Invalid PWM frequency" ));
@@ -466,10 +466,10 @@ void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self,
466
466
#endif
467
467
}
468
468
469
- common_hal_pulseio_pwmout_set_duty_cycle (self , self -> duty_cycle );
469
+ common_hal_pwmio_pwmout_set_duty_cycle (self , self -> duty_cycle );
470
470
}
471
471
472
- uint32_t common_hal_pulseio_pwmout_get_frequency ( pulseio_pwmout_obj_t * self ) {
472
+ uint32_t common_hal_pwmio_pwmout_get_frequency ( pwmio_pwmout_obj_t * self ) {
473
473
uint32_t system_clock = common_hal_mcu_processor_get_frequency ();
474
474
const pin_timer_t * t = self -> timer ;
475
475
uint8_t divisor ;
@@ -484,6 +484,6 @@ uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self) {
484
484
return (system_clock / prescaler [divisor ]) / (top + 1 );
485
485
}
486
486
487
- bool common_hal_pulseio_pwmout_get_variable_frequency ( pulseio_pwmout_obj_t * self ) {
487
+ bool common_hal_pwmio_pwmout_get_variable_frequency ( pwmio_pwmout_obj_t * self ) {
488
488
return self -> variable_frequency ;
489
489
}
0 commit comments