STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
Loading...
Searching...
No Matches
Port.h File Reference

Port driver configuration More...

#include "Port_Cfg.h"

Go to the source code of this file.

Functions

void Port_Init (const Port_ConfigType *ConfigPtr)
 Initialize the GPIO pins to the configuration store on ConfigPTR.
 
void Port_SetPinDirection (Port_PinType Pin, Port_PinDirectionType Direction)
 Set the direction of a GPIO during runtime.
 
void Port_SetPinMode (Port_PinType Pin, Port_PinModeType Mode)
 Set the mode of a GPIO during runtime.
 
void Port_GetVersionInfo (Std_VersionInfoType *versioninfo)
 Gets the current version.
 
void Port_RefreshPortDirection (void)
 Refresh port direction.
 

Detailed Description

Port driver configuration

Author
Daniel Byuerly, Diego Perez

This PORT driver module control the overall configuration and initialization of the port structure which is used in the DIO driver module. Therefore, the DIO driver works on pins and ports which are configured by the PORT driver.

The PORT driver shall be initialized prior to the use of the DIO functions. Otherwise, DIO functions will exhibit undefined behavior. The diagram below identifies the PORT driver functions and the structure of the PORT driver and DIO driver within the MCAL software layer. To use some functions check the Port_Cfg.h file to configured the values.

Function Documentation

◆ Port_GetVersionInfo()

void Port_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 PORT_VERSION_INFO_API to STD_ON on the Port_Cfg file.

Parameters
versioninfoPointer to Std_VersionInfoType struct.
Requirement
SWS_Port_00143

◆ Port_Init()

void Port_Init ( const Port_ConfigType * ConfigPtr)

Initialize the GPIO pins to the configuration store on ConfigPTR.

The function changes the registers values of the GPIOS depending on the values of the ConfigPtr struct, this function Initialize all pins and port of the ConfigPtr array, the length of the array is given by PORT_PIN_NUMBER_OF_PORTS, To configure the values of the struct use the symbols defined on the Port.h file.

Parameters
ConfigPtrPointer to ConfigPtr struct array.
Requirement
SWS_Port_00140, SWS_Port_00004, SWS_Port_00079, SWS_Port_00081, SWS_Port_00082

◆ Port_RefreshPortDirection()

void Port_RefreshPortDirection ( void )

Refresh port direction.

The function refreshes the registers values of the GPIOS moder during runtime to the initial values only if they are configured as non changeables.

Requirement
SWS_Port_00142, SWS_Port_00066

◆ Port_SetPinDirection()

void Port_SetPinDirection ( Port_PinType Pin,
Port_PinDirectionType Direction )

Set the direction of a GPIO during runtime.

The function changes the registers values of the GPIOS direction during runtime, to enable this function change the value of PORT_SET_PIN_DIRECTION_API to STD_ON on the Port_Cfg file. To change the direction use the symbols of PORT direction

Parameters
PinPin to change the direction.
DirectionDirection to be changed.
Requirement
SWS_Port_00141, SWS_Port_00137, SWS_Port_00138

◆ Port_SetPinMode()

void Port_SetPinMode ( Port_PinType Pin,
Port_PinModeType Mode )

Set the mode of a GPIO during runtime.

The function changes the registers values of the GPIOS mode during runtime, to eneable this function change the value of PORT_SET_PIN_MODE_API to STD_ON on the Port_Cfg file. To change the mode use the symbols of GPIO altern values.

Parameters
PinPin to change the direction.
ModeMode to be changed.
Requirement
SWS_Port_00145, SWS_Port_00005

< get the four most significant nibble

< get the less significant bits

< Max values on pin modes

< Max values on altern modes