14#include "pico/stdlib.h"
15#include "hardware/pwm.h"
16#include "hardware/clocks.h"
67 bool phase_correct =
false,
68 bool ch_A_inverted =
false,
69 bool ch_B_inverted =
false);
76 void start(
bool enabled);
99 void set_irq(irq_handler_t handler);
118 uint measure_duration_us;
134 uint measure_duration_us);
void clear_irq()
clear the slice IRQ
Definition hw_pwm.cpp:67
PWM(uint gpio_ch_A, uint gpio_ch_B, int step_ns, int period_us, bool phase_correct=false, bool ch_A_inverted=false, bool ch_B_inverted=false)
Construct a new PWM object assuming free running sys_clk @125 MHz => sys_clk_period = 8 ns PERIOD = 8...
Definition hw_pwm.cpp:7
void set_width_nb_of_step(uint gpio_pin, uint16_t level)
Set the pulse width in terms number of step object.
Definition hw_pwm.cpp:47
void set_irq(irq_handler_t handler)
Set the irq handler, executed each time the PWM counter wrap to 0.
Definition hw_pwm.cpp:58
static void StartTogether()
All the defined PWM slices will be synchronised.
Definition hw_pwm.cpp:37
static uint32_t slice_mask
a class variable that hold the slice number for the PWM object
Definition hw_pwm.h:37
void set_duty_cycle(uint gpio_pin, float duty_cycle)
Set the pulse width in terms of duty cycle.
Definition hw_pwm.cpp:52
void start(bool enabled)
start and stop the current PWM slice
Definition hw_pwm.cpp:42
float measure_duty_cycle()
compute the time the channel B is HI over the time of observation
Definition hw_pwm.cpp:91
uint16_t count_cycles()
gives the number of step while the signal on channel B is HI
Definition hw_pwm.cpp:97
PWMgatedMeasure(uint pin_gate, uint resolution_ns, uint measure_duration_us)
Construct a new PWMgatedMeasure object.
Definition hw_pwm.cpp:72