Compare commits
	
		
			1 Commits
		
	
	
		
			master
			...
			GPIO_ISR_D
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
									
								
								 | 
						85a2491634 | 
							
								
								
									
										19
									
								
								Blink/main.c
								
								
								
								
							
							
						
						
									
										19
									
								
								Blink/main.c
								
								
								
								
							| 
						 | 
					@ -31,15 +31,15 @@ x   GPIODEN -- GPIO Digital Enable -- 0x00011111 >> 0x1F
 | 
				
			||||||
    register uint32_t x = ZERO_DEF;
 | 
					    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 = 0x4;
 | 
				
			||||||
        GPIO_PORTF_DATA_R = 0x8;
 | 
					//    while(1)
 | 
				
			||||||
        GPIO_PORTF_DATA_R = 0xE;
 | 
					//    {
 | 
				
			||||||
    }
 | 
					//        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++;
 | 
					        x++;
 | 
				
			||||||
        counter_loop();
 | 
					        counter_loop();
 | 
				
			||||||
 | 
					        GPIO_PORTF_DATA_R ^= 0x2;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,7 +61,7 @@ void GPIO_PORTF_Init(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void counter_loop (void)
 | 
					void counter_loop (void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    register uint32_t count=10;
 | 
					    uint32_t count = 0xFFFFFF;
 | 
				
			||||||
    while(count>0)
 | 
					    while(count>0)
 | 
				
			||||||
        count--;
 | 
					        count--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,14 +10,12 @@ void SystickHandler(void);
 | 
				
			||||||
void Systick_Init(void);
 | 
					void Systick_Init(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
volatile uint32_t systick_count = 1;
 | 
					volatile uint32_t systick_count = 1;
 | 
				
			||||||
 | 
					volatile uint32_t global_counter = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(void)
 | 
					int main(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    GPIO_PORTF_Init();
 | 
					    GPIO_PORTF_Init();
 | 
				
			||||||
    //Systick_Init();
 | 
					    //Systick_Init();
 | 
				
			||||||
     while(1);
 | 
					     while(1);
 | 
				
			||||||
| 
						 | 
					@ -26,8 +24,13 @@ int main(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SW2_Handler(void)
 | 
					void SW2_Handler(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    GPIO_PORTF_DATA_R ^= 0x8;
 | 
					    //Start with some nops and then try some dela
 | 
				
			||||||
    GPIO_PORTF_ICR_R = 0xff;
 | 
					
 | 
				
			||||||
 | 
					    //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
 | 
					    //GPIOIEV -- Interropt Event  --> 0 for falling edge      --> 0x00
 | 
				
			||||||
    GPIO_PORTF_IEV_R = 0x0;
 | 
					    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;
 | 
					    GPIO_PORTF_ICR_R = 0xff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //GPIOIM -- Interrupt Mask    --> 1 for unmasked (enabled)--> 0x01
 | 
					    //GPIOIM -- Interrupt Mask    --> 1 for unmasked (enabled)--> 0x01
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue