Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

=+1. How are the spinal nerves organized once they exit the cord?

Answered: 1 week ago