diff --git a/Group21_Lab06_Task1/main.c b/Group21_Lab06_Task1/main.c index 31d27d7..1a11395 100644 --- a/Group21_Lab06_Task1/main.c +++ b/Group21_Lab06_Task1/main.c @@ -16,4 +16,14 @@ void GPIO_PORT_F_init(void) GPIO_PORTF_IBE_R = 0x00; // Trigger on one edge GPIO_PORTF_IEV_R = 0x00; // Falling edge event GPIO_PORTF_IM_R |= 0x11; // Unmask interrupts for PF0 and PF4 -} \ No newline at end of file +} +#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 COUNT_FLAG (1 << 16) // Bit 16 of CSR automatically set to 1 +#define ENABLE (1 << 0) // Bit 0 of CSR to enable the timer +#define CLKINT (1 << 2) // Bit 2 of CSR to specify CPU clock +#define CLOCK_HZ 16000000 // Clock frequency of EK-TM4C123GXL +#define INTEN (1 << 1) // Bit 1 of CSR to enable interrupt +#define SYSTICK_RELOAD_VALUE(us) ((CLOCK_HZ / 1000000) * (us) - 1) // SysTick reload value in microseconds based on clock frequency