Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 5 additions & 27 deletions docs_src/docs/api_guide/doxy_samples/drivers/Gp_timer_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ void close(void)
void gptimer_free_run_no_interrupt(void)
{

uint32_t conifgMode;
conifgMode = GPTIMER_MODE_CONFIG_FREE_RUN;

GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
(void *)NULL);
GPTIMER_setFreeRunMode(gGpTimerHandle);
/* Start the Timer */
GPTIMER_start(gGpTimerHandle);

Expand All @@ -78,13 +74,9 @@ void overflowCallback(GPTIMER_Handle handle)
void gptimer_free_run_interrupt(void)
{

uint32_t conifgMode;
conifgMode = GPTIMER_MODE_CONFIG_FREE_RUN;

SemaphoreP_constructBinary(&overflowSemObj, 0);

GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
(void *)NULL);
GPTIMER_setFreeRunMode(gGpTimerHandle);
/* Add Callback */
GPTIMER_setCallbackFxn(gGpTimerHandle, overflowCallback, NULL, NULL);
/* Start the Timer */
Expand All @@ -111,13 +103,9 @@ void gptimer_output_compare_interrupt(void)
{
SemaphoreP_constructBinary(&compareMatchSemObj, 0);

uint32_t conifgMode;

conifgMode = GPTIMER_MODE_CONFIG_OUTPUT_COMPARE;
compareConfig.cntCompareValComp = (0x017D7840U);

GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
(void *)(&compareConfig));
GPTIMER_setOpCompareMode(gGpTimerHandle, &compareConfig);
/* Add Callback */
GPTIMER_setCallbackFxn(gGpTimerHandle, NULL, compareMatchCallback, NULL);
/* Start the TImer */
Expand Down Expand Up @@ -145,14 +133,10 @@ void gptimer_input_capture_interrupt(void)
{
SemaphoreP_constructBinary(&captureSemObj, 0);

uint32_t conifgMode;

conifgMode = GPTIMER_MODE_CONFIG_INPUT_CAPTURE;
inputCaptureConfig.captureMode = GPTIMER_INPUT_CAPTURE_MODE_SECOND;
inputCaptureConfig.captureEventMode = GPTIMER_INPUT_CAPTURE_EVENT_EDGE;

GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
(void *)(&inputCaptureConfig));
GPTIMER_setIpCaptureMode(gGpTimerHandle, &inputCaptureConfig);
/* Add Callback */
GPTIMER_setCallbackFxn(gGpTimerHandle, NULL, NULL, CaptureCallbackUser);
/* Start the Timer */
Expand All @@ -169,18 +153,12 @@ void gptimer_input_capture_interrupt(void)

void gptimer_pwm_gen(void)
{

uint32_t conifgMode;

conifgMode = GPTIMER_MODE_CONFIG_PWM_GEN;

pwmConfig.trigOutputPWMMode = GPTIMER_PWM_OUT_OVERFLOW_MATCH_TRIGGER,
pwmConfig.defaultPWMOutSetting = GPTIMER_PWM_OUT_PIN_DEFAULT_0,
pwmConfig.cntCompareValPWM = 4294954795,
pwmConfig.outputModulationType = GPTIMER_PWM_OUT_PIN_MODULATION_TOGGLE,

GPTIMER_setTimerConfigMode(gGpTimerHandle, conifgMode,
(void *)(&pwmConfig));
GPTIMER_setPWMGenMode(gGpTimerHandle, &pwmConfig);

/* Start the Timer */
GPTIMER_start(gGpTimerHandle);
Expand Down
Loading
Loading