Test program done

This commit is contained in:
Luca Lizaranzu
2026-03-20 11:41:44 -07:00
parent 303a554595
commit 1b29371fff
20 changed files with 1037 additions and 114 deletions

View File

@@ -21,18 +21,19 @@ public:
/// Initializes a timer
/// \param prescaler The amount of times the base clock has to cycle before the timer adds one to the count
/// \param autoReload The number of timer counts before the count is reset and IRQ is called
void init(uint16_t prescaler, uint16_t autoReload);
void init(uint32_t prescaler, uint32_t autoReload);
void init() const; //Empty init (enable RCC)
/// Simple function to set a timer in basic PWM mode
/// @param channel Channel to output on
/// @param prescaler Divider from sysclock
/// @param autoReload Counter value to reset at
/// @param captureCompareThreshold PWM trigger value (duty cycle = this / autoReload)
void configurePWM(SHAL_Timer_Channel channel, uint16_t prescaler, uint16_t autoReload, uint16_t captureCompareThreshold);
void configurePWM(SHAL_Timer_Channel channel, uint32_t prescaler, uint32_t autoReload, uint32_t captureCompareThreshold);
void configureOneshot(SHAL_Timer_Channel channel, uint16_t prescaler, uint16_t autoReload, uint16_t captureCompareThreshold);
void configureOneshot(SHAL_Timer_Channel channel, uint32_t prescaler, uint32_t autoReload, uint32_t captureCompareThreshold);
//Starts the counter
void start();
@@ -41,16 +42,16 @@ public:
void stop() const;
//Set prescaler value
void setPrescaler(uint16_t presc) const;
void setPrescaler(uint32_t presc) const;
//Set auto reload register
void setARR(uint16_t arr) const;
void setARR(uint32_t arr) const;
//Enable interrupts
void enableInterrupt();
//Capture Compare Functions
void setCaptureCompareValue(SHAL_Timer_Channel channel, uint16_t value);
void setCaptureCompareValue(SHAL_Timer_Channel channel, uint32_t value) const;
void enableChannel(SHAL_Timer_Channel channel, SHAL_Timer_Channel_Main_Output_Mode mainOutputMode, SHAL_Timer_Channel_Complimentary_Output_Mode complimentaryOutputMode);
void setOutputCompareMode(SHAL_Timer_Channel channel, SHAL_TIM_Output_Compare_Mode outputCompareMode);