STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
GPT driver configuration More...
#include "Gpt_Cfg.h"
Go to the source code of this file.
Functions | |
void | Gpt_Init (const Gpt_ConfigType *ConfigPtr) |
Initialize the GPT registers to the configuration stored on ConfigPtr. | |
void | Gpt_DeInit (void) |
Deinitializes the GPT driver. | |
Gpt_ValueType | Gpt_GetTimeElapsed (Gpt_ChannelType Channel) |
Returns the time already elapsed. | |
Gpt_ValueType | Gpt_GetTimeRemaining (Gpt_ChannelType Channel) |
Returns the time remaining until the target time is reached. | |
void | Gpt_StartTimer (Gpt_ChannelType Channel, Gpt_ValueType Value) |
Starts a timer channel. | |
void | Gpt_StopTimer (Gpt_ChannelType Channel) |
Stops a timer channel. | |
void | Gpt_GetVersionInfo (Std_VersionInfoType *versioninfo) |
Gets the current version. | |
void | Gpt_EnableNotification (Gpt_ChannelType Channel) |
Enables the interrupt notification for a channel. | |
void | Gpt_DisableNotification (Gpt_ChannelType Channel) |
Disables the interrupt notification for a channel. | |
void | Gpt_Notification_Channel0 (void) |
Executes the callback function defined by the user on the GPT_CHANNEL_0, validating the interrupt flag and turning it off afterwards. | |
void | Gpt_Notification_Channel1 (void) |
Executes the callback function defined by the user on the GPT_CHANNEL_1, validating the interrupt flag and turning it off afterwards. | |
GPT driver configuration
The GPT driver provides services for starting and stopping timer channels (logical timer instances assigned to a timer hardware), individual for each channel.
The tick duration of a timer channel depends on channel specific settings (part of GPT driver) as well as on system clock and settings of the clock tree controlled by the MCU module.
void Gpt_DeInit | ( | void | ) |
Deinitializes the GPT driver.
The function deinitializes the hardware used by the GPT driver (depending on configuration) to the power on reset state. Values of registers which are not writeable are excluded.
void Gpt_DisableNotification | ( | Gpt_ChannelType | Channel | ) |
Disables the interrupt notification for a channel.
The function disables the interrupt notification of the referenced channel configured for notification.
Channel | Numeric identifier of the GPT channel. |
void Gpt_EnableNotification | ( | Gpt_ChannelType | Channel | ) |
Enables the interrupt notification for a channel.
The function enables the interrupt notification of the referenced channel configured for notification.
Channel | Numeric identifier of the GPT channel. |
Gpt_ValueType Gpt_GetTimeElapsed | ( | Gpt_ChannelType | Channel | ) |
Returns the time already elapsed.
The function returns the time already elapsed. When the channel is in mode “one-shot mode”, this is the value relative to the point in time, the channel has been started.
Channel | Numeric identifier of the GPT channel. |
Returns | the current number of ticks already elapsed. |
Gpt_ValueType Gpt_GetTimeRemaining | ( | Gpt_ChannelType | Channel | ) |
Returns the time remaining until the target time is reached.
The function returns the timer value remaining until the target time will be reached next time. he remaining time is the "target time" minus the time already elapsed.
Channel | Numeric identifier of the GPT channel. |
Returns | the remaining number of ticks before the timer overflows. |
void Gpt_GetVersionInfo | ( | Std_VersionInfoType * | versioninfo | ) |
Gets the current version.
The function gives the versioninfo struct the values of the current version. to eneable this function change the value of GPT_VERSION_INFO_API to STD_ON on the Gpt_Cfg file.
versioninfo | Pointer to Std_VersionInfoType struct. |
void Gpt_Init | ( | const Gpt_ConfigType * | ConfigPtr | ) |
Initialize the GPT registers to the configuration stored on ConfigPtr.
The function Gpt_Init shall initialize the hardware timer module according to a configuration set referenced by ConfigPtr. The functions disables all interrupt notifications.
Resources that are not configured in the configuration file are not touched.
ConfigPtr | Pointer to ConfigPtr struct array. |
void Gpt_Notification_Channel0 | ( | void | ) |
Executes the callback function defined by the user on the GPT_CHANNEL_0, validating the interrupt flag and turning it off afterwards.
The notification prototype Gpt_Notification_Channel0 is for the notification callback function and shall be implemented by the user. The callback notifications Gpt_Notification_<channel> shall be configurable as pointers to user defined functions within the configuration structure.
void Gpt_Notification_Channel1 | ( | void | ) |
Executes the callback function defined by the user on the GPT_CHANNEL_1, validating the interrupt flag and turning it off afterwards.
The notification prototype Gpt_Notification_Channel1 is for the notification callback function and shall be implemented by the user. The callback notifications Gpt_Notification_<channel> shall be configurable as pointers to user defined functions within the configuration structure.
void Gpt_StartTimer | ( | Gpt_ChannelType | Channel, |
Gpt_ValueType | Value ) |
Starts a timer channel.
The function starts the selected timer channel with a defined target time. If configured and enabled, an interrupt notification or a wakeup interrupt occurs, when the target time is reached.
Channel | Numeric identifier of the GPT channel. |
Value | Target time in number of ticks. |
< TIMx Auto-reload register maximum admissible value
void Gpt_StopTimer | ( | Gpt_ChannelType | Channel | ) |
Stops a timer channel.
The function stops the selected timer channel.
Channel | Numeric identifier of the GPT channel. |