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

Port Specific Arquitecture Driver More...

#include "Port_Types.h"

Go to the source code of this file.

Macros

#define PORT_A   0u
 
#define PORT_B   1u
 
#define PORT_C   2u
 
#define PORT_D   3u
 
#define PORT_E   4u
 
#define PORT_F   5u
 
#define GET_LOW_NIBBLE(x)
 
#define GET_HIGH_NIBBLE(x)
 
#define GET_HIGH_BYTE(x)
 
#define PORT_MODE_INPUT   0x00u
 
#define PORT_MODE_OUTPUT   0x10u
 
#define PORT_MODE_ANALOG   0x30u
 
#define PORT_MODE_ALT_AF0   0x20u
 
#define PORT_MODE_ALT_AF1   0x21u
 
#define PORT_MODE_ALT_AF2   0x22u
 
#define PORT_MODE_ALT_AF3   0x23u
 
#define PORT_MODE_ALT_AF4   0x24u
 
#define PORT_MODE_ALT_AF5   0x25u
 
#define PORT_MODE_ALT_AF6   0x26u
 
#define PORT_MODE_ALT_AF7   0x27u
 
#define PORT_NOPULL   0x00u
 
#define PORT_PULLUP   0x01u
 
#define PORT_PULLDOWN   0x02u
 
#define PORT_PUSH_PULL   0x00u
 
#define PORT_OPEN_COLECTOR   0x01u
 
#define PORT_VERY_LOW_SPEED   0x00u
 
#define PORT_LOW_SPEED   0x01u
 
#define PORT_HIGH_SPEED   0x02u
 
#define PORT_VERY_HIGH_SPEED   0x03u
 
#define PORT_PIN_IN   0x00u
 
#define PORT_PIN_OUT   0x01u
 

Functions

void Port_Arch_Init (const Port_PinConfigType *PortConfigPtr)
 Initialize the GPIO pins to the configuration store on ConfigPTR.
 
void Port_Arch_SetPinDirection (const Port_PinConfigType *PortConfigPtr, Port_PinDirectionType Direction)
 Set the direction of a GPIO during runtime.
 
void Port_Arch_SetPinMode (const Port_PinConfigType *PortConfigPtr, uint8 PinMode, uint8 AltMode)
 Set the mode of a GPIO during runtime.
 
void Port_Arch_RefreshPortDirection (const Port_PinConfigType *PortConfigPtr)
 Refresh port direction.
 

Detailed Description

Port Specific Arquitecture Driver

Author
Enrique Ortega, Diego Perez

PORT driver implementation for the STM32G0xx family of microcontrollers. This file contains the hardware specific implementation of the PORT driver. The file is implemented as a means of abstraction from the hardware, this way we can avoid to include Arch headers in the actual driver header, making the low level interfaces available only for the inmediate upper layer.

Function Documentation

◆ Port_Arch_Init()

void Port_Arch_Init ( const Port_PinConfigType * PortConfigPtr)

Initialize the GPIO pins to the configuration store on ConfigPTR.

This function changes the values of the registers depending on the ConfigPtr values.

Parameters
PortConfigPtrPointer to ConfigPtr struct array.
Requirement
SWS_Port_00140

< Multiply by two on a shift operation

< operation on two bits

< Multiply by two on a shift operation

< operation on two bits

< Multiply by two on a shift operation

< operation on two bits

< get the four most significant nibble

< value of pin 8

< Multiply by four on a shift operation

< operation on four bits

< get the less significant bits

< value of pin 8

< Multiply by four on a shift operation

< operation on four bits

< get the less significant bits

◆ Port_Arch_RefreshPortDirection()

void Port_Arch_RefreshPortDirection ( const Port_PinConfigType * PortConfigPtr)

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.

Parameters
PortConfigPtrPointer for the port configuration value.
Requirement
SWS_Port_00142

< Input mode value

< General purpose output mode value

< Multiply by two on a shift operation

< operation on two bits

< get the four most significant nibble

◆ Port_Arch_SetPinDirection()

void Port_Arch_SetPinDirection ( const Port_PinConfigType * PortConfigPtr,
Port_PinDirectionType Direction )

Set the direction of a GPIO during runtime.

The function changes the registers values of the GPIOS direction during runtime.

Parameters
PortConfigPtrPointer for the port configuration value.
DirectionDirection to be changed.
Requirement
SWS_Port_00141

< Multiply by two on a shift operation

< operation on two bits

◆ Port_Arch_SetPinMode()

void Port_Arch_SetPinMode ( const Port_PinConfigType * PortConfigPtr,
uint8 PinMode,
uint8 AltMode )

Set the mode of a GPIO during runtime.

The function changes the registers values of the GPIOS mode during runtime.

Parameters
PortConfigPtrPointer for the port configuration value.
PinModePin Mode to be changed.
AltModeAltern Mode to be changed.
Requirement
SWS_Port_00145

< Multiply by two on a shift operation

< operation on two bits

< value of pin 8

< Multiply by four on a shift operation

< operation on four bits

< value of pin 8

< Multiply by four on a shift operation

< operation on four bits