Skip to content

Commit

Permalink
Restore blink to simple dalay
Browse files Browse the repository at this point in the history
  • Loading branch information
Renan Augusto Starke committed Feb 8, 2021
1 parent 6bcb6f9 commit 81a1e3c
Showing 1 changed file with 12 additions and 46 deletions.
58 changes: 12 additions & 46 deletions software/blink.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,21 @@
#include "_core/hardware.h"
#include "gpio/gpio.h"


void EXTI0_IRQHandler(void)
{
OUTBUS = 0x52;
}

void EXTI1_IRQHandler(void)
{
OUTBUS = 0xf4;
}

void TIMER0_0A_IRQHandler(void)
{
OUTBUS = OUTBUS + 1;
}
void TIMER0_0B_IRQHandler(void)
{
OUTBUS = OUTBUS + 1;
}

void init_timer0(void)
{
uint32_t events;

TIMER_0->timer_reset = 1;
TIMER_0->timer_mode = 1;
TIMER_0->prescaler = 100;
TIMER_0->top_counter = 999;
TIMER_0->compare_0A = 100;
TIMER_0->compare_0B = 600;
TIMER_0->compare_1A = 10;
TIMER_0->compare_1B = 10;
TIMER_0->compare_2A = 10;
TIMER_0->compare_2B = 10;
TIMER_0->enable_irq = 3;
TIMER_0->timer_reset = 0;
}

int main(){
uint32_t data = 0;

input_interrupt_enable(GPIO0,FALLING_EDGE);
input_interrupt_enable(GPIO1,RISING_EDGE);
init_timer0();


while (1){
HEX0 = ~timer_get_output0A();
HEX1 = ~timer_get_output0B();
/* Read input bus */
if (INBUS)
/* Resets data when any input is high */
data = 0;

/* Counter blink */
OUTBUS = data;
delay_(10000);

data++;
}

return 0;
}
}

0 comments on commit 81a1e3c

Please sign in to comment.