Hi @Julián_AragónM ,
I tried the GPT example. I did all the necessary settings in the configuration tools. I'm posting my code below. Somehow it doesn't work, Kindly help.
@
/**
* @file main.c
*
* @addtogroup main_module main module documentation
* @{
*/
/* Including necessary configuration files. */
#include "Mcal.h"
#include "Mcu.h"
#include "Port.h"
#include "Dio.h"
#include "Gpt.h"
#include "Platform.h"
static volatile uint8 toggleLed = 0U;
void Gpt_PitNotification(void)
{
toggleLed = 1U;
}
/*void TestDelay(uint32 delay);
void TestDelay(uint32 delay)
{
static volatile uint32 DelayTimer = 0;
while(DelayTimer<delay)
{
DelayTimer++;
}
DelayTimer=0;
}*/
/* User includes */
/*!
\brief The main function for the project.
\details The startup initialization sequence is the following:
* - startup asm routine
* - main()
*/
int main(void)
{
uint8 pinValue = STD_LOW;
Mcu_Init(&Mcu_Config_BOARD_InitPeripherals);
/* Initialize the clock tree and apply PLL as system clock */
Mcu_InitClock(McuClockSettingConfig_0);
#if (STD_OFF == MCU_NO_PLL)
while ( MCU_PLL_LOCKED != Mcu_GetPllStatus() )
{
/* Busy wait until the System PLL is locked */
}
Mcu_DistributePllClock();
#endif
/* Apply a mode configuration */
Mcu_SetMode(McuModeSettingConf_0);
/* Initialize all pins using the Port driver */
Port_Init(NULL_PTR);
/* Initialize Platform driver */
Platform_Init(NULL_PTR);
/* Initialize the high level configuration structure of Gpt driver */
#if (STD_ON == GPT_PRECOMPILE_SUPPORT)
Gpt_Init(NULL_PTR);
#else
Gpt_Init(&Gpt_Config_VS_0);
#endif
/* Start the Gpt timer */
Gpt_StartTimer(GptConf_GptChannelConfiguration_GptChannelConfiguration_0, 20000000U);
/* Enable the Gpt notification to get the event for toggling the LED periodically */
Gpt_EnableNotification(GptConf_GptChannelConfiguration_GptChannelConfiguration_0);
Dio_WriteChannel(83, STD_HIGH);
for(;;)
{
if (1U == toggleLed)
{
//count++;
pinValue = (STD_LOW == pinValue) ? STD_HIGH : STD_LOW;
Dio_WriteChannel(85, pinValue);
toggleLed = 0U;
}
//Dio_WriteChannel(83, STD_HIGH);
//Dio_WriteChannel(85, STD_HIGH);
//TestDelay(2000000);
//Dio_WriteChannel(85, STD_LOW);
//Dio_WriteChannel(83, STD_LOW);
//TestDelay(2000000);
}
return 0;
}
/** @} */
Also, can you guide me to where the void Gpt_PitNotification(void) function is declared? I just want to confirm if it is timer interrupt callback function?