Skip to content
Snippets Groups Projects
Commit 64e197b4 authored by jamesimmanuel.magsino@stud.h-da.de's avatar jamesimmanuel.magsino@stud.h-da.de
Browse files

More changes

parent 84bf82db
Branches
No related tags found
No related merge requests found
...@@ -117,10 +117,22 @@ void set_progress(double percentage) ...@@ -117,10 +117,22 @@ void set_progress(double percentage)
} }
} }
void callback() void callback(uint gpio, uint32_t events)
{ {
int b = 4; int b = 4;
int c = 9; int c = 9;
volatile uint another_slice_num = pwm_gpio_to_slice_num(27);
if (events & GPIO_IRQ_EDGE_RISE) // reset pwm counter
{
pwm_set_counter(another_slice_num, 0);
}
else if (events & GPIO_IRQ_EDGE_FALL)
{
volatile uint16_t test = pwm_get_counter(another_slice_num);
set_progress(100);
}
} }
int a = 0; int a = 0;
...@@ -164,8 +176,11 @@ int main() ...@@ -164,8 +176,11 @@ int main()
pwm_set_clkdiv(another_slice_num, 1); pwm_set_clkdiv(another_slice_num, 1);
pwm_set_wrap(another_slice_num, 0xFFFF); pwm_set_wrap(another_slice_num, 0xFFFF);
pwm_set_clkdiv_mode(another_slice_num, PWM_DIV_FREE_RUNNING); pwm_set_clkdiv_mode(another_slice_num, PWM_DIV_FREE_RUNNING);
pwm_set_enabled(slice_num, true); pwm_set_enabled(another_slice_num, true);
set_progress(0);
gpio_set_irq_enabled_with_callback(27, GPIO_IRQ_LEVEL_LOW | GPIO_IRQ_LEVEL_HIGH | GPIO_IRQ_EDGE_FALL | GPIO_IRQ_EDGE_RISE, true, &callback);
/*
timer_hw->dbgpause = 0; timer_hw->dbgpause = 0;
gpio_init(27); gpio_init(27);
gpio_init(28); gpio_init(28);
...@@ -197,7 +212,7 @@ int main() ...@@ -197,7 +212,7 @@ int main()
set_progress(percentage); set_progress(percentage);
asm("BKPT #0"); asm("BKPT #0");
} }
*/
a = 3; a = 3;
return 0; return 0;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment