Remove pwm functionality because we have to rewrite it with the new statemachine module anyway.
This commit is contained in:
parent
6289c630f6
commit
f941df08c0
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
void pwm_init(void);
|
void pwm_init(void);
|
||||||
void pwm_worker(void);
|
void pwm_worker(void);
|
||||||
void test_pwm(void);
|
void pwm_interrupt(void);
|
23
src/pwm.c
23
src/pwm.c
@ -10,7 +10,7 @@ uint32_t interrupt_counter = 0;
|
|||||||
|
|
||||||
void pwm_init(void)
|
void pwm_init(void)
|
||||||
{
|
{
|
||||||
timer_subToT1Overflow(test_pwm);
|
tmr_subToT1Overflow(pwm_interrupt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pwm_worker()
|
void pwm_worker()
|
||||||
@ -18,28 +18,9 @@ void pwm_worker()
|
|||||||
if (!interrupt_received)
|
if (!interrupt_received)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double amp = 0.0;
|
|
||||||
|
|
||||||
/* t_n is the time of nth pulse */
|
|
||||||
/* factor 0.00005 because of 1/20 kHz */
|
|
||||||
double t_n = interrupt_counter * 0.00005;
|
|
||||||
|
|
||||||
amp = sin(2*M_PI*50*t_n);
|
|
||||||
|
|
||||||
if (amp > 0.0)
|
|
||||||
timer_setT1CompareMatch((uint16_t)(amp * timer_getT1Top()));
|
|
||||||
else
|
|
||||||
timer_setT1CompareMatch(0);
|
|
||||||
|
|
||||||
/* Let's wait for next interrupt */
|
|
||||||
interrupt_received = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_pwm(void)
|
void pwm_interrupt(void)
|
||||||
{
|
{
|
||||||
interrupt_received = 1;
|
|
||||||
interrupt_counter++;
|
|
||||||
|
|
||||||
if (interrupt_counter == 400)
|
|
||||||
interrupt_counter = 0;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user