mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
ce4bc77aaf
Add hw-pwm gem with pulse width modulation support: - Common Ruby API with frequency, duty, period_us, pulse_width_us - ports/esp32/ using LEDC peripheral - ports/rp2040/ using Pico SDK PWM hardware Based on picoruby-pwm by HASUMI Hitoshi. Co-authored-by: Claude <noreply@anthropic.com>
21 lines
396 B
C
21 lines
396 B
C
#ifndef MRUBY_PWM_H
|
|
#define MRUBY_PWM_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* HAL functions - implemented in ports/<platform>/pwm.c */
|
|
void mrb_pwm_init(uint32_t pin);
|
|
void mrb_pwm_set_freq_duty(uint32_t pin, float frequency, float duty);
|
|
void mrb_pwm_set_enabled(uint32_t pin, bool enabled);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* MRUBY_PWM_H */
|