i tried to blink the led for 100ms.
i write the code like below.(use the reference code of example)
void OsIfDelay(uint32 timeoutMs) {
uint32 currentTime = 0u;
uint32 endTime = 0u;
uint32 timeoutCount = 0u;
currentTime = OsIf_GetCounter(OSIF_COUNTER_DUMMY);
timeoutCount = OsIf_MicrosToTicks(timeoutMs * 1000u, OSIF_COUNTER_DUMMY);
while (1) {
// endTime - (start count + currentCount ) = 0
endTime += OsIf_GetElapsed(¤tTime, OSIF_COUNTER_DUMMY);
if (timeoutCount <= endTime) {
break;
}
}
}
int main(void) {
/* Write your code here */
/* Initialize the Os */
OsIf_Init(NULL_PTR);
/* Initialize the Mcu */
Mcu_Init(&Mcu_Config);
/* Initialize the Mcu Clock*/
Mcu_InitClock(McuClockSettingConfig_0);
while ( MCU_PLL_LOCKED != Mcu_GetPllStatus() )
{
/* Busy wait until the System PLL is locked */
}
Mcu_DistributePllClock();
Mcu_SetMode(McuModeSettingConf_0);
// timing set
Port_Init(NULL_PTR);
// deactive WatchDog
Dio_WriteChannel(DioConf_DioChannel_WDT_EN,STD_HIGH);
// TURN LED ON/OFF, period : 100ms
while (1) {
Dio_WriteChannel(DioConf_DioChannel_LED1,STD_LOW);
OsIfDelay(100);
Dio_WriteChannel(DioConf_DioChannel_LED1,STD_HIGH);
OsIfDelay(100);
}
return 0;
}
but actually LED blink every 250ms so i think the clock initialize is wrong.
Can you help me make it work?