PWM works

This commit is contained in:
Edward Emelianov
2026-03-15 23:44:58 +03:00
parent 61262435a8
commit 03b05051aa
9 changed files with 292 additions and 161 deletions

View File

@@ -91,15 +91,6 @@ typedef struct{
uint16_t threshold; // threshold for ADC measurement
} pinconfig_t;
// Timers for PWM
typedef struct{
volatile TIM_TypeDef *tim; // timer
uint8_t chidx : 2; // channel index (0..3)
uint8_t collision : 1; // have collision with other channel (1)
uint8_t collport : 1; // collision port index (0 - GPIOA, 1 - GPIOB)
uint8_t collpin : 4; // collision pin index (0..15)
} pwmtimer_t;
/*
typedef struct{
uint32_t speed;
@@ -121,5 +112,3 @@ int gpio_reinit();
int pin_out(uint8_t port, uint8_t pin, uint8_t newval);
int16_t pin_in(uint8_t port, uint8_t pin);
uint16_t gpio_alert(uint8_t port);
int canPWM(uint8_t port, uint8_t pin, pwmtimer_t *t);