mirror of
https://github.com/andreili/klipper.git
synced 2025-08-23 19:34:06 +02:00
stm32: Change hard_pwm.c MAX_PWM to 257
Choose a value for MAX_PWM that avoids an expensive run-time division. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
7a9b06ad86
commit
3656006a30
@ -24,7 +24,7 @@ uint8_t gpio_in_read(struct gpio_in g);
|
|||||||
struct gpio_pwm {
|
struct gpio_pwm {
|
||||||
void *reg;
|
void *reg;
|
||||||
};
|
};
|
||||||
struct gpio_pwm gpio_pwm_setup(uint8_t pin, uint32_t cycle_time, uint8_t val);
|
struct gpio_pwm gpio_pwm_setup(uint8_t pin, uint32_t cycle_time, uint32_t val);
|
||||||
void gpio_pwm_write(struct gpio_pwm g, uint32_t val);
|
void gpio_pwm_write(struct gpio_pwm g, uint32_t val);
|
||||||
|
|
||||||
struct gpio_adc {
|
struct gpio_adc {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "internal.h" // GPIO
|
#include "internal.h" // GPIO
|
||||||
#include "sched.h" // sched_shutdown
|
#include "sched.h" // sched_shutdown
|
||||||
|
|
||||||
#define MAX_PWM 255
|
#define MAX_PWM (256 + 1)
|
||||||
DECL_CONSTANT("PWM_MAX", MAX_PWM);
|
DECL_CONSTANT("PWM_MAX", MAX_PWM);
|
||||||
|
|
||||||
struct gpio_pwm_info {
|
struct gpio_pwm_info {
|
||||||
@ -275,7 +275,8 @@ static const struct gpio_pwm_info pwm_regs[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct gpio_pwm
|
struct gpio_pwm
|
||||||
gpio_pwm_setup(uint8_t pin, uint32_t cycle_time, uint8_t val){
|
gpio_pwm_setup(uint8_t pin, uint32_t cycle_time, uint32_t val)
|
||||||
|
{
|
||||||
// Find pin in pwm_regs table
|
// Find pin in pwm_regs table
|
||||||
const struct gpio_pwm_info* p = pwm_regs;
|
const struct gpio_pwm_info* p = pwm_regs;
|
||||||
for (;; p++) {
|
for (;; p++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user