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

Port Specific Arquitecture Driver More...

#include "Std_Types.h"
#include "Port_Cfg.h"
#include "Port_Arch.h"
#include "Registers.h"
#include "Bfx.h"

Macros

#define TWO_BITS   0x02u
 
#define FOUR_BITS   0x04u
 
#define PIN_08_VAL   0x08u
 
#define MUL_BY_TWO   1u
 
#define MUL_BY_FOUR   2u
 

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.
 

Variables

static Port_RegisterTypePortPeripherals [] = { PORTA, PORTB, PORTC, PORTD, PORTE, PORTF }
 Global port register array.
 

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