Quantcast
Channel:
Viewing all articles
Browse latest Browse all 59170

File: GPT timer

$
0
0
Hi, How we can use gpt timer as  a blinking LED on output port in different speed. I have test but its blinking speed only depend on "Period value" . Can anyone help me out this. /* HAL-only entry function */ #define COUNTS_PER_MILLISECOND (120E6/1000 ) #include "hal_data.h" void hal_entry(void) { g_timer0.p_api- open(g_timer0.p_ctrl,g_timer0.p_cfg); g_timer0.p_api- start( g_timer0.p_ctrl); timer_size_t counts = 0; while (1) { // Get current counts g_timer0.p_api- counterGet(g_timer0.p_ctrl, &counts); // Check if 500ms has elapsed = This should be a helper function at some point // Need to look if the PBCLK settings are stored in a define somewhere... if (counts 1000 *COUNTS_PER_MILLISECOND) { // Reset the timer to 0 g_timer0.p_api- reset(g_timer0.p_ctrl); break; } } } Thanks

Viewing all articles
Browse latest Browse all 59170

Trending Articles