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

Dio Specific Arquitecture Driver More...

#include "Dio_Types.h"

Go to the source code of this file.

Macros

#define DIO_PORT_A   0u
 
#define DIO_PORT_B   1u
 
#define DIO_PORT_C   2u
 
#define DIO_PORT_D   3u
 
#define DIO_PORT_E   4u
 
#define DIO_PORT_F   5u
 

Functions

Dio_LevelType Dio_Arch_ReadChannel (Dio_PortType Port, uint8 Pin)
 Read Channel.
 
void Dio_Arch_WriteChannel (Dio_PortType Port, uint8 Pin, Dio_LevelType Level)
 Write Channel.
 
Dio_LevelType Dio_Arch_FlipChannel (Dio_PortType Port, uint8 Pin)
 Flip Channel.
 
Dio_PortLevelType Dio_Arch_ReadPort (Dio_PortType Port)
 Read Port.
 
void Dio_Arch_WritePort (Dio_PortType Port, Dio_PortLevelType Level)
 Write Port.
 
Dio_PortLevelType Dio_Arch_ReadChannelGroup (const Dio_ChannelGroupType *ChannelGroupIdPtr)
 Read Channel Group.
 
void Dio_Arch_WriteChannelGroup (const Dio_ChannelGroupType *ChannelGroupIdPtr, Dio_PortLevelType Level)
 Write Channel Group.
 
void Dio_Arch_MaskedWritePort (Dio_PortType Port, Dio_PortLevelType Level, Dio_PortLevelType Mask)
 Masked Write Port.
 

Detailed Description

Dio Specific Arquitecture Driver

Author
Diego Perez

Dio driver implementation for the STM32G0xx family of microcontrollers. This file contains the hardware specific implementation of the Dio 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

◆ Dio_Arch_FlipChannel()

Dio_LevelType Dio_Arch_FlipChannel ( Dio_PortType Port,
uint8 Pin )

Flip Channel.

This function will flip the level of the specified channel writting the opposite value in the register ODR speficied by parameter Pin. from the port specified by the parameter Port. the fucntion will also return the level of the channel after flipping it reading the value from the register IDR.

Parameters
PortPort ID.
PinPin ID.
Return values
Returnsthe level of a channel after flipping the level.
Requirement
SWS_Dio_00191, SWS_Dio_00192, SWS_Dio_00193

< Offset to set the bit in BSRR register

◆ Dio_Arch_MaskedWritePort()

void Dio_Arch_MaskedWritePort ( Dio_PortType Port,
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'.

Parameters
PortID of DIO Port.
LevelValue to be written.
MaskChannels to be masked in the port.
Requirement
SWS_Dio_00202, SWS_Dio_00203, SWS_Dio_00204

◆ Dio_Arch_ReadChannel()

Dio_LevelType Dio_Arch_ReadChannel ( Dio_PortType Port,
uint8 Pin )

Read Channel.

The function will return the bit from register IDR speficied by paramter Pin. from the port specified by the parameter Port.

Parameters
PortPort ID.
PinPin ID.
Return values
Returnsthe value of the specified DIO channel.
Requirement
SWS_Dio_00027, SWS_Dio_00074

◆ Dio_Arch_ReadChannelGroup()

Dio_PortLevelType Dio_Arch_ReadChannelGroup ( const Dio_ChannelGroupType * ChannelGroupIdPtr)

Read Channel Group.

This function will read a subset of the contiguous bits of register IDR of a port (channel group). The function will not change the remaining channels of the port or the channels

Parameters
ChannelGroupIdPtrPointer to ChannelGroup.
Return values
Returnsthe level of a subset of the adjacent bits of a port (channel group).
Requirement
SWS_Dio_00037, SWS_Dio_00092, SWS_Dio_00093, SWS_Dio_00114

◆ Dio_Arch_ReadPort()

Dio_PortLevelType Dio_Arch_ReadPort ( Dio_PortType Port)

Read Port.

The function will return the level of all pins of the port specified by the parameter Port. The function will read the value from the register IDR.

Parameters
PortID of DIO Port.
Return values
Returnsthe level of all channels on that port.
Requirement
SWS_Dio_00031, SWS_Dio_00104, SWS_Dio_00075

◆ Dio_Arch_WriteChannel()

void Dio_Arch_WriteChannel ( Dio_PortType Port,
uint8 Pin,
Dio_LevelType Level )

Write Channel.

This function will write the specified value to register ODR speficied by parameter Pin. from the port specified by the parameter Port.

Parameters
PortPort ID.
PinPin ID.
LevelValue to be written.
Requirement
SWS_Dio_00028, SWS_Dio_00029, SWS_Dio_00079

◆ Dio_Arch_WriteChannelGroup()

void Dio_Arch_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) writting the specified value to the register ODR. The function will not change the remaining channels of the port or the channels

Parameters
ChannelGroupIdPtrPointer to ChannelGroup.
LevelValue to be written.
Requirement
SWS_Dio_00039, SWS_Dio_00040, SWS_Dio_00090, SWS_Dio_00091

◆ Dio_Arch_WritePort()

void Dio_Arch_WritePort ( Dio_PortType Port,
Dio_PortLevelType Level )

Write Port.

This function is used to write a value to all channels of the specified port. The function will write the value to the register ODR.

Parameters
PortID of DIO Port.
LevelValue to be written.
Requirement
SWS_Dio_00034, SWS_Dio_00035, SWS_Dio_00105, SWS_Dio_00108