From 368145b99cc1c11499ff320f483567149f5f6a51 Mon Sep 17 00:00:00 2001 From: Uttam Ambappa Bhavimani Date: Sun, 22 Sep 2024 19:50:42 +0530 Subject: [PATCH] Update Group21_Lab06_Task2/main.c Add Defines --- Group21_Lab06_Task2/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Group21_Lab06_Task2/main.c b/Group21_Lab06_Task2/main.c index b78af4e..bcf15c4 100644 --- a/Group21_Lab06_Task2/main.c +++ b/Group21_Lab06_Task2/main.c @@ -6,3 +6,14 @@ volatile int duty = 50; // Initial duty cycle volatile bool buttonPressed = false; // Track button state volatile uint32_t pressDuration = 0; // Track how long the button is pressed const long int PWM_PERIOD = 1000000; // Period for 100kHz in microseconds (10ms) +#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 +