Question: void LedBlinkingTask ( uint 3 2 _ t period _ seconds ) { while ( g _ ledBlinking ) { GPIO _ PORTN _ DATA

void LedBlinkingTask(uint32_t period_seconds){
while (g_ledBlinking){
GPIO_PORTN_DATA_R |= LED_PIN; // Birinci LED'i yak
SysCtlDelay(g_ui32SysClock * period_seconds); // Belirtilen sre kadar bekle
GPIO_PORTN_DATA_R &= ~LED_PIN; // Birinci LED'i sndr
GPIO_PORTN_DATA_R |= LED_PIN2; //kinci LED'i yak
SysCtlDelay(g_ui32SysClock * period_seconds); // Belirtilen sre kadar bekle
GPIO_PORTN_DATA_R &= ~
LED_PIN2;
}
}
int main(void){
MAP_SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480,120000000);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0| GPIO_PIN_1);
MAP_GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE, GPIO_PIN_0| GPIO_PIN_1);
MAP_GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_2| GPIO_PIN_3);
MAP_GPIOPadConfigSet(GPIO_PORTJ_BASE, GPIO_PIN_0| GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
MAP_GPIOPadConfigSet(GPIO_PORTC_BASE, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_2| GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
ConfigureUART();
g_ui32SysClock = SysCtlClockGet();
MAP_SysTickPeriodSet(g_ui32SysClock /1000);
MAP_SysTickEnable();
MAP_SysTickIntEnable();
while (1){
LedBlinkingTask(2); // Start LED blinking with a 2-second period LedBlinkTask func
}
}
Hello, this code is a small part of the code I wrote for the Tiva Tm4c1294 device, I want to add a timer function called Timer() to this code and this function should not contain delay, for example, if I say Timer(5) in main after defining this function, it will need to create a 5-second timer. For example, I will be able to call this function in a led on/off function etc. It should also contain an interrupt.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!