diff --git a/Blink/main.c b/Blink/main.c index 848362b..52c61e6 100644 --- a/Blink/main.c +++ b/Blink/main.c @@ -31,15 +31,15 @@ x GPIODEN -- GPIO Digital Enable -- 0x00011111 >> 0x1F register uint32_t x = ZERO_DEF; - GPIO_PORTF_DATA_R = 0xE; - while(1) - { - GPIO_PORTF_DATA_R = 0x0; - GPIO_PORTF_DATA_R = 0x2; - GPIO_PORTF_DATA_R = 0x4; - GPIO_PORTF_DATA_R = 0x8; - GPIO_PORTF_DATA_R = 0xE; - } + GPIO_PORTF_DATA_R = 0x4; +// while(1) +// { +// GPIO_PORTF_DATA_R = 0x0; +// GPIO_PORTF_DATA_R = 0x2; +// GPIO_PORTF_DATA_R = 0x4; +// GPIO_PORTF_DATA_R = 0x8; +// GPIO_PORTF_DATA_R = 0xE; +// } @@ -47,6 +47,7 @@ x GPIODEN -- GPIO Digital Enable -- 0x00011111 >> 0x1F { x++; counter_loop(); + GPIO_PORTF_DATA_R ^= 0x2; } } @@ -60,7 +61,7 @@ void GPIO_PORTF_Init(void) void counter_loop (void) { - register uint32_t count=10; + uint32_t count = 0xFFFFFF; while(count>0) count--; diff --git a/GPIO_Interrupts/main.c b/GPIO_Interrupts/main.c index db97222..653bc6d 100644 --- a/GPIO_Interrupts/main.c +++ b/GPIO_Interrupts/main.c @@ -10,14 +10,12 @@ void SystickHandler(void); void Systick_Init(void); volatile uint32_t systick_count = 1; - +volatile uint32_t global_counter = 0; int main(void) { - - GPIO_PORTF_Init(); //Systick_Init(); while(1); @@ -26,8 +24,13 @@ int main(void) void SW2_Handler(void) { - GPIO_PORTF_DATA_R ^= 0x8; - GPIO_PORTF_ICR_R = 0xff; + //Start with some nops and then try some dela + + //GPIO_PORTF_DATA_R ^= 0x2; + global_counter ++; + //GPIO_PORTF_ICR_R = 0x10; + GPIO_PORTF_ICR_R = 0x10; + __asm(" DSB"); } @@ -76,7 +79,7 @@ void GPIO_PORTF_Init(void) //GPIOIEV -- Interropt Event --> 0 for falling edge --> 0x00 GPIO_PORTF_IEV_R = 0x0; - //GPIOICR -- INterrpt clear -- must be cleared by writing 1 to corresponding bit --> 0xff + //GPIOICR -- Interript clear -- must be cleared by writing 1 to corresponding bit --> 0xff GPIO_PORTF_ICR_R = 0xff; //GPIOIM -- Interrupt Mask --> 1 for unmasked (enabled)--> 0x01