From 896914490e64afc1113a18141ea98f5580f641d2 Mon Sep 17 00:00:00 2001 From: Sanyog Date: Fri, 20 Sep 2024 21:38:29 +0530 Subject: [PATCH] add main function --- main.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index 97869be..1a3abfe 100644 --- a/main.c +++ b/main.c @@ -2,20 +2,20 @@ #include #include "tm4c123gh6pm.h" // SysTick memory-mapped registers -#define STCTRL *((volatile uint32_t *) 0xE000E010) // CONTROL AND STATUS -#define STRELOAD *((volatile uint32_t *) 0xE000E014) // RELOAD VALUE -#define STCURRENT *((volatile uint32_t *) 0xE000E018) // CURRENT VALUE -#define CLOCK_HZ 16000000 // CLOCK FREQUENCY OF EK-TM4C123GXL +#define STCTRL *((volatile uint32_t *) 0xE000E010) // CONTROL AND STATUS +#define STRELOAD *((volatile uint32_t *) 0xE000E014) // RELOAD VALUE +#define STCURRENT *((volatile uint32_t *) 0xE000E018) // CURRENT VALUE +#define CLOCK_HZ 16000000 // CLOCK FREQUENCY OF EK-TM4C123GXL #define SYSTICK_RELOAD_VALUE(us) ((CLOCK_HZ / 1000000) * (us) - 1) // SYSTICK RELOAD VALUE void GPIO_PORT_F_init(void) { - SYSCTL_RCGC2_R |= 0x00000020; // ENABLE CLOCK TO GPIOF - GPIO_PORTF_LOCK_R = 0x4C4F434B; // UNLOCK COMMIT REGISTER - GPIO_PORTF_CR_R = 0x1F; // MAKE PORTF0 CONFIGURABLE - GPIO_PORTF_DEN_R = 0x1F; // SET PORTF DIGITAL ENABLE - GPIO_PORTF_DIR_R = 0x0E; // SET PF0, PF4 as input and PF1, PF2 and PF3 as output - GPIO_PORTF_PUR_R = 0x11; // PORTF PF0 and PF4 IS PULLED UP + SYSCTL_RCGC2_R |= 0x00000020; // ENABLE CLOCK TO GPIOF + GPIO_PORTF_LOCK_R = 0x4C4F434B; // UNLOCK COMMIT REGISTER + GPIO_PORTF_CR_R = 0x1F; // MAKE PORTF0 CONFIGURABLE + GPIO_PORTF_DEN_R = 0x1F; // SET PORTF DIGITAL ENABLE + GPIO_PORTF_DIR_R = 0x0E; // SET PF0, PF4 as input and PF1, PF2 and PF3 as output + GPIO_PORTF_PUR_R = 0x11; // PORTF PF0 and PF4 IS PULLED UP NVIC_EN0_R |= 1 << 30; GPIO_PORTF_IS_R = 0x00; // Make it edge-sensitive @@ -54,3 +54,12 @@ void GPIOF_interruptHandler(void) // Interrupt handler for GPIO Port GPIO_PORTF_ICR_R = 0x01; // CLEAR INTERRUPT FLAG FOR SWITCH 1 } } + +int main(void) // MAIN FUNCTION +{ + GPIO_PORT_F_init(); // GPIO INITIALISATION FUNCTION + systick_setting(); // SYSTICK SETUP + while (1) + { // DO NOTHING + } +}