STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
Dio driver configuration. More...
#include "Dio_Cfg.h"
Go to the source code of this file.
Functions | |
Dio_LevelType | Dio_ReadChannel (Dio_ChannelType ChannelId) |
Read Channel. | |
void | Dio_WriteChannel (Dio_ChannelType ChannelId, Dio_LevelType Level) |
Write Channel. | |
Dio_LevelType | Dio_FlipChannel (Dio_ChannelType ChannelId) |
Flip Channel. | |
Dio_PortLevelType | Dio_ReadPort (Dio_PortType PortId) |
Read Port. | |
void | Dio_WritePort (Dio_PortType PortId, Dio_PortLevelType Level) |
Write Port. | |
Dio_PortLevelType | Dio_ReadChannelGroup (const Dio_ChannelGroupType *ChannelGroupIdPtr) |
Read Channel Group. | |
void | Dio_WriteChannelGroup (const Dio_ChannelGroupType *ChannelGroupIdPtr, Dio_PortLevelType Level) |
Write Channel Group. | |
void | Dio_GetVersionInfo (Std_VersionInfoType *versioninfo) |
Get Version Info. | |
void | Dio_MaskedWritePort (Dio_PortType PortId, Dio_PortLevelType Level, Dio_PortLevelType Mask) |
Masked Write Port. | |
Dio driver configuration.
This is the file for the Dio driver, it provides functions for accessing the hardware pins of the microcontroller. It also allows the grouping of those pins.
The DIO driver provides services for reading and writing to/from: DIO Channels (Pins) DIO Ports DIO Channel Groups
This module operates on pins and ports configured by the PORT driver for this purpose. For this reason, there is no configuration and initialization of this port structure in the DIO driver.
The DIO driver provides the following functions: The Dio controller will define functions to modify the output channel levels individually, for a port or for a channel group. The Dio driver will define functions to read the level of the input and output channels individually, for a port or for a group of channels.
Dio_LevelType Dio_FlipChannel | ( | Dio_ChannelType | ChannelId | ) |
Flip Channel.
This function is used when the specified channel is configured as output channel, the Dio_FlipChannel function will read the channel level and invert it, then write the inverted level to the channel. The return value will be the inverted level of the specified channel.
ChannelId | ID of DIO channel. |
Returns | the level of a channel after flipping the level. |
void Dio_GetVersionInfo | ( | Std_VersionInfoType * | versioninfo | ) |
Get Version Info.
This function is used to define DIO driver version information.
versioninfo | Pointer to where to store the version information of this module. |
void Dio_MaskedWritePort | ( | Dio_PortType | PortId, |
Dio_PortLevelType | Level, | ||
Dio_PortLevelType | Mask ) |
Masked Write Port.
This function will set the specified value for the channels on the specified port if the corresponding bit in Mask is '1'.
PortId | ID of DIO Port. |
Level | Value to be written. |
Mask | Channels to be masked in the port. |
Dio_LevelType Dio_ReadChannel | ( | Dio_ChannelType | ChannelId | ) |
Read Channel.
The function will return the value of the specified DIO channel, taking the MSB bit as the port and the LSB bit as the pin.
ChannelId | ID of DIO channel. |
Returns | the value of the specified DIO channel. |
Dio_PortLevelType Dio_ReadChannelGroup | ( | const Dio_ChannelGroupType * | ChannelGroupIdPtr | ) |
Read Channel Group.
This function will read a subset of the contiguous bits of a port (channel group). It will also perform masking of the channel group and the function will perform the offset so that the values read by the function are aligned with the LSB.
ChannelGroupIdPtr | Pointer to ChannelGroup. |
Returns | the level of a subset of the adjacent bits of a port (channel group). |
Dio_PortLevelType Dio_ReadPort | ( | Dio_PortType | PortId | ) |
Read Port.
The function will return the level of all channels on that port, taking the MSB bit as the port and the LSB bit as the pin.
PortId | ID of DIO Port. |
Returns | the level of all channels on that port. |
void Dio_WriteChannel | ( | Dio_ChannelType | ChannelId, |
Dio_LevelType | Level ) |
Write Channel.
This function will write the specified Level to the output if the specified channel is configured as output channel, in this case the function will set the specified Level for the specified channel. Taking the MSB bit as the port and the LSB bit as the pin.
ChannelId | ID of DIO channel. |
Level | Value to be written. |
void Dio_WriteChannelGroup | ( | const Dio_ChannelGroupType * | ChannelGroupIdPtr, |
Dio_PortLevelType | Level ) |
Write Channel Group.
This function will set a subset of the adjacent bits of a port (channel group) to a specified level. The function will not change the remaining channels of the port or the channels configured as input. Also this function will perform the masking of the channel group and in addition the function will perform the shift so that the values written by the function are aligned with the LSB.
ChannelGroupIdPtr | Pointer to ChannelGroup. |
Level | Value to be written. |
void Dio_WritePort | ( | Dio_PortType | PortId, |
Dio_PortLevelType | Level ) |
Write Port.
This function is used to set the value specified by the Level parameter for the port specified in the parameters.
PortId | ID of DIO Port. |
Level | Value to be written. |