parent
ffecc74e44
commit
b44cc3d7d4
|
@ -32,3 +32,10 @@ volatile int duty = 50; // Initial duty
|
||||||
const volatile int PWM_PERIOD = 1000000; // Period for 100kHz in microseconds (10ms)
|
const volatile int PWM_PERIOD = 1000000; // Period for 100kHz in microseconds (10ms)
|
||||||
volatile int ontime = 0; // Variable to track on time
|
volatile int ontime = 0; // Variable to track on time
|
||||||
//volatile bool ledState = false; // State of the LED
|
//volatile bool ledState = false; // State of the LED
|
||||||
|
|
||||||
|
void systick_setting(void)
|
||||||
|
{
|
||||||
|
STRELOAD = SYSTICK_RELOAD_VALUE(PWM_PERIOD/100); // Set reload value for 10 µs intervals (100 kHz)
|
||||||
|
STCTRL |= (CLKINT | ENABLE | INTEN); // Set internal clock, enable the timer
|
||||||
|
STCURRENT = 0; // Clear STCURRENT value
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue