PWM Utils for the RP2040.
This module was developed as part of a personal project for a custom 3D printer bed leveling system. The PWM Utils includes a PWM-to-angle conversion feature, which is necessary because the 3D printer sends a PWM signal to control the servo motor of the auto bed leveling sensor, specifying its current state. The PWM Utils reads the PWM signal from the 3D printer, interprets it, and determines whether the auto bed leveling process has commenced.
If you want me to continue making useful apps like this please support me through the links below :)
Sets the PWM configuration.
uint pwm_set_config(uint gpio, uint clkdiv_mode, uint clkdiv);
Measures the value.
int pwm_util_get_measured_value(uint slice_num, int measure_time_ms);
Converts the measured value into frequency.
int pwm_util_measure_frequency(uint gpio);
Converts the measured value into duty cycle.
float pwm_util_measure_duty_cycle(uint gpio);
Converts the measured value into pulse width.
float pwm_util_measure_pulse_width(uint gpio);
Converts the measured value into the angle in degress.
int pwm_util_get_degrees(uint gpio);